--- xorg-server-1.4.2.orig/Makefile.in +++ xorg-server-1.4.2/Makefile.in @@ -35,7 +35,7 @@ subdir = . DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/xorg-server.pc.in \ - $(top_srcdir)/configure COPYING ChangeLog config.guess \ + $(top_srcdir)/configure COPYING ChangeLog compile config.guess \ config.sub depcomp install-sh ltmain.sh missing ylwrap ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ @@ -160,7 +160,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -294,10 +294,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/ChangeLog +++ xorg-server-1.4.2/ChangeLog @@ -1,3 +1,128 @@ +commit ff49f5944d06b17fb904c4f64b8660aab60d8d0d +Author: Alex Deucher +Date: Thu Jan 3 22:53:36 2008 -0500 + + Fix potential crasher in xf86CrtcRotate() + + xf86CrtcRotate() is called by randr 1.2 drivers via xf86CrtcSetMode() or xf86SetDesiredModes() + during ScreenInit() at which point pScrn->pScreen is not set. If a user specifies a rotation + in their config file pScrn->pScreen is dereferenced and boom. + +commit 969f1db96b03afa51dacce466320d311e5c9ce72 +Author: Peter Hutterer +Date: Tue Jul 29 13:17:27 2008 +0930 + + Revert "kdrive: don't post motion event if there was no motion. #16179" + + This reverts commit 5903b4c749c1136d0f3e91d5e6321b08c31da4bf. + + And this one wasn't supposed to be pushed too. + +commit a49d811065701c5f3abb25b9e4945ce7547d0b53 +Author: Peter Hutterer +Date: Tue Jul 29 13:15:50 2008 +0930 + + Revert "xkb: delete default rules when devices are closed." + + This reverts commit 7cdef0d6fc3ec6705a61014b741a4c24dc60973b. + + Nor was this one. + +commit f0f3a11acd48dd233e8808101dcc8a22591fd00c +Author: Peter Hutterer +Date: Tue Jul 29 13:15:34 2008 +0930 + + Revert "xkb: reset xkb_cached_map on CloseDownDevices." + + This reverts commit 9b62355847ce7df1ca144b4ebc9ff5c7286b573d. + + This wasn't supposed to be pushed either. + +commit b50932d998f9fe81d01a8cd22d9613aaf9136985 +Author: Peter Hutterer +Date: Tue Jul 29 13:14:02 2008 +0930 + + Revert "xfree86: AllowEmptyInput is now enabled by default if hotplugging is enabled." + + This reverts commit 153c6d48c655b3eca9a33b7487b238b42a4a3f8e. + + How did this one end up on the branch? Sure as hell wasn't supposed to be + pushed. + +commit 48a9996192613ab259549cdb7c8735d2fb31ed78 +Author: Peter Hutterer +Date: Tue Jul 29 10:00:01 2008 +0930 + + Xi: ChangeDeviceControl presence events should set the appropriate devchange. + + Requires inputproto 1.4.4 or higher. + (cherry picked from commit 591ef3c047ab3597fef9d687205e99c254ff2040) + + Modified to use the numeric value of DeviceControlChanged instead of the + define, just so we don't bork out if someone rebuilds without updating + inputproto. This is a released server, after all. + +commit 153c6d48c655b3eca9a33b7487b238b42a4a3f8e +Author: Peter Hutterer +Date: Thu Jul 3 15:05:14 2008 +0930 + + xfree86: AllowEmptyInput is now enabled by default if hotplugging is enabled. + + Remove AEI check from configImpliedLayout as the setting isn't actually parsed + at this point anyway (written by Sasha Hlusiak). + + Resurrect checkInput() and check for devices there if AEI is false (this also + creates the default devices if required). + + Set AllowEmptyInput to enabled by default if hotplugging is enabled. + (cherry picked from commit bea743f3d629bafdc301f40e9c0bc11382dfe8bc) + + Conflicts: + + hw/xfree86/common/xf86Config.c + hw/xfree86/doc/man/xorg.conf.man.pre + +commit 9b62355847ce7df1ca144b4ebc9ff5c7286b573d +Author: Peter Hutterer +Date: Wed Jun 4 11:10:11 2008 +0930 + + xkb: reset xkb_cached_map on CloseDownDevices. + + Could lead to some invalid pointers in the second server generation. + (cherry picked from commit ff3adf3e564d94fea18e48f966de40a7ded1279e) + +commit 7cdef0d6fc3ec6705a61014b741a4c24dc60973b +Author: Peter Hutterer +Date: Sun Jun 1 15:20:42 2008 +0930 + + xkb: delete default rules when devices are closed. + + We only have one set of default rules options in xkb. When the second keyboard + is brought up with Xkb options specified, these new options overwrite the old. + In future server generations, the rules used for the VCK are a mixture of the + default ones and ones previously specified for other keyboards. Simply + resetting the xkb default rules to NULL avoids this issue. + + Reproducable by setting XkbLayout "de" and XkbVariant "nodeadkeys". In the + second server generation, the VCK has "us(nodeadkeys)". This again produces a + SIGABRT when the first key is hit. + + I could not figure out why the SIGABRT happens. This patch is avoiding the + issue rather than fixing it. + (cherry picked from commit 5a3d06b8f42473cea3741dc722a775deaa2b73f6) + +commit 5903b4c749c1136d0f3e91d5e6321b08c31da4bf +Author: Peter Hutterer +Date: Mon Jun 2 11:04:41 2008 +0930 + + kdrive: don't post motion event if there was no motion. #16179 + + Based on the patch by Tomas Janousek. + Backported from master to server-1.4. + + X.Org Bug 16179 + (cherry picked from commit 26e7e69ab893d1f2b35213250ada40ec90944f62) + commit c3a7903f6a6a27e53ba0372408e0c5a68c608e86 Author: Julien Cristau Date: Wed Jun 11 16:27:10 2008 +0200 --- xorg-server-1.4.2.orig/compile +++ xorg-server-1.4.2/compile @@ -0,0 +1,142 @@ +#! /bin/sh +# Wrapper for compilers which do not understand `-c -o'. + +scriptversion=2005-05-14.22 + +# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. +# Written by Tom Tromey . +# +# 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, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# 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 file is maintained in Automake, please report +# bugs to or send patches to +# . + +case $1 in + '') + echo "$0: No command. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: compile [--help] [--version] PROGRAM [ARGS] + +Wrapper for compilers which do not understand `-c -o'. +Remove `-o dest.o' from ARGS, run PROGRAM with the remaining +arguments, and rename the output as expected. + +If you are trying to build a whole package this is not the +right script to run: please start by reading the file `INSTALL'. + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "compile $scriptversion" + exit $? + ;; +esac + +ofile= +cfile= +eat= + +for arg +do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as `compile cc -o foo foo.c'. + # So we strip `-o arg' only if arg is an object. + eat=1 + case $2 in + *.o | *.obj) + ofile=$2 + ;; + *) + set x "$@" -o "$2" + shift + ;; + esac + ;; + *.c) + cfile=$1 + set x "$@" "$1" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift +done + +if test -z "$ofile" || test -z "$cfile"; then + # If no `-o' option was seen then we might have been invoked from a + # pattern rule where we don't need one. That is ok -- this is a + # normal compilation that the losing compiler can handle. If no + # `.c' file was seen then we are probably linking. That is also + # ok. + exec "$@" +fi + +# Name of file we expect compiler to create. +cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'` + +# Create the lock directory. +# Note: use `[/.-]' here to ensure that we don't use the same name +# that we are using for the .o file. Also, base the name on the expected +# object file name, since that is what matters with a parallel build. +lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d +while true; do + if mkdir "$lockdir" >/dev/null 2>&1; then + break + fi + sleep 1 +done +# FIXME: race condition here if user kills between mkdir and trap. +trap "rmdir '$lockdir'; exit 1" 1 2 15 + +# Run the compile. +"$@" +ret=$? + +if test -f "$cofile"; then + mv "$cofile" "$ofile" +elif test -f "${cofile}bj"; then + mv "${cofile}bj" "$ofile" +fi + +rmdir "$lockdir" +exit $ret + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: --- xorg-server-1.4.2.orig/configure +++ xorg-server-1.4.2/configure @@ -909,6 +909,7 @@ FBDEVHW_FALSE FREEBSD_KLDLOAD_TRUE FREEBSD_KLDLOAD_FALSE +GLX_ARCH_DEFINES ALPHA_VIDEO_TRUE ALPHA_VIDEO_FALSE ARM_VIDEO_TRUE @@ -1170,15 +1171,17 @@ CFB_FALSE AFB_TRUE AFB_FALSE -XPRINT_CFLAGS -XPRINT_LIBS +XPRINTMODULES_CFLAGS +XPRINTMODULES_LIBS xpconfigdir MKFONTSCALE MKFONTDIR FREETYPE_CFLAGS FREETYPE_LIBS ft_config -FREETYPE_REQUIRES +XPRINT_CFLAGS +XPRINT_LIBS +XPRINT_SYS_LIBS XP_USE_FREETYPE_TRUE XP_USE_FREETYPE_FALSE XWIN_LIBS @@ -1358,8 +1361,8 @@ XF86VIDMODE_LIBS XORG_MODULES_CFLAGS XORG_MODULES_LIBS -XPRINT_CFLAGS -XPRINT_LIBS +XPRINTMODULES_CFLAGS +XPRINTMODULES_LIBS FREETYPE_CFLAGS FREETYPE_LIBS XWINMODULES_CFLAGS @@ -2202,9 +2205,10 @@ C compiler flags for XORG_MODULES, overriding pkg-config XORG_MODULES_LIBS linker flags for XORG_MODULES, overriding pkg-config - XPRINT_CFLAGS - C compiler flags for XPRINT, overriding pkg-config - XPRINT_LIBS linker flags for XPRINT, overriding pkg-config + XPRINTMODULES_CFLAGS + C compiler flags for XPRINTMODULES, overriding pkg-config + XPRINTMODULES_LIBS + linker flags for XPRINTMODULES, overriding pkg-config FREETYPE_CFLAGS C compiler flags for FREETYPE, overriding pkg-config FREETYPE_LIBS @@ -5278,7 +5282,7 @@ ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5281 "configure"' > conftest.$ac_ext + echo '#line 5285 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -8625,11 +8629,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8628: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8632: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:8632: \$? = $ac_status" >&5 + echo "$as_me:8636: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -8915,11 +8919,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8918: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8922: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:8922: \$? = $ac_status" >&5 + echo "$as_me:8926: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -9019,11 +9023,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:9022: $lt_compile\"" >&5) + (eval echo "\"\$as_me:9026: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:9026: \$? = $ac_status" >&5 + echo "$as_me:9030: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -11396,7 +11400,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:13904: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13904: \$? = $ac_status" >&5 + echo "$as_me:13908: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14001,11 +14005,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14004: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14008: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14008: \$? = $ac_status" >&5 + echo "$as_me:14012: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15599,11 +15603,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15602: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15606: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15606: \$? = $ac_status" >&5 + echo "$as_me:15610: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -15703,11 +15707,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15706: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15710: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15710: \$? = $ac_status" >&5 + echo "$as_me:15714: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17923,11 +17927,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17926: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17930: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:17930: \$? = $ac_status" >&5 + echo "$as_me:17934: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -18213,11 +18217,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:18216: $lt_compile\"" >&5) + (eval echo "\"\$as_me:18220: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:18220: \$? = $ac_status" >&5 + echo "$as_me:18224: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -18317,11 +18321,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:18320: $lt_compile\"" >&5) + (eval echo "\"\$as_me:18324: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:18324: \$? = $ac_status" >&5 + echo "$as_me:18328: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -26701,6 +26705,7 @@ _ACEOF ;; esac + GLX_ARCH_DEFINES="-D__GLX_ALIGN64 -mieee" ;; arm*) ARM_VIDEO=yes @@ -26743,6 +26748,7 @@ xorg_loader_sparcmuldiv="yes" SPARC64_VIDEO=yes BSD_ARCH_SOURCES="sparc64_video.c ioperm_noop.c" + GLX_ARCH_DEFINES="-D__GLX_ALIGN64" ;; x86_64*|amd64*) use_x86_asm="yes" @@ -26774,9 +26780,17 @@ 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 + if test "x$ALPHA_VIDEO" = xyes; then ALPHA_VIDEO_TRUE= ALPHA_VIDEO_FALSE='#' @@ -34778,20 +34792,20 @@ if test "x$XPRINT" = xyes; then pkg_failed=no -{ echo "$as_me:$LINENO: checking for XPRINT" >&5 -echo $ECHO_N "checking for XPRINT... $ECHO_C" >&6; } +{ echo "$as_me:$LINENO: checking for XPRINTMODULES" >&5 +echo $ECHO_N "checking for XPRINTMODULES... $ECHO_C" >&6; } if test -n "$PKG_CONFIG"; then - if test -n "$XPRINT_CFLAGS"; then - pkg_cv_XPRINT_CFLAGS="$XPRINT_CFLAGS" + if test -n "$XPRINTMODULES_CFLAGS"; then + pkg_cv_XPRINTMODULES_CFLAGS="$XPRINTMODULES_CFLAGS" else if test -n "$PKG_CONFIG" && \ - { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"printproto x11 xfont \$XDMCP_MODULES xau \$PIXMAN\"") >&5 - ($PKG_CONFIG --exists --print-errors "printproto x11 xfont $XDMCP_MODULES xau $PIXMAN") 2>&5 + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"printproto x11 xfont \$XDMCP_MODULES xau\"") >&5 + ($PKG_CONFIG --exists --print-errors "printproto x11 xfont $XDMCP_MODULES xau") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then - pkg_cv_XPRINT_CFLAGS=`$PKG_CONFIG --cflags "printproto x11 xfont $XDMCP_MODULES xau $PIXMAN" 2>/dev/null` + pkg_cv_XPRINTMODULES_CFLAGS=`$PKG_CONFIG --cflags "printproto x11 xfont $XDMCP_MODULES xau" 2>/dev/null` else pkg_failed=yes fi @@ -34800,16 +34814,16 @@ pkg_failed=untried fi if test -n "$PKG_CONFIG"; then - if test -n "$XPRINT_LIBS"; then - pkg_cv_XPRINT_LIBS="$XPRINT_LIBS" + if test -n "$XPRINTMODULES_LIBS"; then + pkg_cv_XPRINTMODULES_LIBS="$XPRINTMODULES_LIBS" else if test -n "$PKG_CONFIG" && \ - { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"printproto x11 xfont \$XDMCP_MODULES xau \$PIXMAN\"") >&5 - ($PKG_CONFIG --exists --print-errors "printproto x11 xfont $XDMCP_MODULES xau $PIXMAN") 2>&5 + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"printproto x11 xfont \$XDMCP_MODULES xau\"") >&5 + ($PKG_CONFIG --exists --print-errors "printproto x11 xfont $XDMCP_MODULES xau") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then - pkg_cv_XPRINT_LIBS=`$PKG_CONFIG --libs "printproto x11 xfont $XDMCP_MODULES xau $PIXMAN" 2>/dev/null` + pkg_cv_XPRINTMODULES_LIBS=`$PKG_CONFIG --libs "printproto x11 xfont $XDMCP_MODULES xau" 2>/dev/null` else pkg_failed=yes fi @@ -34828,33 +34842,33 @@ _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - XPRINT_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "printproto x11 xfont $XDMCP_MODULES xau $PIXMAN"` + XPRINTMODULES_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "printproto x11 xfont $XDMCP_MODULES xau"` else - XPRINT_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "printproto x11 xfont $XDMCP_MODULES xau $PIXMAN"` + XPRINTMODULES_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "printproto x11 xfont $XDMCP_MODULES xau"` fi # Put the nasty error message in config.log where it belongs - echo "$XPRINT_PKG_ERRORS" >&5 + echo "$XPRINTMODULES_PKG_ERRORS" >&5 - { { echo "$as_me:$LINENO: error: Package requirements (printproto x11 xfont $XDMCP_MODULES xau $PIXMAN) were not met: + { { echo "$as_me:$LINENO: error: Package requirements (printproto x11 xfont $XDMCP_MODULES xau) were not met: -$XPRINT_PKG_ERRORS +$XPRINTMODULES_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. -Alternatively, you may set the environment variables XPRINT_CFLAGS -and XPRINT_LIBS to avoid the need to call pkg-config. +Alternatively, you may set the environment variables XPRINTMODULES_CFLAGS +and XPRINTMODULES_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. " >&5 -echo "$as_me: error: Package requirements (printproto x11 xfont $XDMCP_MODULES xau $PIXMAN) were not met: +echo "$as_me: error: Package requirements (printproto x11 xfont $XDMCP_MODULES xau) were not met: -$XPRINT_PKG_ERRORS +$XPRINTMODULES_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. -Alternatively, you may set the environment variables XPRINT_CFLAGS -and XPRINT_LIBS to avoid the need to call pkg-config. +Alternatively, you may set the environment variables XPRINTMODULES_CFLAGS +and XPRINTMODULES_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. " >&2;} { (exit 1); exit 1; }; } @@ -34863,8 +34877,8 @@ is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. -Alternatively, you may set the environment variables XPRINT_CFLAGS -and XPRINT_LIBS to avoid the need to call pkg-config. +Alternatively, you may set the environment variables XPRINTMODULES_CFLAGS +and XPRINTMODULES_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . @@ -34873,24 +34887,23 @@ is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. -Alternatively, you may set the environment variables XPRINT_CFLAGS -and XPRINT_LIBS to avoid the need to call pkg-config. +Alternatively, you may set the environment variables XPRINTMODULES_CFLAGS +and XPRINTMODULES_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } else - XPRINT_CFLAGS=$pkg_cv_XPRINT_CFLAGS - XPRINT_LIBS=$pkg_cv_XPRINT_LIBS + XPRINTMODULES_CFLAGS=$pkg_cv_XPRINTMODULES_CFLAGS + XPRINTMODULES_LIBS=$pkg_cv_XPRINTMODULES_LIBS { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } : fi - XPRINT_EXTENSIONS="$XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS" - XPRINT_LIBS="$DIX_LIB $XKB_LIB $XKB_STUB_LIB $XPRINT_EXTENSIONS $MI_LIB $MIEXT_DAMAGE_LIB $CWRAP_LIB $OS_LIB $LIBS $XPRINT_LIBS" - - + XPRINT_CFLAGS="$XPRINTMODULES_CFLAGS" + XPRINT_LIBS="$XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS $MIEXT_DAMAGE_LIB $CWRAP_LIBS $XKB_LIB $XKB_STUB_LIB $DIX_LIB $MI_LIB $OS_LIB" + XPRINT_SYS_LIBS="$XPRINTMODULES_LIBS" xpconfigdir=$libdir/X11/xserver @@ -35119,10 +35132,13 @@ FREETYPE_LIBS="" FREETYPE_REQUIRES="" fi + XPRINT_CFLAGS="$XPRINT_CFLAGS $FREETYPE_CFLAGS" + XPRINT_SYS_LIBS="$XPRINT_SYS_LIBS $FREETYPE_LIBS" + # end freetype support + - # end freetype support fi if test "x$XPRINT" = xyes && test "x$XP_USE_FREETYPE" = xyes; then XP_USE_FREETYPE_TRUE= @@ -39254,6 +39270,7 @@ FBDEVHW_FALSE!$FBDEVHW_FALSE$ac_delim FREEBSD_KLDLOAD_TRUE!$FREEBSD_KLDLOAD_TRUE$ac_delim FREEBSD_KLDLOAD_FALSE!$FREEBSD_KLDLOAD_FALSE$ac_delim +GLX_ARCH_DEFINES!$GLX_ARCH_DEFINES$ac_delim ALPHA_VIDEO_TRUE!$ALPHA_VIDEO_TRUE$ac_delim ALPHA_VIDEO_FALSE!$ALPHA_VIDEO_FALSE$ac_delim ARM_VIDEO_TRUE!$ARM_VIDEO_TRUE$ac_delim @@ -39307,7 +39324,6 @@ XVMC_TRUE!$XVMC_TRUE$ac_delim XVMC_FALSE!$XVMC_FALSE$ac_delim COMPOSITE_TRUE!$COMPOSITE_TRUE$ac_delim -COMPOSITE_FALSE!$COMPOSITE_FALSE$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then @@ -39349,6 +39365,7 @@ ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF +COMPOSITE_FALSE!$COMPOSITE_FALSE$ac_delim MITSHM_TRUE!$MITSHM_TRUE$ac_delim MITSHM_FALSE!$MITSHM_FALSE$ac_delim XTRAP_TRUE!$XTRAP_TRUE$ac_delim @@ -39445,7 +39462,6 @@ DMXXMUEXAMPLES_DEP_CFLAGS!$DMXXMUEXAMPLES_DEP_CFLAGS$ac_delim DMXXMUEXAMPLES_DEP_LIBS!$DMXXMUEXAMPLES_DEP_LIBS$ac_delim DMXXIEXAMPLES_DEP_CFLAGS!$DMXXIEXAMPLES_DEP_CFLAGS$ac_delim -DMXXIEXAMPLES_DEP_LIBS!$DMXXIEXAMPLES_DEP_LIBS$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then @@ -39487,6 +39503,7 @@ ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF +DMXXIEXAMPLES_DEP_LIBS!$DMXXIEXAMPLES_DEP_LIBS$ac_delim XTSTEXAMPLES_DEP_CFLAGS!$XTSTEXAMPLES_DEP_CFLAGS$ac_delim XTSTEXAMPLES_DEP_LIBS!$XTSTEXAMPLES_DEP_LIBS$ac_delim XRESEXAMPLES_DEP_CFLAGS!$XRESEXAMPLES_DEP_CFLAGS$ac_delim @@ -39583,7 +39600,6 @@ SOLARIS_ASM_INLINE_FALSE!$SOLARIS_ASM_INLINE_FALSE$ac_delim BUILD_DARWIN_TRUE!$BUILD_DARWIN_TRUE$ac_delim BUILD_DARWIN_FALSE!$BUILD_DARWIN_FALSE$ac_delim -XQUARTZ_TRUE!$XQUARTZ_TRUE$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then @@ -39625,6 +39641,7 @@ ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF +XQUARTZ_TRUE!$XQUARTZ_TRUE$ac_delim XQUARTZ_FALSE!$XQUARTZ_FALSE$ac_delim DGA_TRUE!$DGA_TRUE$ac_delim DGA_FALSE!$DGA_FALSE$ac_delim @@ -39638,15 +39655,17 @@ CFB_FALSE!$CFB_FALSE$ac_delim AFB_TRUE!$AFB_TRUE$ac_delim AFB_FALSE!$AFB_FALSE$ac_delim -XPRINT_CFLAGS!$XPRINT_CFLAGS$ac_delim -XPRINT_LIBS!$XPRINT_LIBS$ac_delim +XPRINTMODULES_CFLAGS!$XPRINTMODULES_CFLAGS$ac_delim +XPRINTMODULES_LIBS!$XPRINTMODULES_LIBS$ac_delim xpconfigdir!$xpconfigdir$ac_delim MKFONTSCALE!$MKFONTSCALE$ac_delim MKFONTDIR!$MKFONTDIR$ac_delim FREETYPE_CFLAGS!$FREETYPE_CFLAGS$ac_delim FREETYPE_LIBS!$FREETYPE_LIBS$ac_delim ft_config!$ft_config$ac_delim -FREETYPE_REQUIRES!$FREETYPE_REQUIRES$ac_delim +XPRINT_CFLAGS!$XPRINT_CFLAGS$ac_delim +XPRINT_LIBS!$XPRINT_LIBS$ac_delim +XPRINT_SYS_LIBS!$XPRINT_SYS_LIBS$ac_delim XP_USE_FREETYPE_TRUE!$XP_USE_FREETYPE_TRUE$ac_delim XP_USE_FREETYPE_FALSE!$XP_USE_FREETYPE_FALSE$ac_delim XWIN_LIBS!$XWIN_LIBS$ac_delim @@ -39719,9 +39738,6 @@ XKB_BASE_DIRECTORY!$XKB_BASE_DIRECTORY$ac_delim XKB_BIN_DIRECTORY!$XKB_BIN_DIRECTORY$ac_delim XKM_OUTPUT_DIR!$XKM_OUTPUT_DIR$ac_delim -XKB_COMPILED_DIR!$XKB_COMPILED_DIR$ac_delim -PROJECTROOT!$PROJECTROOT$ac_delim -XORGCONFIG_DEP_CFLAGS!$XORGCONFIG_DEP_CFLAGS$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then @@ -39763,6 +39779,9 @@ ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF +XKB_COMPILED_DIR!$XKB_COMPILED_DIR$ac_delim +PROJECTROOT!$PROJECTROOT$ac_delim +XORGCONFIG_DEP_CFLAGS!$XORGCONFIG_DEP_CFLAGS$ac_delim XORGCONFIG_DEP_LIBS!$XORGCONFIG_DEP_LIBS$ac_delim XORGCFG_DEP_CFLAGS!$XORGCFG_DEP_CFLAGS$ac_delim XORGCFG_DEP_LIBS!$XORGCFG_DEP_LIBS$ac_delim @@ -39796,7 +39815,7 @@ LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 31; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 34; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 --- xorg-server-1.4.2.orig/configure.ac +++ xorg-server-1.4.2/configure.ac @@ -1623,11 +1623,10 @@ AC_MSG_RESULT([$XPRINT]) if test "x$XPRINT" = xyes; then - PKG_CHECK_MODULES([XPRINT], [printproto x11 xfont $XDMCP_MODULES xau $PIXMAN]) - XPRINT_EXTENSIONS="$XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS" - XPRINT_LIBS="$DIX_LIB $XKB_LIB $XKB_STUB_LIB $XPRINT_EXTENSIONS $MI_LIB $MIEXT_DAMAGE_LIB $CWRAP_LIB $OS_LIB $LIBS $XPRINT_LIBS" - AC_SUBST([XPRINT_CFLAGS]) - AC_SUBST([XPRINT_LIBS]) + PKG_CHECK_MODULES([XPRINTMODULES], [printproto x11 xfont $XDMCP_MODULES xau]) + XPRINT_CFLAGS="$XPRINTMODULES_CFLAGS" + XPRINT_LIBS="$XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS $MIEXT_DAMAGE_LIB $CWRAP_LIBS $XKB_LIB $XKB_STUB_LIB" + XPRINT_SYS_LIBS="$XPRINTMODULES_LIBS" xpconfigdir=$libdir/X11/xserver AC_SUBST([xpconfigdir]) @@ -1663,10 +1662,13 @@ FREETYPE_LIBS="" FREETYPE_REQUIRES="" fi - AC_SUBST(FREETYPE_LIBS) - AC_SUBST(FREETYPE_CFLAGS) - AC_SUBST(FREETYPE_REQUIRES) + XPRINT_CFLAGS="$XPRINT_CFLAGS $FREETYPE_CFLAGS" + XPRINT_SYS_LIBS="$XPRINT_SYS_LIBS $FREETYPE_LIBS" # end freetype support + + AC_SUBST([XPRINT_CFLAGS]) + AC_SUBST([XPRINT_LIBS]) + AC_SUBST([XPRINT_SYS_LIBS]) fi AM_CONDITIONAL(XP_USE_FREETYPE, [test "x$XPRINT" = xyes && test "x$XP_USE_FREETYPE" = xyes]) --- xorg-server-1.4.2.orig/XTrap/Makefile.in +++ xorg-server-1.4.2/XTrap/Makefile.in @@ -142,7 +142,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -276,10 +276,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/mi/Makefile.in +++ xorg-server-1.4.2/mi/Makefile.in @@ -162,7 +162,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -296,10 +296,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/render/Makefile.in +++ xorg-server-1.4.2/render/Makefile.in @@ -156,7 +156,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -290,10 +290,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/record/Makefile.in +++ xorg-server-1.4.2/record/Makefile.in @@ -141,7 +141,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -275,10 +275,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/dix/getevents.c +++ xorg-server-1.4.2/dix/getevents.c @@ -406,9 +406,12 @@ int numEvents = 0; CARD32 ms = 0; KeySym *map = pDev->key->curKeySyms.map; - KeySym sym = map[key_code * pDev->key->curKeySyms.mapWidth]; + KeySym sym; deviceKeyButtonPointer *kbp = NULL; + sym = map[(key_code - pDev->key->curKeySyms.minKeyCode) + * pDev->key->curKeySyms.mapWidth]; + if (!events) return 0; --- xorg-server-1.4.2.orig/dix/Makefile.in +++ xorg-server-1.4.2/dix/Makefile.in @@ -155,7 +155,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -289,10 +289,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/Xext/Makefile.in +++ xorg-server-1.4.2/Xext/Makefile.in @@ -247,7 +247,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -381,10 +381,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/include/Makefile.in +++ xorg-server-1.4.2/include/Makefile.in @@ -144,7 +144,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -278,10 +278,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/config/Makefile.in +++ xorg-server-1.4.2/config/Makefile.in @@ -163,7 +163,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -297,10 +297,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/config/dbus-api +++ xorg-server-1.4.2/config/dbus-api @@ -0,0 +1,40 @@ +D-BUS Configuration API v2 +---------------------------- + +The X server will register the bus name org.x.config.displayN, and the +object /org/x/config/N, where N is the display number. + +Currently only hotplugging of input devices is supported. + +org.x.config.input: + org.x.config.input.version: + Returns one unsigned int32, which is the API version. + + org.x.config.input.add: + Takes an argument of key/value option pairs in arrays, e.g.: + [ss][ss][ss][ss] + is the signature for four options. These options will be passed + to the input driver as with any others. + Option names beginning with _ are not allowed; they are reserved + for internal use. + + Returns a number of signed int32s. Positive integers are the + device IDs of new devices; negative numbers are X error codes, + as defined in X.h. BadMatch will be returned if the options + given do not match any device. BadValue is returned for a malformed + message. (Example: 8 is new device ID 8; -8 is BadMatch.) + + Notably, BadAlloc is never returned: the server internally signals + to D-BUS that the attempt failed for lack of memory. + + org.x.config.input.remove: + Takes one uint32 argument, which is the device ID to remove, i.e.: + u + is the signature. + + Returns one signed int32 which represents an X status as defined in + X.h. See org.x.config.input.add. Error codes are negative numbers. + + org.x.config.input.listDevices: + Lists the currently active devices. No argument. + Return value is sequence of [ ] [ ] ..., i.e. [us]. --- xorg-server-1.4.2.orig/os/Makefile.in +++ xorg-server-1.4.2/os/Makefile.in @@ -174,7 +174,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -308,10 +308,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/xkb/xkbPrOtherEv.c +++ xorg-server-1.4.2/xkb/xkbPrOtherEv.c @@ -0,0 +1,82 @@ +/************************************************************ +Copyright (c) 1995 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 + +#include +#include +#define NEED_EVENTS 1 +#include +#include +#include +#include "misc.h" +#include "inputstr.h" +#include + +#include +#include + +extern void ProcessOtherEvent( + xEvent * /* xE */, + DeviceIntPtr /* dev */, + int /* count */ +); + +/***====================================================================***/ + +void +XkbProcessOtherEvent(xEvent *xE,DeviceIntPtr dev,int count) +{ +Bool xkbCares,isBtn; + + xkbCares= True; + isBtn= False; + switch ( xE->u.u.type ) { + case KeyPress: xE->u.u.type= DeviceKeyPress; break; + case KeyRelease: xE->u.u.type= DeviceKeyRelease; break; + case ButtonPress: xE->u.u.type= DeviceButtonPress; + isBtn= True; + break; + case ButtonRelease: xE->u.u.type= DeviceButtonRelease; + isBtn= True; + break; + default: xkbCares= False; break; + } + if (xkbCares) { + if ((!isBtn)||((dev->button)&&(dev->button->xkb_acts))) { + DeviceIntPtr kbd; + if (dev->key) kbd= dev; + else kbd= (DeviceIntPtr)LookupKeyboardDevice(); + XkbHandleActions(dev,kbd,xE,count); + return; + } + } + ProcessOtherEvent(xE,dev,count); + return; +} + --- xorg-server-1.4.2.orig/xkb/Makefile.in +++ xorg-server-1.4.2/xkb/Makefile.in @@ -164,7 +164,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -298,10 +298,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/GL/Makefile.in +++ xorg-server-1.4.2/GL/Makefile.in @@ -138,7 +138,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -272,10 +272,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/GL/mesa/Makefile.in +++ xorg-server-1.4.2/GL/mesa/Makefile.in @@ -154,7 +154,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -288,10 +288,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/GL/mesa/tnl/Makefile.in +++ xorg-server-1.4.2/GL/mesa/tnl/Makefile.in @@ -145,7 +145,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -279,10 +279,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/GL/mesa/shader/Makefile.in +++ xorg-server-1.4.2/GL/mesa/shader/Makefile.in @@ -155,7 +155,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -289,10 +289,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/GL/mesa/shader/grammar/Makefile.in +++ xorg-server-1.4.2/GL/mesa/shader/grammar/Makefile.in @@ -141,7 +141,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -275,10 +275,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/GL/mesa/shader/slang/Makefile.in +++ xorg-server-1.4.2/GL/mesa/shader/slang/Makefile.in @@ -148,7 +148,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -282,10 +282,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/GL/mesa/X/Makefile.in +++ xorg-server-1.4.2/GL/mesa/X/Makefile.in @@ -142,7 +142,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -276,10 +276,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/GL/mesa/math/Makefile.in +++ xorg-server-1.4.2/GL/mesa/math/Makefile.in @@ -143,7 +143,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -277,10 +277,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/GL/mesa/swrast_setup/Makefile.in +++ xorg-server-1.4.2/GL/mesa/swrast_setup/Makefile.in @@ -141,7 +141,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -275,10 +275,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/GL/mesa/glapi/Makefile.in +++ xorg-server-1.4.2/GL/mesa/glapi/Makefile.in @@ -141,7 +141,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -275,10 +275,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/GL/mesa/swrast/Makefile.in +++ xorg-server-1.4.2/GL/mesa/swrast/Makefile.in @@ -147,7 +147,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -281,10 +281,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/GL/mesa/vbo/Makefile.in +++ xorg-server-1.4.2/GL/mesa/vbo/Makefile.in @@ -145,7 +145,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -279,10 +279,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/GL/mesa/main/Makefile.in +++ xorg-server-1.4.2/GL/mesa/main/Makefile.in @@ -154,7 +154,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -288,10 +288,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/GL/glx/glxglcore.c +++ xorg-server-1.4.2/GL/glx/glxglcore.c @@ -390,6 +390,7 @@ screen->base.destroy = __glXMesaScreenDestroy; screen->base.createContext = __glXMesaScreenCreateContext; screen->base.createDrawable = __glXMesaScreenCreateDrawable; + screen->base.swapInterval = NULL; screen->base.pScreen = pScreen; /* --- xorg-server-1.4.2.orig/GL/glx/glxdri.c +++ xorg-server-1.4.2/GL/glx/glxdri.c @@ -374,17 +374,25 @@ { RegionPtr pRegion = NULL; PixmapPtr pixmap; - int bpp, override = 0; + int bpp, override = 0, texname; GLenum format, type; ScreenPtr pScreen = glxPixmap->pScreen; __GLXDRIscreen * const screen = (__GLXDRIscreen *) __glXgetActiveScreen(pScreen->myNum); + CALL_GetIntegerv(GET_DISPATCH(), (glxPixmap->target == GL_TEXTURE_2D ? + GL_TEXTURE_BINDING_2D : + GL_TEXTURE_BINDING_RECTANGLE_NV, + &texname)); + + if (!texname) + return __glXError(GLXBadContextState); + pixmap = (PixmapPtr) glxPixmap->pDraw; if (screen->texOffsetStart && screen->driScreen.setTexOffset) { __GLXpixmap **texOffsetOverride = screen->texOffsetOverride; - int i, firstEmpty = 16, texname; + int i, firstEmpty = 16; for (i = 0; i < 16; i++) { if (texOffsetOverride[i] == glxPixmap) @@ -409,11 +417,6 @@ glxPixmap->pDRICtx = &((__GLXDRIcontext*)baseContext)->driContext; - CALL_GetIntegerv(GET_DISPATCH(), (glxPixmap->target == GL_TEXTURE_2D ? - GL_TEXTURE_BINDING_2D : - GL_TEXTURE_BINDING_RECTANGLE_NV, - &texname)); - if (texname == glxPixmap->texname) return Success; --- xorg-server-1.4.2.orig/GL/glx/Makefile.in +++ xorg-server-1.4.2/GL/glx/Makefile.in @@ -156,7 +156,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -290,10 +290,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ @@ -385,7 +388,8 @@ -I@MESA_SOURCE@/src/mesa/glapi \ -I@MESA_SOURCE@/src/mesa/main \ -DXFree86Server \ - @GLX_DEFINES@ + @GLX_DEFINES@ \ + @GLX_ARCH_DEFINES@ # none yet --- xorg-server-1.4.2.orig/GL/apple/Makefile.in +++ xorg-server-1.4.2/GL/apple/Makefile.in @@ -151,7 +151,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -285,10 +285,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/GL/apple/indirect.c +++ xorg-server-1.4.2/GL/apple/indirect.c @@ -0,0 +1,2453 @@ +/* + * GLX implementation that uses Apple's OpenGL.framework + * (Indirect rendering path) + * + * Copyright (c) 2007 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. + */ + +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + +#include "dri.h" +#include "quartz.h" + +//#include +#include +#include + +// X11 and X11's glx +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "x-hash.h" +#include "x-list.h" + +#include + +#include "glcontextmodes.h" +#include +#include + +// ggs: needed to call back to glx with visual configs +extern void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, void **configprivs); + +#define GLAQUA_DEBUG 1 + +// Write debugging output, or not +#ifdef GLAQUA_DEBUG +#define GLAQUA_DEBUG_MSG ErrorF +#else +#define GLAQUA_DEBUG_MSG(a, ...) +#endif + +static void setup_dispatch_table(void); + +// some prototypes +static __GLXscreen * __glXAquaScreenProbe(ScreenPtr pScreen); +static Bool glAquaInitVisuals(VisualPtr *visualp, DepthPtr *depthp, + int *nvisualp, int *ndepthp, + int *rootDepthp, VisualID *defaultVisp, + unsigned long sizes, int bitsPerRGB); +static void glAquaSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, + void **privates); + +static __GLinterface *glAquaCreateContext(__GLimports *imports, + __GLcontextModes *mode, + __GLinterface *shareGC); +static void glAquaResetExtension(void); +static void __glXAquaContextDestroy(__GLXcontext *baseContext); +static int __glXAquaContextMakeCurrent(__GLXcontext *baseContext); +static int __glXAquaContextLoseCurrent(__GLXcontext *baseContext); +static int __glXAquaContextForceCurrent(__GLXcontext *baseContext); +static int __glXAquaContextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc, unsigned long mask); +static __GLXdrawable * __glXAquaContextCreateDrawable(__GLXcontext *context, DrawablePtr pDraw, XID drawId); + +static CGLPixelFormatObj makeFormat(__GLcontextModes *mode); + +__GLXprovider __glXMesaProvider = { + __glXAquaScreenProbe, + "Core OpenGL", + NULL +}; + +__GLXprovider * +GlxGetMesaProvider (void) +{ + ErrorF("GlxGetMesaProvider\n"); + return &__glXMesaProvider; +} + +typedef struct __GLXAquaScreen __GLXAquaScreen; +typedef struct __GLXAquaContext __GLXAquaContext; +typedef struct __GLXAquaDrawable __GLXAquaDrawable; + +struct __GLXAquaScreen { + __GLXscreen base; + int index; + int num_vis; + __GLcontextModes *modes; +}; + +static __GLXAquaScreen glAquaScreens[MAXSCREENS]; + +struct __GLXAquaContext { + __GLXcontext base; + CGLContextObj ctx; + CGLPixelFormatObj pixelFormat; + xp_surface_id sid; + unsigned isAttached :1; +}; + +struct __GLXAquaDrawable { + __GLXdrawable base; + DrawablePtr pDraw; + xp_surface_id sid; +}; + +static __GLXcontext * +__glXAquaScreenCreateContext(__GLXscreen *screen, + __GLcontextModes *modes, + __GLXcontext *baseShareContext) +{ + __GLXAquaContext *context; + __GLXAquaContext *shareContext = (__GLXAquaContext *) baseShareContext; + CGLError gl_err; + + GLAQUA_DEBUG_MSG("glXAquaScreenCreateContext\n"); + + context = malloc (sizeof (__GLXAquaContext)); + if (context == NULL) return NULL; + + memset(context, 0, sizeof *context); + + context->base.pGlxScreen = screen; + context->base.modes = modes; + + context->base.destroy = __glXAquaContextDestroy; + context->base.makeCurrent = __glXAquaContextMakeCurrent; + context->base.loseCurrent = __glXAquaContextLoseCurrent; + context->base.copy = __glXAquaContextCopy; + context->base.forceCurrent = __glXAquaContextForceCurrent; + context->base.createDrawable = __glXAquaContextCreateDrawable; + + context->pixelFormat = makeFormat(modes); + if (!context->pixelFormat) { + free(context); + return NULL; + } + + context->ctx = NULL; + gl_err = CGLCreateContext(context->pixelFormat, + shareContext ? shareContext->ctx : NULL, + &context->ctx); + + if (gl_err != 0) { + ErrorF("CGLCreateContext error: %s\n", CGLErrorString(gl_err)); + CGLDestroyPixelFormat(context->pixelFormat); + free(context); + return NULL; + } + setup_dispatch_table(); + GLAQUA_DEBUG_MSG("glAquaCreateContext done\n"); + return &context->base; +} + +static __GLXextensionInfo __glDDXExtensionInfo = { + GL_CORE_APPLE, + glAquaResetExtension, + glAquaInitVisuals, + glAquaSetVisualConfigs +}; + +void *__glXglDDXExtensionInfo(void) { + GLAQUA_DEBUG_MSG("glXAglDDXExtensionInfo\n"); + return &__glDDXExtensionInfo; +} + +/* maps from surface id -> list of __GLcontext */ +static x_hash_table *surface_hash; + +static void __glXAquaContextDestroy(__GLXcontext *baseContext) { + x_list *lst; + + __GLXAquaContext *context = (__GLXAquaContext *) baseContext; + + GLAQUA_DEBUG_MSG("glAquaContextDestroy (ctx 0x%x)\n", + (unsigned int) baseContext); + if (context != NULL) { + if (context->sid != 0 && surface_hash != NULL) { + lst = x_hash_table_lookup(surface_hash, (void *) context->sid, NULL); + lst = x_list_remove(lst, context); + x_hash_table_insert(surface_hash, (void *) context->sid, lst); + } + + if (context->ctx != NULL) CGLDestroyContext(context->ctx); + + if (context->pixelFormat != NULL) CGLDestroyPixelFormat(context->pixelFormat); + + free(context); + } +} + +static int __glXAquaContextLoseCurrent(__GLXcontext *baseContext) { + CGLError gl_err; + + GLAQUA_DEBUG_MSG("glAquaLoseCurrent (ctx 0x%p)\n", baseContext); + + gl_err = CGLSetCurrentContext(NULL); + if (gl_err != 0) + ErrorF("CGLSetCurrentContext error: %s\n", CGLErrorString(gl_err)); + + __glXLastContext = NULL; // Mesa does this; why? + + return GL_TRUE; +} + +/* Called when a surface is destroyed as a side effect of destroying + the window it's attached to. */ +static void surface_notify(void *_arg, void *data) { + DRISurfaceNotifyArg *arg = (DRISurfaceNotifyArg *)_arg; + __GLXAquaDrawable *draw = (__GLXAquaDrawable *)data; + __GLXAquaContext *context; + x_list *lst; + if(_arg == NULL || data == NULL) { + ErrorF("surface_notify called with bad params"); + return; + } + + GLAQUA_DEBUG_MSG("surface_notify(%p, %p)\n", _arg, data); + switch (arg->kind) { + case AppleDRISurfaceNotifyDestroyed: + if (surface_hash != NULL) + x_hash_table_remove(surface_hash, (void *) arg->id); + draw->base->pDraw = NULL; + draw->sid = 0; + break; + + case AppleDRISurfaceNotifyChanged: + if (surface_hash != NULL) { + lst = x_hash_table_lookup(surface_hash, (void *) arg->id, NULL); + for (; lst != NULL; lst = lst->next) + { + context = lst->data; + xp_update_gl_context(context->ctx); + } + } + break; + default: + ErrorF("surface_notify: unknown kind %d\n", arg->kind); + break; + } +} + +static void attach(__GLXAquaContext *context, __GLXAquaDrawable *draw) { + DrawablePtr pDraw; + GLAQUA_DEBUG_MSG("attach(%p, %p)\n", context, draw); + pDraw = draw->base.pDraw; + + if (draw->sid == 0) { +// if (!quartzProcs->CreateSurface(pDraw->pScreen, pDraw->id, pDraw, + if (!DRICreateSurface(pDraw->pScreen, pDraw->id, pDraw, + 0, &draw->sid, NULL, + surface_notify, draw)) + return; + draw->pDraw = pDraw; + } + + if (!context->isAttached || context->sid != draw->sid) { + x_list *lst; + + if (xp_attach_gl_context(context->ctx, draw->sid) != Success) { +// quartzProcs->DestroySurface(pDraw->pScreen, pDraw->id, pDraw, + DRIDestroySurface(pDraw->pScreen, pDraw->id, pDraw, + surface_notify, draw); + if (surface_hash != NULL) + x_hash_table_remove(surface_hash, (void *) draw->sid); + + draw->sid = 0; + return; + } + + context->isAttached = TRUE; + context->sid = draw->sid; + + if (surface_hash == NULL) + surface_hash = x_hash_table_new(NULL, NULL, NULL, NULL); + + lst = x_hash_table_lookup(surface_hash, (void *) context->sid, NULL); + if (x_list_find(lst, context) == NULL) { + lst = x_list_prepend(lst, context); + x_hash_table_insert(surface_hash, (void *) context->sid, lst); + } + + GLAQUA_DEBUG_MSG("attached 0x%x to 0x%x\n", (unsigned int) pDraw->id, + (unsigned int) draw->sid); + } +} + +static void unattach(__GLXAquaContext *context) { + x_list *lst; + GLAQUA_DEBUG_MSG("unattach\n"); + if (context == NULL) { + ErrorF("Tried to unattach a null context\n"); + return; + } + if (context->isAttached) { + GLAQUA_DEBUG_MSG("unattaching\n"); + + if (surface_hash != NULL) { + lst = x_hash_table_lookup(surface_hash, (void *) context->sid, NULL); + lst = x_list_remove(lst, context); + x_hash_table_insert(surface_hash, (void *) context->sid, lst); + } + + CGLClearDrawable(context->ctx); + context->isAttached = FALSE; + context->sid = 0; + } +} + +static int __glXAquaContextMakeCurrent(__GLXcontext *baseContext) { + CGLError gl_err; + __GLXAquaContext *context = (__GLXAquaContext *) baseContext; + __GLXAquaDrawable *drawPriv = (__GLXAquaDrawable *) context->base.drawPriv; + __GLXAquaDrawable *readPriv = (__GLXAquaDrawable *) context->base.readPriv; + + GLAQUA_DEBUG_MSG("glAquaMakeCurrent (ctx 0x%p)\n", baseContext); + + attach(context, drawPriv); + + gl_err = CGLSetCurrentContext(context->ctx); + if (gl_err != 0) + ErrorF("CGLSetCurrentContext error: %s\n", CGLErrorString(gl_err)); + + return gl_err == 0; +} + +static GLboolean glAquaShareContext(__GLcontext *gc, __GLcontext *gcShare) +{ + GLAQUA_DEBUG_MSG("glAquaShareContext unimplemented\n"); + return GL_TRUE; +} + +static int __glXAquaContextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc, unsigned long mask) +{ + CGLError gl_err; + + __GLXAquaContext *dst = (__GLXAquaContext *) baseDst; + __GLXAquaContext *src = (__GLXAquaContext *) baseSrc; + + GLAQUA_DEBUG_MSG("GLXAquaContextCopy\n"); + + gl_err = CGLCopyContext(src->ctx, dst->ctx, mask); + if (gl_err != 0) + ErrorF("CGLCopyContext error: %s\n", CGLErrorString(gl_err)); + + return gl_err == 0; +} + +static int __glXAquaContextForceCurrent(__GLXcontext *baseContext) +{ + CGLError gl_err; + __GLXAquaContext *context = (__GLXAquaContext *) baseContext; + GLAQUA_DEBUG_MSG("glAquaForceCurrent (ctx %p)\n", context->ctx); + + gl_err = CGLSetCurrentContext(context->ctx); + if (gl_err != 0) + ErrorF("CGLSetCurrentContext error: %s\n", CGLErrorString(gl_err)); + + return gl_err == 0; +} + +/* Drawing surface notification callbacks */ + +static GLboolean __glXAquaDrawableResize(__GLXdrawable *base) { + GLAQUA_DEBUG_MSG("unimplemented glAquaDrawableResize\n"); + return GL_TRUE; +} + +static void glAquaNotifyDestroy(__GLcontext *gc) { + GLAQUA_DEBUG_MSG("unimplemented glAquaNotifyDestroy"); +} + +static GLboolean __glXAquaDrawableSwapBuffers(__GLXdrawable *base) { + __GLXAquaDrawable *glxPriv = (__GLXAquaDrawable *) base; + CGLError gl_err; + __GLXAquaContext * drawableCtx; +// GLAQUA_DEBUG_MSG("glAquaDrawableSwapBuffers(%p)\n",base); + + if(!base) { + ErrorF("glXAquaDrawbleSwapBuffers passed NULL\n"); + return GL_FALSE; + } + + drawableCtx = (__GLXAquaContext *)base->drawGlxc; + + if (drawableCtx != NULL && drawableCtx->ctx != NULL) { + gl_err = CGLFlushDrawable(drawableCtx->ctx); + if (gl_err != 0) + ErrorF("CGLFlushDrawable error: %s\n", CGLErrorString(gl_err)); + } + return GL_TRUE; +} + +static CGLPixelFormatObj makeFormat(__GLcontextModes *mode) { + int i; + CGLPixelFormatAttribute attr[64]; // currently uses max of 30 + CGLPixelFormatObj result; + GLint n_formats; + CGLError gl_err; + + GLAQUA_DEBUG_MSG("makeFormat\n"); + + if (!mode->rgbMode) + return NULL; + + i = 0; + + // attr [i++] = kCGLPFAAcelerated; // require hwaccel - BAD for multiscreen + // attr [i++] = kCGLPFANoRecovery; // disable fallback renderers - BAD + + if (mode->stereoMode) { + attr[i++] = kCGLPFAStereo; + } + if (mode->doubleBufferMode) { + attr[i++] = kCGLPFADoubleBuffer; + } + + if (mode->colorIndexMode) { + /* ignored */ + } + + if (mode->rgbMode) { + attr[i++] = kCGLPFAColorSize; + attr[i++] = mode->redBits + mode->greenBits + mode->blueBits; + attr[i++] = kCGLPFAAlphaSize; + attr[i++] = 1; /* FIXME: ignoring mode->alphaBits which is always 0 */ + } + + if (mode->haveAccumBuffer) { + attr[i++] = kCGLPFAAccumSize; + attr[i++] = mode->accumRedBits + mode->accumGreenBits + + mode->accumBlueBits + mode->accumAlphaBits; + } + + if (mode->haveDepthBuffer) { + attr[i++] = kCGLPFADepthSize; + attr[i++] = mode->depthBits; + } + + if (mode->haveStencilBuffer) { + attr[i++] = kCGLPFAStencilSize; + attr[i++] = mode->stencilBits; + } + + attr[i++] = kCGLPFAAuxBuffers; + attr[i++] = mode->numAuxBuffers; + + /* mode->level ignored */ + + /* mode->pixmapMode ? */ + + attr[i++] = 0; + + GLAQUA_DEBUG_MSG("makeFormat almost done\n"); + + result = NULL; + gl_err = CGLChoosePixelFormat(attr, &result, &n_formats); + if (gl_err != 0) + ErrorF("CGLChoosePixelFormat error: %s\n", CGLErrorString(gl_err)); + + GLAQUA_DEBUG_MSG("makeFormat done (0x%x)\n", (unsigned int) result); + + return result; +} + +// Originally copied from Mesa + +static int numConfigs = 0; +static __GLXvisualConfig *visualConfigs = NULL; +static void **visualPrivates = NULL; + +/* + * In the case the driver defines no GLX visuals we'll use these. + * Note that for TrueColor and DirectColor visuals, bufferSize is the + * sum of redSize, greenSize, blueSize and alphaSize, which may be larger + * than the nplanes/rootDepth of the server's X11 visuals + */ +#define NUM_FALLBACK_CONFIGS 5 +static __GLXvisualConfig FallbackConfigs[NUM_FALLBACK_CONFIGS] = { + /* [0] = RGB, double buffered, Z */ + { + -1, /* vid */ + -1, /* class */ + True, /* rgba */ + -1, -1, -1, 0, /* rgba sizes */ + -1, -1, -1, 0, /* rgba masks */ + 0, 0, 0, 0, /* rgba accum sizes */ + True, /* doubleBuffer */ + False, /* stereo */ + -1, /* bufferSize */ + 16, /* depthSize */ + 0, /* stencilSize */ + 0, /* auxBuffers */ + 0, /* level */ + GLX_NONE, /* visualRating */ + GLX_NONE, /* transparentPixel */ + 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ + 0 /* transparentIndex */ + }, + /* [1] = RGB, double buffered, Z, stencil, accum */ + { + -1, /* vid */ + -1, /* class */ + True, /* rgba */ + -1, -1, -1, 0, /* rgba sizes */ + -1, -1, -1, 0, /* rgba masks */ + 16, 16, 16, 0, /* rgba accum sizes */ + True, /* doubleBuffer */ + False, /* stereo */ + -1, /* bufferSize */ + 16, /* depthSize */ + 8, /* stencilSize */ + 0, /* auxBuffers */ + 0, /* level */ + GLX_NONE, /* visualRating */ + GLX_NONE, /* transparentPixel */ + 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ + 0 /* transparentIndex */ + }, + /* [2] = RGB+Alpha, double buffered, Z, stencil, accum */ + { + -1, /* vid */ + -1, /* class */ + True, /* rgba */ + -1, -1, -1, 8, /* rgba sizes */ + -1, -1, -1, -1, /* rgba masks */ + 16, 16, 16, 16, /* rgba accum sizes */ + True, /* doubleBuffer */ + False, /* stereo */ + -1, /* bufferSize */ + 16, /* depthSize */ + 8, /* stencilSize */ + 0, /* auxBuffers */ + 0, /* level */ + GLX_NONE, /* visualRating */ + GLX_NONE, /* transparentPixel */ + 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ + 0 /* transparentIndex */ + }, + /* [3] = RGB+Alpha, single buffered, Z, stencil, accum */ + { + -1, /* vid */ + -1, /* class */ + True, /* rgba */ + -1, -1, -1, 8, /* rgba sizes */ + -1, -1, -1, -1, /* rgba masks */ + 16, 16, 16, 16, /* rgba accum sizes */ + False, /* doubleBuffer */ + False, /* stereo */ + -1, /* bufferSize */ + 16, /* depthSize */ + 8, /* stencilSize */ + 0, /* auxBuffers */ + 0, /* level */ + GLX_NONE, /* visualRating */ + GLX_NONE, /* transparentPixel */ + 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ + 0 /* transparentIndex */ + }, + /* [4] = CI, double buffered, Z */ + { + -1, /* vid */ + -1, /* class */ + False, /* rgba? (false = color index) */ + -1, -1, -1, 0, /* rgba sizes */ + -1, -1, -1, 0, /* rgba masks */ + 0, 0, 0, 0, /* rgba accum sizes */ + True, /* doubleBuffer */ + False, /* stereo */ + -1, /* bufferSize */ + 16, /* depthSize */ + 0, /* stencilSize */ + 0, /* auxBuffers */ + 0, /* level */ + GLX_NONE, /* visualRating */ + GLX_NONE, /* transparentPixel */ + 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ + 0 /* transparentIndex */ + }, +}; + +static __GLXvisualConfig NullConfig = { + -1, /* vid */ + -1, /* class */ + False, /* rgba */ + -1, -1, -1, 0, /* rgba sizes */ + -1, -1, -1, 0, /* rgba masks */ + 0, 0, 0, 0, /* rgba accum sizes */ + False, /* doubleBuffer */ + False, /* stereo */ + -1, /* bufferSize */ + 16, /* depthSize */ + 0, /* stencilSize */ + 0, /* auxBuffers */ + 0, /* level */ + GLX_NONE_EXT, /* visualRating */ + 0, /* transparentPixel */ + 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ + 0 /* transparentIndex */ +}; + + +static inline int count_bits(uint32_t x) +{ + x = x - ((x >> 1) & 0x55555555); + x = (x & 0x33333333) + ((x >> 2) & 0x33333333); + x = (x + (x >> 4)) & 0x0f0f0f0f; + x = x + (x >> 8); + x = x + (x >> 16); + return x & 63; +} + + +static Bool init_visuals(int *nvisualp, VisualPtr *visualp, + VisualID *defaultVisp, + int ndepth, DepthPtr pdepth, + int rootDepth) +{ + int numRGBconfigs; + int numCIconfigs; + int numVisuals = *nvisualp; + int numNewVisuals; + int numNewConfigs; + VisualPtr pVisual = *visualp; + VisualPtr pVisualNew = NULL; + VisualID *orig_vid = NULL; + __GLcontextModes *modes; + __GLXvisualConfig *pNewVisualConfigs = NULL; + void **glXVisualPriv; + void **pNewVisualPriv; + int found_default; + int i, j, k; + + GLAQUA_DEBUG_MSG("init_visuals\n"); + + if (numConfigs > 0) + numNewConfigs = numConfigs; + else + numNewConfigs = NUM_FALLBACK_CONFIGS; + + /* Alloc space for the list of new GLX visuals */ + pNewVisualConfigs = (__GLXvisualConfig *) + malloc(numNewConfigs * sizeof(__GLXvisualConfig)); + if (!pNewVisualConfigs) { + return FALSE; + } + + /* Alloc space for the list of new GLX visual privates */ + pNewVisualPriv = (void **) malloc(numNewConfigs * sizeof(void *)); + if (!pNewVisualPriv) { + free(pNewVisualConfigs); + return FALSE; + } + + /* + ** If SetVisualConfigs was not called, then use default GLX + ** visual configs. + */ + if (numConfigs == 0) { + memcpy(pNewVisualConfigs, FallbackConfigs, + NUM_FALLBACK_CONFIGS * sizeof(__GLXvisualConfig)); + memset(pNewVisualPriv, 0, NUM_FALLBACK_CONFIGS * sizeof(void *)); + } + else { + /* copy driver's visual config info */ + for (i = 0; i < numConfigs; i++) { + pNewVisualConfigs[i] = visualConfigs[i]; + pNewVisualPriv[i] = visualPrivates[i]; + } + } + + /* Count the number of RGB and CI visual configs */ + numRGBconfigs = 0; + numCIconfigs = 0; + for (i = 0; i < numNewConfigs; i++) { + if (pNewVisualConfigs[i].rgba) + numRGBconfigs++; + else + numCIconfigs++; + } + + /* Count the total number of visuals to compute */ + numNewVisuals = 0; + for (i = 0; i < numVisuals; i++) { + int count; + + count = ((pVisual[i].class == TrueColor || + pVisual[i].class == DirectColor) + ? numRGBconfigs : numCIconfigs); + if (count == 0) + count = 1; /* preserve the existing visual */ + + numNewVisuals += count; + } + + /* Reset variables for use with the next screen/driver's visual configs */ + visualConfigs = NULL; + numConfigs = 0; + + /* Alloc temp space for the list of orig VisualIDs for each new visual */ + orig_vid = (VisualID *)malloc(numNewVisuals * sizeof(VisualID)); + if (!orig_vid) { + free(pNewVisualPriv); + free(pNewVisualConfigs); + return FALSE; + } + + /* Alloc space for the list of glXVisuals */ + modes = _gl_context_modes_create(numNewVisuals, sizeof(__GLcontextModes)); + if (modes == NULL) { + free(orig_vid); + free(pNewVisualPriv); + free(pNewVisualConfigs); + return FALSE; + } + + /* Alloc space for the list of glXVisualPrivates */ + glXVisualPriv = (void **)malloc(numNewVisuals * sizeof(void *)); + if (!glXVisualPriv) { + _gl_context_modes_destroy( modes ); + free(orig_vid); + free(pNewVisualPriv); + free(pNewVisualConfigs); + return FALSE; + } + + /* Alloc space for the new list of the X server's visuals */ + pVisualNew = (VisualPtr)malloc(numNewVisuals * sizeof(VisualRec)); + if (!pVisualNew) { + free(glXVisualPriv); + _gl_context_modes_destroy( modes ); + free(orig_vid); + free(pNewVisualPriv); + free(pNewVisualConfigs); + return FALSE; + } + + /* Initialize the new visuals */ + found_default = FALSE; + glAquaScreens[screenInfo.numScreens-1].modes = modes; + for (i = j = 0; i < numVisuals; i++) { + int is_rgb = (pVisual[i].class == TrueColor || + pVisual[i].class == DirectColor); + + if (!is_rgb) + { + /* We don't support non-rgb visuals for GL. But we don't + want to remove them either, so just pass them through + with null glX configs */ + + pVisualNew[j] = pVisual[i]; + pVisualNew[j].vid = FakeClientID(0); + + /* Check for the default visual */ + if (!found_default && pVisual[i].vid == *defaultVisp) { + *defaultVisp = pVisualNew[j].vid; + found_default = TRUE; + } + + /* Save the old VisualID */ + orig_vid[j] = pVisual[i].vid; + + /* Initialize the glXVisual */ + _gl_copy_visual_to_context_mode( modes, & NullConfig ); + modes->visualID = pVisualNew[j].vid; + + j++; + + continue; + } + + for (k = 0; k < numNewConfigs; k++) { + if (pNewVisualConfigs[k].rgba != is_rgb) + continue; + + assert( modes != NULL ); + + /* Initialize the new visual */ + pVisualNew[j] = pVisual[i]; + pVisualNew[j].vid = FakeClientID(0); + + /* Check for the default visual */ + if (!found_default && pVisual[i].vid == *defaultVisp) { + *defaultVisp = pVisualNew[j].vid; + found_default = TRUE; + } + + /* Save the old VisualID */ + orig_vid[j] = pVisual[i].vid; + + /* Initialize the glXVisual */ + _gl_copy_visual_to_context_mode( modes, & pNewVisualConfigs[k] ); + modes->visualID = pVisualNew[j].vid; + + /* + * If the class is -1, then assume the X visual information + * is identical to what GLX needs, and take them from the X + * visual. NOTE: if class != -1, then all other fields MUST + * be initialized. + */ + if (modes->visualType == GLX_NONE) { + modes->visualType = _gl_convert_from_x_visual_type( pVisual[i].class ); + modes->redBits = count_bits(pVisual[i].redMask); + modes->greenBits = count_bits(pVisual[i].greenMask); + modes->blueBits = count_bits(pVisual[i].blueMask); + modes->alphaBits = modes->alphaBits; + modes->redMask = pVisual[i].redMask; + modes->greenMask = pVisual[i].greenMask; + modes->blueMask = pVisual[i].blueMask; + modes->alphaMask = modes->alphaMask; + modes->rgbBits = (is_rgb) + ? (modes->redBits + modes->greenBits + + modes->blueBits + modes->alphaBits) + : rootDepth; + } + + /* Save the device-dependent private for this visual */ + glXVisualPriv[j] = pNewVisualPriv[k]; + + j++; + modes = modes->next; + } + } + + assert(j <= numNewVisuals); + + /* Save the GLX visuals in the screen structure */ + glAquaScreens[screenInfo.numScreens-1].num_vis = numNewVisuals; + // glAquaScreens[screenInfo.numScreens-1].priv = glXVisualPriv; + + /* Set up depth's VisualIDs */ + for (i = 0; i < ndepth; i++) { + int numVids = 0; + VisualID *pVids = NULL; + int k, n = 0; + + /* Count the new number of VisualIDs at this depth */ + for (j = 0; j < pdepth[i].numVids; j++) + for (k = 0; k < numNewVisuals; k++) + if (pdepth[i].vids[j] == orig_vid[k]) + numVids++; + + /* Allocate a new list of VisualIDs for this depth */ + pVids = (VisualID *)malloc(numVids * sizeof(VisualID)); + + /* Initialize the new list of VisualIDs for this depth */ + for (j = 0; j < pdepth[i].numVids; j++) + for (k = 0; k < numNewVisuals; k++) + if (pdepth[i].vids[j] == orig_vid[k]) + pVids[n++] = pVisualNew[k].vid; + + /* Update this depth's list of VisualIDs */ + free(pdepth[i].vids); + pdepth[i].vids = pVids; + pdepth[i].numVids = numVids; + } + + /* Update the X server's visuals */ + *nvisualp = numNewVisuals; + *visualp = pVisualNew; + + /* Free the old list of the X server's visuals */ + free(pVisual); + + /* Clean up temporary allocations */ + free(orig_vid); + free(pNewVisualPriv); + free(pNewVisualConfigs); + + /* Free the private list created by DDX HW driver */ + if (visualPrivates) + free(visualPrivates); + visualPrivates = NULL; + + return TRUE; +} + +Bool enable_stereo = FALSE; +/* based on code in i830_dri.c + This ends calling glAquaSetVisualConfigs to set the static + numconfigs, etc. */ +static void +glAquaInitVisualConfigs(void) +{ + int lclNumConfigs = 0; + __GLXvisualConfig *lclVisualConfigs = NULL; + void **lclVisualPrivates = NULL; + + int stereo, depth, aux, buffers, stencil, accum; + int i = 0; + + GLAQUA_DEBUG_MSG("glAquaInitVisualConfigs "); + + /* count num configs: + 2 stereo (on, off) (optional) + 2 Z buffer (0, 24 bit) + 2 AUX buffer (0, 2) + 2 buffers (single, double) + 2 stencil (0, 8 bit) + 2 accum (0, 64 bit) + = 64 configs with stereo, or 32 without */ + + if (enable_stereo) lclNumConfigs = 2 * 2 * 2 * 2 * 2 * 2; /* 64 */ + else lclNumConfigs = 2 * 2 * 2 * 2 * 2; /* 32 */ + + /* alloc */ + lclVisualConfigs = xcalloc(sizeof(__GLXvisualConfig), lclNumConfigs); + lclVisualPrivates = xcalloc(sizeof(void *), lclNumConfigs); + + /* fill in configs */ + if (NULL != lclVisualConfigs) { + i = 0; /* current buffer */ + for (stereo = 0; stereo < (enable_stereo ? 2 : 1); stereo++) { + for (depth = 0; depth < 2; depth++) { + for (aux = 0; aux < 2; aux++) { + for (buffers = 0; buffers < 2; buffers++) { + for (stencil = 0; stencil < 2; stencil++) { + for (accum = 0; accum < 2; accum++) { + lclVisualConfigs[i].vid = -1; + lclVisualConfigs[i].class = -1; + lclVisualConfigs[i].rgba = TRUE; + lclVisualConfigs[i].redSize = -1; + lclVisualConfigs[i].greenSize = -1; + lclVisualConfigs[i].blueSize = -1; + lclVisualConfigs[i].redMask = -1; + lclVisualConfigs[i].greenMask = -1; + lclVisualConfigs[i].blueMask = -1; + lclVisualConfigs[i].alphaMask = 0; + if (accum) { + lclVisualConfigs[i].accumRedSize = 16; + lclVisualConfigs[i].accumGreenSize = 16; + lclVisualConfigs[i].accumBlueSize = 16; + lclVisualConfigs[i].accumAlphaSize = 16; + } else { + lclVisualConfigs[i].accumRedSize = 0; + lclVisualConfigs[i].accumGreenSize = 0; + lclVisualConfigs[i].accumBlueSize = 0; + lclVisualConfigs[i].accumAlphaSize = 0; + } + lclVisualConfigs[i].doubleBuffer = buffers ? TRUE : FALSE; + lclVisualConfigs[i].stereo = stereo ? TRUE : FALSE; + lclVisualConfigs[i].bufferSize = -1; + + lclVisualConfigs[i].depthSize = depth? 24 : 0; + lclVisualConfigs[i].stencilSize = stencil ? 8 : 0; + lclVisualConfigs[i].auxBuffers = aux ? 2 : 0; + lclVisualConfigs[i].level = 0; + lclVisualConfigs[i].visualRating = GLX_NONE_EXT; + lclVisualConfigs[i].transparentPixel = 0; + lclVisualConfigs[i].transparentRed = 0; + lclVisualConfigs[i].transparentGreen = 0; + lclVisualConfigs[i].transparentBlue = 0; + lclVisualConfigs[i].transparentAlpha = 0; + lclVisualConfigs[i].transparentIndex = 0; + i++; + } + } + } + } + } + } + } + if (i != lclNumConfigs) + GLAQUA_DEBUG_MSG("glAquaInitVisualConfigs failed to alloc visual configs"); + + GlxSetVisualConfigs(lclNumConfigs, lclVisualConfigs, lclVisualPrivates); +} + + +static void glAquaSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, + void **privates) +{ + GLAQUA_DEBUG_MSG("glAquaSetVisualConfigs\n"); + + numConfigs = nconfigs; + visualConfigs = configs; + visualPrivates = privates; +} + +static Bool glAquaInitVisuals(VisualPtr *visualp, DepthPtr *depthp, + int *nvisualp, int *ndepthp, + int *rootDepthp, VisualID *defaultVisp, + unsigned long sizes, int bitsPerRGB) +{ + GLAQUA_DEBUG_MSG("glAquaInitVisuals\n"); + + if (numConfigs == 0) /* if no configs */ + glAquaInitVisualConfigs(); /* ensure the visual configs are setup */ + + /* + * Setup the visuals supported by this particular screen. + */ + return init_visuals(nvisualp, visualp, defaultVisp, + *ndepthp, *depthp, *rootDepthp); +} + +#if 0 +static void fixup_visuals(int screen) +{ + ScreenPtr pScreen = screenInfo.screens[screen]; + glAquaScreenRec *pScr = &glAquaScreens[screen]; + int j; + __GLcontextModes *modes; + + GLAQUA_DEBUG_MSG("fixup_visuals\n"); + + for ( modes = pScr->modes ; modes != NULL ; modes = modes->next ) { + const int vis_class = _gl_convert_to_x_visual_type( modes->visualType ); + const int nplanes = (modes->rgbBits - modes->alphaBits); + const VisualPtr pVis = pScreen->visuals; + + /* Find a visual that matches the GLX visual's class and size */ + for (j = 0; j < pScreen->numVisuals; j++) { + if (pVis[j].class == vis_class && + pVis[j].nplanes == nplanes) { + + /* Fixup the masks */ + modes->redMask = pVis[j].redMask; + modes->greenMask = pVis[j].greenMask; + modes->blueMask = pVis[j].blueMask; + + /* Recalc the sizes */ + modes->redBits = count_bits(modes->redMask); + modes->greenBits = count_bits(modes->greenMask); + modes->blueBits = count_bits(modes->blueMask); + } + } + } +} +#endif +static void __glXAquaScreenDestroy(__GLXscreen *screen) { + + GLAQUA_DEBUG_MSG("glXAquaScreenDestroy(%p)\n", screen); + __glXScreenDestroy(screen); + + free(screen); +} + +static void init_screen_visuals(__GLXAquaScreen *screen) { + ScreenPtr pScreen = screen->base.pScreen; + + __GLcontextModes *modes; + int *used; + int i, j; + + GLAQUA_DEBUG_MSG("init_screen_visuals\n"); + + /* FIXME: Change 'used' to be a array of bits (rather than of ints), + * FIXME: create a stack array of 8 or 16 bytes. If 'numVisuals' is less + * FIXME: than 64 or 128 the stack array can be used instead of calling + * FIXME: malloc / free. If nothing else, convert 'used' to + * FIXME: array of bytes instead of ints! + */ + used = (int *)malloc(pScreen->numVisuals * sizeof(int)); + memset(used, 0, pScreen->numVisuals * sizeof(int)); + + i = 0; + for ( modes = screen -> base.modes + ; modes != NULL + ; modes = modes->next ) { + const int vis_class = _gl_convert_to_x_visual_type( modes->visualType ); + const int nplanes = (modes->rgbBits - modes->alphaBits); + const VisualPtr pVis = pScreen->visuals; + + for (j = 0; j < pScreen->numVisuals; j++) { + if (pVis[j].class == vis_class && + pVis[j].nplanes == nplanes && + pVis[j].redMask == modes->redMask && + pVis[j].greenMask == modes->greenMask && + pVis[j].blueMask == modes->blueMask && + !used[j]) { + + /* Set the VisualID */ + modes->visualID = pVis[j].vid; + + /* Mark this visual used */ + used[j] = 1; + break; + } + } + if ( j == pScreen->numVisuals ) { + ErrorF("No matching visual for __GLcontextMode with " + "visual class = %d (%d), nplanes = %u\n", + vis_class, + (int)modes->visualType, + (unsigned int)(modes->rgbBits - modes->alphaBits) ); + } + else if ( modes->visualID == -1 ) { + FatalError( "Matching visual found, but visualID still -1!\n" ); + } + + i++; + } + + free(used); +} + +static __GLXscreen * __glXAquaScreenProbe(ScreenPtr pScreen) { + __GLXAquaScreen *screen; + GLAQUA_DEBUG_MSG("glXAquaScreenProbe\n"); + if (screen == NULL) return NULL; + + screen = malloc(sizeof *screen); + + __glXScreenInit(&screen->base, pScreen); + + screen->base.destroy = __glXAquaScreenDestroy; + screen->base.createContext = __glXAquaScreenCreateContext; + screen->base.pScreen = pScreen; + + init_screen_visuals(screen); + + return &screen->base; +} + +static void __glXAquaDrawableDestroy(__GLXdrawable *base) { + GLAQUA_DEBUG_MSG("glAquaDestroyDrawablePrivate\n"); + + /* It doesn't work to call DRIDestroySurface here, the drawable's + already gone.. But dri.c notices the window destruction and + frees the surface itself. */ + + free(base); +} + +static __GLXdrawable * +__glXAquaContextCreateDrawable(__GLXcontext *context, + DrawablePtr pDraw, + XID drawId) +{ + __GLXAquaDrawable *glxPriv; + __GLXscreen *pGlxScreen; + + GLAQUA_DEBUG_MSG("glAquaContextCreateDrawable(%p,%p,%d)\n", context, pDraw, drawId); + if (glxPriv == NULL) return NULL; + glxPriv = xalloc(sizeof *glxPriv); + + memset(glxPriv, 0, sizeof *glxPriv); + + if (!__glXDrawableInit(&glxPriv->base, context, pDraw, drawId)) { + xfree(glxPriv); + return NULL; + } + + glxPriv->base.destroy = __glXAquaDrawableDestroy; + glxPriv->base.resize = __glXAquaDrawableResize; + glxPriv->base.swapBuffers = __glXAquaDrawableSwapBuffers; + + pGlxScreen = __glXActiveScreens[pDraw->pScreen->myNum]; + + if (glxPriv->base.type == DRAWABLE_WINDOW) { + VisualID vid = wVisual((WindowPtr)pDraw); + + glxPriv->base.modes = _gl_context_modes_find_visual(pGlxScreen->modes, vid); + } else + glxPriv->base.modes = glxPriv->base.pGlxPixmap->modes; + + return &glxPriv->base; +} + +static void glAquaResetExtension(void) +{ + GLAQUA_DEBUG_MSG("glAquaResetExtension\n"); + CGLSetOption(kCGLGOResetLibrary, GL_TRUE); +} + +// Extra goodies for glx + +GLuint __glFloorLog2(GLuint val) +{ + int c = 0; + + while (val > 1) { + c++; + val >>= 1; + } + return c; +} + +static void setup_dispatch_table(void) { + struct _glapi_table *disp=_glapi_get_dispatch(); + + SET_NewList(disp, glNewList); + SET_EndList(disp, glEndList); + SET_CallList(disp, glCallList); + SET_CallLists(disp, glCallLists); + SET_DeleteLists(disp, glDeleteLists); + SET_GenLists(disp, glGenLists); + SET_ListBase(disp, glListBase); + SET_Begin(disp, glBegin); + SET_Bitmap(disp, glBitmap); + SET_Color3b(disp, glColor3b); + SET_Color3bv(disp, glColor3bv); + SET_Color3d(disp, glColor3d); + SET_Color3dv(disp, glColor3dv); + SET_Color3f(disp, glColor3f); + SET_Color3fv(disp, glColor3fv); + SET_Color3i(disp, glColor3i); + SET_Color3iv(disp, glColor3iv); + SET_Color3s(disp, glColor3s); + SET_Color3sv(disp, glColor3sv); + SET_Color3ub(disp, glColor3ub); + SET_Color3ubv(disp, glColor3ubv); + SET_Color3ui(disp, glColor3ui); + SET_Color3uiv(disp, glColor3uiv); + SET_Color3us(disp, glColor3us); + SET_Color3usv(disp, glColor3usv); + SET_Color4b(disp, glColor4b); + SET_Color4bv(disp, glColor4bv); + SET_Color4d(disp, glColor4d); + SET_Color4dv(disp, glColor4dv); + SET_Color4f(disp, glColor4f); + SET_Color4fv(disp, glColor4fv); + SET_Color4i(disp, glColor4i); + SET_Color4iv(disp, glColor4iv); + SET_Color4s(disp, glColor4s); + SET_Color4sv(disp, glColor4sv); + SET_Color4ub(disp, glColor4ub); + SET_Color4ubv(disp, glColor4ubv); + SET_Color4ui(disp, glColor4ui); + SET_Color4uiv(disp, glColor4uiv); + SET_Color4us(disp, glColor4us); + SET_Color4usv(disp, glColor4usv); + SET_EdgeFlag(disp, glEdgeFlag); + SET_EdgeFlagv(disp, glEdgeFlagv); + SET_End(disp, glEnd); + SET_Indexd(disp, glIndexd); + SET_Indexdv(disp, glIndexdv); + SET_Indexf(disp, glIndexf); + SET_Indexfv(disp, glIndexfv); + SET_Indexi(disp, glIndexi); + SET_Indexiv(disp, glIndexiv); + SET_Indexs(disp, glIndexs); + SET_Indexsv(disp, glIndexsv); + SET_Normal3b(disp, glNormal3b); + SET_Normal3bv(disp, glNormal3bv); + SET_Normal3d(disp, glNormal3d); + SET_Normal3dv(disp, glNormal3dv); + SET_Normal3f(disp, glNormal3f); + SET_Normal3fv(disp, glNormal3fv); + SET_Normal3i(disp, glNormal3i); + SET_Normal3iv(disp, glNormal3iv); + SET_Normal3s(disp, glNormal3s); + SET_Normal3sv(disp, glNormal3sv); + SET_RasterPos2d(disp, glRasterPos2d); + SET_RasterPos2dv(disp, glRasterPos2dv); + SET_RasterPos2f(disp, glRasterPos2f); + SET_RasterPos2fv(disp, glRasterPos2fv); + SET_RasterPos2i(disp, glRasterPos2i); + SET_RasterPos2iv(disp, glRasterPos2iv); + SET_RasterPos2s(disp, glRasterPos2s); + SET_RasterPos2sv(disp, glRasterPos2sv); + SET_RasterPos3d(disp, glRasterPos3d); + SET_RasterPos3dv(disp, glRasterPos3dv); + SET_RasterPos3f(disp, glRasterPos3f); + SET_RasterPos3fv(disp, glRasterPos3fv); + SET_RasterPos3i(disp, glRasterPos3i); + SET_RasterPos3iv(disp, glRasterPos3iv); + SET_RasterPos3s(disp, glRasterPos3s); + SET_RasterPos3sv(disp, glRasterPos3sv); + SET_RasterPos4d(disp, glRasterPos4d); + SET_RasterPos4dv(disp, glRasterPos4dv); + SET_RasterPos4f(disp, glRasterPos4f); + SET_RasterPos4fv(disp, glRasterPos4fv); + SET_RasterPos4i(disp, glRasterPos4i); + SET_RasterPos4iv(disp, glRasterPos4iv); + SET_RasterPos4s(disp, glRasterPos4s); + SET_RasterPos4sv(disp, glRasterPos4sv); + SET_Rectd(disp, glRectd); + SET_Rectdv(disp, glRectdv); + SET_Rectf(disp, glRectf); + SET_Rectfv(disp, glRectfv); + SET_Recti(disp, glRecti); + SET_Rectiv(disp, glRectiv); + SET_Rects(disp, glRects); + SET_Rectsv(disp, glRectsv); + SET_TexCoord1d(disp, glTexCoord1d); + SET_TexCoord1dv(disp, glTexCoord1dv); + SET_TexCoord1f(disp, glTexCoord1f); + SET_TexCoord1fv(disp, glTexCoord1fv); + SET_TexCoord1i(disp, glTexCoord1i); + SET_TexCoord1iv(disp, glTexCoord1iv); + SET_TexCoord1s(disp, glTexCoord1s); + SET_TexCoord1sv(disp, glTexCoord1sv); + SET_TexCoord2d(disp, glTexCoord2d); + SET_TexCoord2dv(disp, glTexCoord2dv); + SET_TexCoord2f(disp, glTexCoord2f); + SET_TexCoord2fv(disp, glTexCoord2fv); + SET_TexCoord2i(disp, glTexCoord2i); + SET_TexCoord2iv(disp, glTexCoord2iv); + SET_TexCoord2s(disp, glTexCoord2s); + SET_TexCoord2sv(disp, glTexCoord2sv); + SET_TexCoord3d(disp, glTexCoord3d); + SET_TexCoord3dv(disp, glTexCoord3dv); + SET_TexCoord3f(disp, glTexCoord3f); + SET_TexCoord3fv(disp, glTexCoord3fv); + SET_TexCoord3i(disp, glTexCoord3i); + SET_TexCoord3iv(disp, glTexCoord3iv); + SET_TexCoord3s(disp, glTexCoord3s); + SET_TexCoord3sv(disp, glTexCoord3sv); + SET_TexCoord4d(disp, glTexCoord4d); + SET_TexCoord4dv(disp, glTexCoord4dv); + SET_TexCoord4f(disp, glTexCoord4f); + SET_TexCoord4fv(disp, glTexCoord4fv); + SET_TexCoord4i(disp, glTexCoord4i); + SET_TexCoord4iv(disp, glTexCoord4iv); + SET_TexCoord4s(disp, glTexCoord4s); + SET_TexCoord4sv(disp, glTexCoord4sv); + SET_Vertex2d(disp, glVertex2d); + SET_Vertex2dv(disp, glVertex2dv); + SET_Vertex2f(disp, glVertex2f); + SET_Vertex2fv(disp, glVertex2fv); + SET_Vertex2i(disp, glVertex2i); + SET_Vertex2iv(disp, glVertex2iv); + SET_Vertex2s(disp, glVertex2s); + SET_Vertex2sv(disp, glVertex2sv); + SET_Vertex3d(disp, glVertex3d); + SET_Vertex3dv(disp, glVertex3dv); + SET_Vertex3f(disp, glVertex3f); + SET_Vertex3fv(disp, glVertex3fv); + SET_Vertex3i(disp, glVertex3i); + SET_Vertex3iv(disp, glVertex3iv); + SET_Vertex3s(disp, glVertex3s); + SET_Vertex3sv(disp, glVertex3sv); + SET_Vertex4d(disp, glVertex4d); + SET_Vertex4dv(disp, glVertex4dv); + SET_Vertex4f(disp, glVertex4f); + SET_Vertex4fv(disp, glVertex4fv); + SET_Vertex4i(disp, glVertex4i); + SET_Vertex4iv(disp, glVertex4iv); + SET_Vertex4s(disp, glVertex4s); + SET_Vertex4sv(disp, glVertex4sv); + SET_ClipPlane(disp, glClipPlane); + SET_ColorMaterial(disp, glColorMaterial); + SET_CullFace(disp, glCullFace); + SET_Fogf(disp, glFogf); + SET_Fogfv(disp, glFogfv); + SET_Fogi(disp, glFogi); + SET_Fogiv(disp, glFogiv); + SET_FrontFace(disp, glFrontFace); + SET_Hint(disp, glHint); + SET_Lightf(disp, glLightf); + SET_Lightfv(disp, glLightfv); + SET_Lighti(disp, glLighti); + SET_Lightiv(disp, glLightiv); + SET_LightModelf(disp, glLightModelf); + SET_LightModelfv(disp, glLightModelfv); + SET_LightModeli(disp, glLightModeli); + SET_LightModeliv(disp, glLightModeliv); + SET_LineStipple(disp, glLineStipple); + SET_LineWidth(disp, glLineWidth); + SET_Materialf(disp, glMaterialf); + SET_Materialfv(disp, glMaterialfv); + SET_Materiali(disp, glMateriali); + SET_Materialiv(disp, glMaterialiv); + SET_PointSize(disp, glPointSize); + SET_PolygonMode(disp, glPolygonMode); + SET_PolygonStipple(disp, glPolygonStipple); + SET_Scissor(disp, glScissor); + SET_ShadeModel(disp, glShadeModel); + SET_TexParameterf(disp, glTexParameterf); + SET_TexParameterfv(disp, glTexParameterfv); + SET_TexParameteri(disp, glTexParameteri); + SET_TexParameteriv(disp, glTexParameteriv); + SET_TexImage1D(disp, glTexImage1D); + SET_TexImage2D(disp, glTexImage2D); + SET_TexEnvf(disp, glTexEnvf); + SET_TexEnvfv(disp, glTexEnvfv); + SET_TexEnvi(disp, glTexEnvi); + SET_TexEnviv(disp, glTexEnviv); + SET_TexGend(disp, glTexGend); + SET_TexGendv(disp, glTexGendv); + SET_TexGenf(disp, glTexGenf); + SET_TexGenfv(disp, glTexGenfv); + SET_TexGeni(disp, glTexGeni); + SET_TexGeniv(disp, glTexGeniv); + SET_FeedbackBuffer(disp, glFeedbackBuffer); + SET_SelectBuffer(disp, glSelectBuffer); + SET_RenderMode(disp, glRenderMode); + SET_InitNames(disp, glInitNames); + SET_LoadName(disp, glLoadName); + SET_PassThrough(disp, glPassThrough); + SET_PopName(disp, glPopName); + SET_PushName(disp, glPushName); + SET_DrawBuffer(disp, glDrawBuffer); + SET_Clear(disp, glClear); + SET_ClearAccum(disp, glClearAccum); + SET_ClearIndex(disp, glClearIndex); + SET_ClearColor(disp, glClearColor); + SET_ClearStencil(disp, glClearStencil); + SET_ClearDepth(disp, glClearDepth); + SET_StencilMask(disp, glStencilMask); + SET_ColorMask(disp, glColorMask); + SET_DepthMask(disp, glDepthMask); + SET_IndexMask(disp, glIndexMask); + SET_Accum(disp, glAccum); + SET_Disable(disp, glDisable); + SET_Enable(disp, glEnable); + SET_Finish(disp, glFinish); + SET_Flush(disp, glFlush); + SET_PopAttrib(disp, glPopAttrib); + SET_PushAttrib(disp, glPushAttrib); + SET_Map1d(disp, glMap1d); + SET_Map1f(disp, glMap1f); + SET_Map2d(disp, glMap2d); + SET_Map2f(disp, glMap2f); + SET_MapGrid1d(disp, glMapGrid1d); + SET_MapGrid1f(disp, glMapGrid1f); + SET_MapGrid2d(disp, glMapGrid2d); + SET_MapGrid2f(disp, glMapGrid2f); + SET_EvalCoord1d(disp, glEvalCoord1d); + SET_EvalCoord1dv(disp, glEvalCoord1dv); + SET_EvalCoord1f(disp, glEvalCoord1f); + SET_EvalCoord1fv(disp, glEvalCoord1fv); + SET_EvalCoord2d(disp, glEvalCoord2d); + SET_EvalCoord2dv(disp, glEvalCoord2dv); + SET_EvalCoord2f(disp, glEvalCoord2f); + SET_EvalCoord2fv(disp, glEvalCoord2fv); + SET_EvalMesh1(disp, glEvalMesh1); + SET_EvalPoint1(disp, glEvalPoint1); + SET_EvalMesh2(disp, glEvalMesh2); + SET_EvalPoint2(disp, glEvalPoint2); + SET_AlphaFunc(disp, glAlphaFunc); + SET_BlendFunc(disp, glBlendFunc); + SET_LogicOp(disp, glLogicOp); + SET_StencilFunc(disp, glStencilFunc); + SET_StencilOp(disp, glStencilOp); + SET_DepthFunc(disp, glDepthFunc); + SET_PixelZoom(disp, glPixelZoom); + SET_PixelTransferf(disp, glPixelTransferf); + SET_PixelTransferi(disp, glPixelTransferi); + SET_PixelStoref(disp, glPixelStoref); + SET_PixelStorei(disp, glPixelStorei); + SET_PixelMapfv(disp, glPixelMapfv); + SET_PixelMapuiv(disp, glPixelMapuiv); + SET_PixelMapusv(disp, glPixelMapusv); + SET_ReadBuffer(disp, glReadBuffer); + SET_CopyPixels(disp, glCopyPixels); + SET_ReadPixels(disp, glReadPixels); + SET_DrawPixels(disp, glDrawPixels); + SET_GetBooleanv(disp, glGetBooleanv); + SET_GetClipPlane(disp, glGetClipPlane); + SET_GetDoublev(disp, glGetDoublev); + SET_GetError(disp, glGetError); + SET_GetFloatv(disp, glGetFloatv); + SET_GetIntegerv(disp, glGetIntegerv); + SET_GetLightfv(disp, glGetLightfv); + SET_GetLightiv(disp, glGetLightiv); + SET_GetMapdv(disp, glGetMapdv); + SET_GetMapfv(disp, glGetMapfv); + SET_GetMapiv(disp, glGetMapiv); + SET_GetMaterialfv(disp, glGetMaterialfv); + SET_GetMaterialiv(disp, glGetMaterialiv); + SET_GetPixelMapfv(disp, glGetPixelMapfv); + SET_GetPixelMapuiv(disp, glGetPixelMapuiv); + SET_GetPixelMapusv(disp, glGetPixelMapusv); + SET_GetPolygonStipple(disp, glGetPolygonStipple); + SET_GetString(disp, glGetString); + SET_GetTexEnvfv(disp, glGetTexEnvfv); + SET_GetTexEnviv(disp, glGetTexEnviv); + SET_GetTexGendv(disp, glGetTexGendv); + SET_GetTexGenfv(disp, glGetTexGenfv); + SET_GetTexGeniv(disp, glGetTexGeniv); + SET_GetTexImage(disp, glGetTexImage); + SET_GetTexParameterfv(disp, glGetTexParameterfv); + SET_GetTexParameteriv(disp, glGetTexParameteriv); + SET_GetTexLevelParameterfv(disp, glGetTexLevelParameterfv); + SET_GetTexLevelParameteriv(disp, glGetTexLevelParameteriv); + SET_IsEnabled(disp, glIsEnabled); + SET_IsList(disp, glIsList); + SET_DepthRange(disp, glDepthRange); + SET_Frustum(disp, glFrustum); + SET_LoadIdentity(disp, glLoadIdentity); + SET_LoadMatrixf(disp, glLoadMatrixf); + SET_LoadMatrixd(disp, glLoadMatrixd); + SET_MatrixMode(disp, glMatrixMode); + SET_MultMatrixf(disp, glMultMatrixf); + SET_MultMatrixd(disp, glMultMatrixd); + SET_Ortho(disp, glOrtho); + SET_PopMatrix(disp, glPopMatrix); + SET_PushMatrix(disp, glPushMatrix); + SET_Rotated(disp, glRotated); + SET_Rotatef(disp, glRotatef); + SET_Scaled(disp, glScaled); + SET_Scalef(disp, glScalef); + SET_Translated(disp, glTranslated); + SET_Translatef(disp, glTranslatef); + SET_Viewport(disp, glViewport); + SET_ArrayElement(disp, glArrayElement); + SET_BindTexture(disp, glBindTexture); + SET_ColorPointer(disp, glColorPointer); + SET_DisableClientState(disp, glDisableClientState); + SET_DrawArrays(disp, glDrawArrays); + SET_DrawElements(disp, glDrawElements); + SET_EdgeFlagPointer(disp, glEdgeFlagPointer); + SET_EnableClientState(disp, glEnableClientState); + SET_IndexPointer(disp, glIndexPointer); + SET_Indexub(disp, glIndexub); + SET_Indexubv(disp, glIndexubv); + SET_InterleavedArrays(disp, glInterleavedArrays); + SET_NormalPointer(disp, glNormalPointer); + SET_PolygonOffset(disp, glPolygonOffset); + SET_TexCoordPointer(disp, glTexCoordPointer); + SET_VertexPointer(disp, glVertexPointer); + SET_AreTexturesResident(disp, glAreTexturesResident); + SET_CopyTexImage1D(disp, glCopyTexImage1D); + SET_CopyTexImage2D(disp, glCopyTexImage2D); + SET_CopyTexSubImage1D(disp, glCopyTexSubImage1D); + SET_CopyTexSubImage2D(disp, glCopyTexSubImage2D); + SET_DeleteTextures(disp, glDeleteTextures); + SET_GenTextures(disp, glGenTextures); + SET_GetPointerv(disp, glGetPointerv); + SET_IsTexture(disp, glIsTexture); + SET_PrioritizeTextures(disp, glPrioritizeTextures); + SET_TexSubImage1D(disp, glTexSubImage1D); + SET_TexSubImage2D(disp, glTexSubImage2D); + SET_PopClientAttrib(disp, glPopClientAttrib); + SET_PushClientAttrib(disp, glPushClientAttrib); + SET_BlendColor(disp, glBlendColor); + SET_BlendEquation(disp, glBlendEquation); + SET_DrawRangeElements(disp, glDrawRangeElements); + SET_ColorTable(disp, glColorTable); + SET_ColorTableParameterfv(disp, glColorTableParameterfv); + SET_ColorTableParameteriv(disp, glColorTableParameteriv); + SET_CopyColorTable(disp, glCopyColorTable); + SET_GetColorTable(disp, glGetColorTable); + SET_GetColorTableParameterfv(disp, glGetColorTableParameterfv); + SET_GetColorTableParameteriv(disp, glGetColorTableParameteriv); + SET_ColorSubTable(disp, glColorSubTable); + SET_CopyColorSubTable(disp, glCopyColorSubTable); + SET_ConvolutionFilter1D(disp, glConvolutionFilter1D); + SET_ConvolutionFilter2D(disp, glConvolutionFilter2D); + SET_ConvolutionParameterf(disp, glConvolutionParameterf); + SET_ConvolutionParameterfv(disp, glConvolutionParameterfv); + SET_ConvolutionParameteri(disp, glConvolutionParameteri); + SET_ConvolutionParameteriv(disp, glConvolutionParameteriv); + SET_CopyConvolutionFilter1D(disp, glCopyConvolutionFilter1D); + SET_CopyConvolutionFilter2D(disp, glCopyConvolutionFilter2D); + SET_GetConvolutionFilter(disp, glGetConvolutionFilter); + SET_GetConvolutionParameterfv(disp, glGetConvolutionParameterfv); + SET_GetConvolutionParameteriv(disp, glGetConvolutionParameteriv); + SET_GetSeparableFilter(disp, glGetSeparableFilter); + SET_SeparableFilter2D(disp, glSeparableFilter2D); + SET_GetHistogram(disp, glGetHistogram); + SET_GetHistogramParameterfv(disp, glGetHistogramParameterfv); + SET_GetHistogramParameteriv(disp, glGetHistogramParameteriv); + SET_GetMinmax(disp, glGetMinmax); + SET_GetMinmaxParameterfv(disp, glGetMinmaxParameterfv); + SET_GetMinmaxParameteriv(disp, glGetMinmaxParameteriv); + SET_Histogram(disp, glHistogram); + SET_Minmax(disp, glMinmax); + SET_ResetHistogram(disp, glResetHistogram); + SET_ResetMinmax(disp, glResetMinmax); + SET_TexImage3D(disp, glTexImage3D); + SET_TexSubImage3D(disp, glTexSubImage3D); + SET_CopyTexSubImage3D(disp, glCopyTexSubImage3D); + SET_ActiveTextureARB(disp, glActiveTextureARB); + SET_ClientActiveTextureARB(disp, glClientActiveTextureARB); + SET_MultiTexCoord1dARB(disp, glMultiTexCoord1dARB); + SET_MultiTexCoord1dvARB(disp, glMultiTexCoord1dvARB); + SET_MultiTexCoord1fARB(disp, glMultiTexCoord1fARB); + SET_MultiTexCoord1fvARB(disp, glMultiTexCoord1fvARB); + SET_MultiTexCoord1iARB(disp, glMultiTexCoord1iARB); + SET_MultiTexCoord1ivARB(disp, glMultiTexCoord1ivARB); + SET_MultiTexCoord1sARB(disp, glMultiTexCoord1sARB); + SET_MultiTexCoord1svARB(disp, glMultiTexCoord1svARB); + SET_MultiTexCoord2dARB(disp, glMultiTexCoord2dARB); + SET_MultiTexCoord2dvARB(disp, glMultiTexCoord2dvARB); + SET_MultiTexCoord2fARB(disp, glMultiTexCoord2fARB); + SET_MultiTexCoord2fvARB(disp, glMultiTexCoord2fvARB); + SET_MultiTexCoord2iARB(disp, glMultiTexCoord2iARB); + SET_MultiTexCoord2ivARB(disp, glMultiTexCoord2ivARB); + SET_MultiTexCoord2sARB(disp, glMultiTexCoord2sARB); + SET_MultiTexCoord2svARB(disp, glMultiTexCoord2svARB); + SET_MultiTexCoord3dARB(disp, glMultiTexCoord3dARB); + SET_MultiTexCoord3dvARB(disp, glMultiTexCoord3dvARB); + SET_MultiTexCoord3fARB(disp, glMultiTexCoord3fARB); + SET_MultiTexCoord3fvARB(disp, glMultiTexCoord3fvARB); + SET_MultiTexCoord3iARB(disp, glMultiTexCoord3iARB); + SET_MultiTexCoord3ivARB(disp, glMultiTexCoord3ivARB); + SET_MultiTexCoord3sARB(disp, glMultiTexCoord3sARB); + SET_MultiTexCoord3svARB(disp, glMultiTexCoord3svARB); + SET_MultiTexCoord4dARB(disp, glMultiTexCoord4dARB); + SET_MultiTexCoord4dvARB(disp, glMultiTexCoord4dvARB); + SET_MultiTexCoord4fARB(disp, glMultiTexCoord4fARB); + SET_MultiTexCoord4fvARB(disp, glMultiTexCoord4fvARB); + SET_MultiTexCoord4iARB(disp, glMultiTexCoord4iARB); + SET_MultiTexCoord4ivARB(disp, glMultiTexCoord4ivARB); + SET_MultiTexCoord4sARB(disp, glMultiTexCoord4sARB); + SET_MultiTexCoord4svARB(disp, glMultiTexCoord4svARB); + SET_LoadTransposeMatrixfARB(disp, glLoadTransposeMatrixfARB); + SET_LoadTransposeMatrixdARB(disp, glLoadTransposeMatrixdARB); + SET_MultTransposeMatrixfARB(disp, glMultTransposeMatrixfARB); + SET_MultTransposeMatrixdARB(disp, glMultTransposeMatrixdARB); + SET_SampleCoverageARB(disp, glSampleCoverageARB); + SET_DrawBuffersARB(disp, glDrawBuffersARB); +/* SET_PolygonOffsetEXT(disp, glPolygonOffsetEXT); + SET_GetTexFilterFuncSGIS(disp, glGetTexFilterFuncSGIS); + SET_TexFilterFuncSGIS(disp, glTexFilterFuncSGIS); + SET_GetHistogramEXT(disp, glGetHistogramEXT); + SET_GetHistogramParameterfvEXT(disp, glGetHistogramParameterfvEXT); + SET_GetHistogramParameterivEXT(disp, glGetHistogramParameterivEXT); + SET_GetMinmaxEXT(disp, glGetMinmaxEXT); + SET_GetMinmaxParameterfvEXT(disp, glGetMinmaxParameterfvEXT); + SET_GetMinmaxParameterivEXT(disp, glGetMinmaxParameterivEXT); + SET_GetConvolutionFilterEXT(disp, glGetConvolutionFilterEXT); + SET_GetConvolutionParameterfvEXT(disp, glGetConvolutionParameterfvEXT); + SET_GetConvolutionParameterivEXT(disp, glGetConvolutionParameterivEXT); + SET_GetSeparableFilterEXT(disp, glGetSeparableFilterEXT); + SET_GetColorTableSGI(disp, glGetColorTableSGI); + SET_GetColorTableParameterfvSGI(disp, glGetColorTableParameterfvSGI); + SET_GetColorTableParameterivSGI(disp, glGetColorTableParameterivSGI); + SET_PixelTexGenSGIX(disp, glPixelTexGenSGIX); + SET_PixelTexGenParameteriSGIS(disp, glPixelTexGenParameteriSGIS); + SET_PixelTexGenParameterivSGIS(disp, glPixelTexGenParameterivSGIS); + SET_PixelTexGenParameterfSGIS(disp, glPixelTexGenParameterfSGIS); + SET_PixelTexGenParameterfvSGIS(disp, glPixelTexGenParameterfvSGIS); + SET_GetPixelTexGenParameterivSGIS(disp, glGetPixelTexGenParameterivSGIS); + SET_GetPixelTexGenParameterfvSGIS(disp, glGetPixelTexGenParameterfvSGIS); + SET_TexImage4DSGIS(disp, glTexImage4DSGIS); + SET_TexSubImage4DSGIS(disp, glTexSubImage4DSGIS); */ + SET_AreTexturesResidentEXT(disp, glAreTexturesResident); + SET_GenTexturesEXT(disp, glGenTextures); + SET_IsTextureEXT(disp, glIsTexture); +/* SET_DetailTexFuncSGIS(disp, glDetailTexFuncSGIS); + SET_GetDetailTexFuncSGIS(disp, glGetDetailTexFuncSGIS); + SET_SharpenTexFuncSGIS(disp, glSharpenTexFuncSGIS); + SET_GetSharpenTexFuncSGIS(disp, glGetSharpenTexFuncSGIS); + SET_SampleMaskSGIS(disp, glSampleMaskSGIS); + SET_SamplePatternSGIS(disp, glSamplePatternSGIS); + SET_ColorPointerEXT(disp, glColorPointerEXT); + SET_EdgeFlagPointerEXT(disp, glEdgeFlagPointerEXT); + SET_IndexPointerEXT(disp, glIndexPointerEXT); + SET_NormalPointerEXT(disp, glNormalPointerEXT); + SET_TexCoordPointerEXT(disp, glTexCoordPointerEXT); + SET_VertexPointerEXT(disp, glVertexPointerEXT); + SET_SpriteParameterfSGIX(disp, glSpriteParameterfSGIX); + SET_SpriteParameterfvSGIX(disp, glSpriteParameterfvSGIX); + SET_SpriteParameteriSGIX(disp, glSpriteParameteriSGIX); + SET_SpriteParameterivSGIX(disp, glSpriteParameterivSGIX); + SET_PointParameterfEXT(disp, glPointParameterfEXT); + SET_PointParameterfvEXT(disp, glPointParameterfvEXT); + SET_GetInstrumentsSGIX(disp, glGetInstrumentsSGIX); + SET_InstrumentsBufferSGIX(disp, glInstrumentsBufferSGIX); + SET_PollInstrumentsSGIX(disp, glPollInstrumentsSGIX); + SET_ReadInstrumentsSGIX(disp, glReadInstrumentsSGIX); + SET_StartInstrumentsSGIX(disp, glStartInstrumentsSGIX); + SET_StopInstrumentsSGIX(disp, glStopInstrumentsSGIX); + SET_FrameZoomSGIX(disp, glFrameZoomSGIX); + SET_TagSampleBufferSGIX(disp, glTagSampleBufferSGIX); + SET_ReferencePlaneSGIX(disp, glReferencePlaneSGIX); + SET_FlushRasterSGIX(disp, glFlushRasterSGIX); + SET_GetListParameterfvSGIX(disp, glGetListParameterfvSGIX); + SET_GetListParameterivSGIX(disp, glGetListParameterivSGIX); + SET_ListParameterfSGIX(disp, glListParameterfSGIX); + SET_ListParameterfvSGIX(disp, glListParameterfvSGIX); + SET_ListParameteriSGIX(disp, glListParameteriSGIX); + SET_ListParameterivSGIX(disp, glListParameterivSGIX); + SET_FragmentColorMaterialSGIX(disp, glFragmentColorMaterialSGIX); + SET_FragmentLightfSGIX(disp, glFragmentLightfSGIX); + SET_FragmentLightfvSGIX(disp, glFragmentLightfvSGIX); + SET_FragmentLightiSGIX(disp, glFragmentLightiSGIX); + SET_FragmentLightivSGIX(disp, glFragmentLightivSGIX); + SET_FragmentLightModelfSGIX(disp, glFragmentLightModelfSGIX); + SET_FragmentLightModelfvSGIX(disp, glFragmentLightModelfvSGIX); + SET_FragmentLightModeliSGIX(disp, glFragmentLightModeliSGIX); + SET_FragmentLightModelivSGIX(disp, glFragmentLightModelivSGIX); + SET_FragmentMaterialfSGIX(disp, glFragmentMaterialfSGIX); + SET_FragmentMaterialfvSGIX(disp, glFragmentMaterialfvSGIX); + SET_FragmentMaterialiSGIX(disp, glFragmentMaterialiSGIX); + SET_FragmentMaterialivSGIX(disp, glFragmentMaterialivSGIX); + SET_GetFragmentLightfvSGIX(disp, glGetFragmentLightfvSGIX); + SET_GetFragmentLightivSGIX(disp, glGetFragmentLightivSGIX); + SET_GetFragmentMaterialfvSGIX(disp, glGetFragmentMaterialfvSGIX); + SET_GetFragmentMaterialivSGIX(disp, glGetFragmentMaterialivSGIX); + SET_LightEnviSGIX(disp, glLightEnviSGIX); + SET_VertexWeightfEXT(disp, glVertexWeightfEXT); + SET_VertexWeightfvEXT(disp, glVertexWeightfvEXT); + SET_VertexWeightPointerEXT(disp, glVertexWeightPointerEXT); + SET_FlushVertexArrayRangeNV(disp, glFlushVertexArrayRangeNV); + SET_VertexArrayRangeNV(disp, glVertexArrayRangeNV); + SET_CombinerParameterfvNV(disp, glCombinerParameterfvNV); + SET_CombinerParameterfNV(disp, glCombinerParameterfNV); + SET_CombinerParameterivNV(disp, glCombinerParameterivNV); + SET_CombinerParameteriNV(disp, glCombinerParameteriNV); + SET_CombinerInputNV(disp, glCombinerInputNV); + SET_CombinerOutputNV(disp, glCombinerOutputNV); + SET_FinalCombinerInputNV(disp, glFinalCombinerInputNV); + SET_GetCombinerInputParameterfvNV(disp, glGetCombinerInputParameterfvNV); + SET_GetCombinerInputParameterivNV(disp, glGetCombinerInputParameterivNV); + SET_GetCombinerOutputParameterfvNV(disp, glGetCombinerOutputParameterfvNV); + SET_GetCombinerOutputParameterivNV(disp, glGetCombinerOutputParameterivNV); + SET_GetFinalCombinerInputParameterfvNV(disp, glGetFinalCombinerInputParameterfvNV); + SET_GetFinalCombinerInputParameterivNV(disp, glGetFinalCombinerInputParameterivNV); + SET_ResizeBuffersMESA(disp, glResizeBuffersMESA); + SET_WindowPos2dMESA(disp, glWindowPos2dMESA); + SET_WindowPos2dvMESA(disp, glWindowPos2dvMESA); + SET_WindowPos2fMESA(disp, glWindowPos2fMESA); + SET_WindowPos2fvMESA(disp, glWindowPos2fvMESA); + SET_WindowPos2iMESA(disp, glWindowPos2iMESA); + SET_WindowPos2ivMESA(disp, glWindowPos2ivMESA); + SET_WindowPos2sMESA(disp, glWindowPos2sMESA); + SET_WindowPos2svMESA(disp, glWindowPos2svMESA); + SET_WindowPos3dMESA(disp, glWindowPos3dMESA); + SET_WindowPos3dvMESA(disp, glWindowPos3dvMESA); + SET_WindowPos3fMESA(disp, glWindowPos3fMESA); + SET_WindowPos3fvMESA(disp, glWindowPos3fvMESA); + SET_WindowPos3iMESA(disp, glWindowPos3iMESA); + SET_WindowPos3ivMESA(disp, glWindowPos3ivMESA); + SET_WindowPos3sMESA(disp, glWindowPos3sMESA); + SET_WindowPos3svMESA(disp, glWindowPos3svMESA); + SET_WindowPos4dMESA(disp, glWindowPos4dMESA); + SET_WindowPos4dvMESA(disp, glWindowPos4dvMESA); + SET_WindowPos4fMESA(disp, glWindowPos4fMESA); + SET_WindowPos4fvMESA(disp, glWindowPos4fvMESA); + SET_WindowPos4iMESA(disp, glWindowPos4iMESA); + SET_WindowPos4ivMESA(disp, glWindowPos4ivMESA); + SET_WindowPos4sMESA(disp, glWindowPos4sMESA); + SET_WindowPos4svMESA(disp, glWindowPos4svMESA); + SET_BlendFuncSeparateEXT(disp, glBlendFuncSeparateEXT); + SET_IndexMaterialEXT(disp, glIndexMaterialEXT); + SET_IndexFuncEXT(disp, glIndexFuncEXT); + SET_LockArraysEXT(disp, glLockArraysEXT); + SET_UnlockArraysEXT(disp, glUnlockArraysEXT); + SET_CullParameterdvEXT(disp, glCullParameterdvEXT); + SET_CullParameterfvEXT(disp, glCullParameterfvEXT); + SET_HintPGI(disp, glHintPGI); + SET_FogCoordfEXT(disp, glFogCoordfEXT); + SET_FogCoordfvEXT(disp, glFogCoordfvEXT); + SET_FogCoorddEXT(disp, glFogCoorddEXT); + SET_FogCoorddvEXT(disp, glFogCoorddvEXT); + SET_FogCoordPointerEXT(disp, glFogCoordPointerEXT); + SET_GetColorTableEXT(disp, glGetColorTableEXT); + SET_GetColorTableParameterivEXT(disp, glGetColorTableParameterivEXT); + SET_GetColorTableParameterfvEXT(disp, glGetColorTableParameterfvEXT); + SET_TbufferMask3DFX(disp, glTbufferMask3DFX); + SET_CompressedTexImage3DARB(disp, glCompressedTexImage3DARB); + SET_CompressedTexImage2DARB(disp, glCompressedTexImage2DARB); + SET_CompressedTexImage1DARB(disp, glCompressedTexImage1DARB); + SET_CompressedTexSubImage3DARB(disp, glCompressedTexSubImage3DARB); + SET_CompressedTexSubImage2DARB(disp, glCompressedTexSubImage2DARB); + SET_CompressedTexSubImage1DARB(disp, glCompressedTexSubImage1DARB); + SET_GetCompressedTexImageARB(disp, glGetCompressedTexImageARB); + SET_SecondaryColor3bEXT(disp, glSecondaryColor3bEXT); + SET_SecondaryColor3bvEXT(disp, glSecondaryColor3bvEXT); + SET_SecondaryColor3dEXT(disp, glSecondaryColor3dEXT); + SET_SecondaryColor3dvEXT(disp, glSecondaryColor3dvEXT); + SET_SecondaryColor3fEXT(disp, glSecondaryColor3fEXT); + SET_SecondaryColor3fvEXT(disp, glSecondaryColor3fvEXT); + SET_SecondaryColor3iEXT(disp, glSecondaryColor3iEXT); + SET_SecondaryColor3ivEXT(disp, glSecondaryColor3ivEXT); + SET_SecondaryColor3sEXT(disp, glSecondaryColor3sEXT); + SET_SecondaryColor3svEXT(disp, glSecondaryColor3svEXT); + SET_SecondaryColor3ubEXT(disp, glSecondaryColor3ubEXT); + SET_SecondaryColor3ubvEXT(disp, glSecondaryColor3ubvEXT); + SET_SecondaryColor3uiEXT(disp, glSecondaryColor3uiEXT); + SET_SecondaryColor3uivEXT(disp, glSecondaryColor3uivEXT); + SET_SecondaryColor3usEXT(disp, glSecondaryColor3usEXT); + SET_SecondaryColor3usvEXT(disp, glSecondaryColor3usvEXT); + SET_SecondaryColorPointerEXT(disp, glSecondaryColorPointerEXT); + SET_AreProgramsResidentNV(disp, glAreProgramsResidentNV); + SET_BindProgramNV(disp, glBindProgramNV); + SET_DeleteProgramsNV(disp, glDeleteProgramsNV); + SET_ExecuteProgramNV(disp, glExecuteProgramNV); + SET_GenProgramsNV(disp, glGenProgramsNV); + SET_GetProgramParameterdvNV(disp, glGetProgramParameterdvNV); + SET_GetProgramParameterfvNV(disp, glGetProgramParameterfvNV); + SET_GetProgramivNV(disp, glGetProgramivNV); + SET_GetProgramStringNV(disp, glGetProgramStringNV); + SET_GetTrackMatrixivNV(disp, glGetTrackMatrixivNV); + SET_GetVertexAttribdvARB(disp, glGetVertexAttribdvARB); + SET_GetVertexAttribfvARB(disp, glGetVertexAttribfvARB); + SET_GetVertexAttribivARB(disp, glGetVertexAttribivARB); + SET_GetVertexAttribPointervNV(disp, glGetVertexAttribPointervNV); + SET_IsProgramNV(disp, glIsProgramNV); + SET_LoadProgramNV(disp, glLoadProgramNV); + SET_ProgramParameter4dNV(disp, glProgramParameter4dNV); + SET_ProgramParameter4dvNV(disp, glProgramParameter4dvNV); + SET_ProgramParameter4fNV(disp, glProgramParameter4fNV); + SET_ProgramParameter4fvNV(disp, glProgramParameter4fvNV); + SET_ProgramParameters4dvNV(disp, glProgramParameters4dvNV); + SET_ProgramParameters4fvNV(disp, glProgramParameters4fvNV); + SET_RequestResidentProgramsNV(disp, glRequestResidentProgramsNV); + SET_TrackMatrixNV(disp, glTrackMatrixNV); + SET_VertexAttribPointerNV(disp, glVertexAttribPointerNV); + SET_VertexAttrib1dARB(disp, glVertexAttrib1dARB); + SET_VertexAttrib1dvARB(disp, glVertexAttrib1dvARB); + SET_VertexAttrib1fARB(disp, glVertexAttrib1fARB); + SET_VertexAttrib1fvARB(disp, glVertexAttrib1fvARB); + SET_VertexAttrib1sARB(disp, glVertexAttrib1sARB); + SET_VertexAttrib1svARB(disp, glVertexAttrib1svARB); + SET_VertexAttrib2dARB(disp, glVertexAttrib2dARB); + SET_VertexAttrib2dvARB(disp, glVertexAttrib2dvARB); + SET_VertexAttrib2fARB(disp, glVertexAttrib2fARB); + SET_VertexAttrib2fvARB(disp, glVertexAttrib2fvARB); + SET_VertexAttrib2sARB(disp, glVertexAttrib2sARB); + SET_VertexAttrib2svARB(disp, glVertexAttrib2svARB); + SET_VertexAttrib3dARB(disp, glVertexAttrib3dARB); + SET_VertexAttrib3dvARB(disp, glVertexAttrib3dvARB); + SET_VertexAttrib3fARB(disp, glVertexAttrib3fARB); + SET_VertexAttrib3fvARB(disp, glVertexAttrib3fvARB); + SET_VertexAttrib3sARB(disp, glVertexAttrib3sARB); + SET_VertexAttrib3svARB(disp, glVertexAttrib3svARB); + SET_VertexAttrib4dARB(disp, glVertexAttrib4dARB); + SET_VertexAttrib4dvARB(disp, glVertexAttrib4dvARB); + SET_VertexAttrib4fARB(disp, glVertexAttrib4fARB); + SET_VertexAttrib4fvARB(disp, glVertexAttrib4fvARB); + SET_VertexAttrib4sARB(disp, glVertexAttrib4sARB); + SET_VertexAttrib4svARB(disp, glVertexAttrib4svARB); + SET_VertexAttrib4NubARB(disp, glVertexAttrib4NubARB); + SET_VertexAttrib4NubvARB(disp, glVertexAttrib4NubvARB); + SET_VertexAttribs1dvNV(disp, glVertexAttribs1dvNV); + SET_VertexAttribs1fvNV(disp, glVertexAttribs1fvNV); + SET_VertexAttribs1svNV(disp, glVertexAttribs1svNV); + SET_VertexAttribs2dvNV(disp, glVertexAttribs2dvNV); + SET_VertexAttribs2fvNV(disp, glVertexAttribs2fvNV); + SET_VertexAttribs2svNV(disp, glVertexAttribs2svNV); + SET_VertexAttribs3dvNV(disp, glVertexAttribs3dvNV); + SET_VertexAttribs3fvNV(disp, glVertexAttribs3fvNV); + SET_VertexAttribs3svNV(disp, glVertexAttribs3svNV); + SET_VertexAttribs4dvNV(disp, glVertexAttribs4dvNV); + SET_VertexAttribs4fvNV(disp, glVertexAttribs4fvNV); + SET_VertexAttribs4svNV(disp, glVertexAttribs4svNV); + SET_VertexAttribs4ubvNV(disp, glVertexAttribs4ubvNV); + SET_PointParameteriNV(disp, glPointParameteriNV); + SET_PointParameterivNV(disp, glPointParameterivNV); + SET_MultiDrawArraysEXT(disp, glMultiDrawArraysEXT); + SET_MultiDrawElementsEXT(disp, glMultiDrawElementsEXT); + SET_ActiveStencilFaceEXT(disp, glActiveStencilFaceEXT); + SET_DeleteFencesNV(disp, glDeleteFencesNV); + SET_GenFencesNV(disp, glGenFencesNV); + SET_IsFenceNV(disp, glIsFenceNV); + SET_TestFenceNV(disp, glTestFenceNV); + SET_GetFenceivNV(disp, glGetFenceivNV); + SET_FinishFenceNV(disp, glFinishFenceNV); + SET_SetFenceNV(disp, glSetFenceNV); + SET_VertexAttrib4bvARB(disp, glVertexAttrib4bvARB); + SET_VertexAttrib4ivARB(disp, glVertexAttrib4ivARB); + SET_VertexAttrib4ubvARB(disp, glVertexAttrib4ubvARB); + SET_VertexAttrib4usvARB(disp, glVertexAttrib4usvARB); + SET_VertexAttrib4uivARB(disp, glVertexAttrib4uivARB); + SET_VertexAttrib4NbvARB(disp, glVertexAttrib4NbvARB); + SET_VertexAttrib4NsvARB(disp, glVertexAttrib4NsvARB); + SET_VertexAttrib4NivARB(disp, glVertexAttrib4NivARB); + SET_VertexAttrib4NusvARB(disp, glVertexAttrib4NusvARB); + SET_VertexAttrib4NuivARB(disp, glVertexAttrib4NuivARB); + SET_VertexAttribPointerARB(disp, glVertexAttribPointerARB); + SET_EnableVertexAttribArrayARB(disp, glEnableVertexAttribArrayARB); + SET_DisableVertexAttribArrayARB(disp, glDisableVertexAttribArrayARB); + SET_ProgramStringARB(disp, glProgramStringARB); + SET_ProgramEnvParameter4dARB(disp, glProgramEnvParameter4dARB); + SET_ProgramEnvParameter4dvARB(disp, glProgramEnvParameter4dvARB); + SET_ProgramEnvParameter4fARB(disp, glProgramEnvParameter4fARB); + SET_ProgramEnvParameter4fvARB(disp, glProgramEnvParameter4fvARB); + SET_ProgramLocalParameter4dARB(disp, glProgramLocalParameter4dARB); + SET_ProgramLocalParameter4dvARB(disp, glProgramLocalParameter4dvARB); + SET_ProgramLocalParameter4fARB(disp, glProgramLocalParameter4fARB); + SET_ProgramLocalParameter4fvARB(disp, glProgramLocalParameter4fvARB); + SET_GetProgramEnvParameterdvARB(disp, glGetProgramEnvParameterdvARB); + SET_GetProgramEnvParameterfvARB(disp, glGetProgramEnvParameterfvARB); + SET_GetProgramLocalParameterdvARB(disp, glGetProgramLocalParameterdvARB); + SET_GetProgramLocalParameterfvARB(disp, glGetProgramLocalParameterfvARB); + SET_GetProgramivARB(disp, glGetProgramivARB); + SET_GetProgramStringARB(disp, glGetProgramStringARB); + SET_ProgramNamedParameter4fNV(disp, glProgramNamedParameter4fNV); + SET_ProgramNamedParameter4dNV(disp, glProgramNamedParameter4dNV); + SET_ProgramNamedParameter4fvNV(disp, glProgramNamedParameter4fvNV); + SET_ProgramNamedParameter4dvNV(disp, glProgramNamedParameter4dvNV); + SET_GetProgramNamedParameterfvNV(disp, glGetProgramNamedParameterfvNV); + SET_GetProgramNamedParameterdvNV(disp, glGetProgramNamedParameterdvNV); + SET_BindBufferARB(disp, glBindBufferARB); + SET_BufferDataARB(disp, glBufferDataARB); + SET_BufferSubDataARB(disp, glBufferSubDataARB); + SET_DeleteBuffersARB(disp, glDeleteBuffersARB); + SET_GenBuffersARB(disp, glGenBuffersARB); + SET_GetBufferParameterivARB(disp, glGetBufferParameterivARB); + SET_GetBufferPointervARB(disp, glGetBufferPointervARB); + SET_GetBufferSubDataARB(disp, glGetBufferSubDataARB); + SET_IsBufferARB(disp, glIsBufferARB); + SET_MapBufferARB(disp, glMapBufferARB); + SET_UnmapBufferARB(disp, glUnmapBufferARB); + SET_DepthBoundsEXT(disp, glDepthBoundsEXT); + SET_GenQueriesARB(disp, glGenQueriesARB); + SET_DeleteQueriesARB(disp, glDeleteQueriesARB); + SET_IsQueryARB(disp, glIsQueryARB); + SET_BeginQueryARB(disp, glBeginQueryARB); + SET_EndQueryARB(disp, glEndQueryARB); + SET_GetQueryivARB(disp, glGetQueryivARB); + SET_GetQueryObjectivARB(disp, glGetQueryObjectivARB); + SET_GetQueryObjectuivARB(disp, glGetQueryObjectuivARB); + SET_MultiModeDrawArraysIBM(disp, glMultiModeDrawArraysIBM); + SET_MultiModeDrawElementsIBM(disp, glMultiModeDrawElementsIBM); + SET_BlendEquationSeparateEXT(disp, glBlendEquationSeparateEXT); + SET_DeleteObjectARB(disp, glDeleteObjectARB); + SET_GetHandleARB(disp, glGetHandleARB); + SET_DetachObjectARB(disp, glDetachObjectARB); + SET_CreateShaderObjectARB(disp, glCreateShaderObjectARB); + SET_ShaderSourceARB(disp, glShaderSourceARB); + SET_CompileShaderARB(disp, glCompileShaderARB); + SET_CreateProgramObjectARB(disp, glCreateProgramObjectARB); + SET_AttachObjectARB(disp, glAttachObjectARB); + SET_LinkProgramARB(disp, glLinkProgramARB); + SET_UseProgramObjectARB(disp, glUseProgramObjectARB); + SET_ValidateProgramARB(disp, glValidateProgramARB); + SET_Uniform1fARB(disp, glUniform1fARB); + SET_Uniform2fARB(disp, glUniform2fARB); + SET_Uniform3fARB(disp, glUniform3fARB); + SET_Uniform4fARB(disp, glUniform4fARB); + SET_Uniform1iARB(disp, glUniform1iARB); + SET_Uniform2iARB(disp, glUniform2iARB); + SET_Uniform3iARB(disp, glUniform3iARB); + SET_Uniform4iARB(disp, glUniform4iARB); + SET_Uniform1fvARB(disp, glUniform1fvARB); + SET_Uniform2fvARB(disp, glUniform2fvARB); + SET_Uniform3fvARB(disp, glUniform3fvARB); + SET_Uniform4fvARB(disp, glUniform4fvARB); + SET_Uniform1ivARB(disp, glUniform1ivARB); + SET_Uniform2ivARB(disp, glUniform2ivARB); + SET_Uniform3ivARB(disp, glUniform3ivARB); + SET_Uniform4ivARB(disp, glUniform4ivARB); + SET_UniformMatrix2fvARB(disp, glUniformMatrix2fvARB); + SET_UniformMatrix3fvARB(disp, glUniformMatrix3fvARB); + SET_UniformMatrix4fvARB(disp, glUniformMatrix4fvARB); + SET_GetObjectParameterfvARB(disp, glGetObjectParameterfvARB); + SET_GetObjectParameterivARB(disp, glGetObjectParameterivARB); + SET_GetInfoLogARB(disp, glGetInfoLogARB); + SET_GetAttachedObjectsARB(disp, glGetAttachedObjectsARB); + SET_GetUniformLocationARB(disp, glGetUniformLocationARB); + SET_GetActiveUniformARB(disp, glGetActiveUniformARB); + SET_GetUniformfvARB(disp, glGetUniformfvARB); + SET_GetUniformivARB(disp, glGetUniformivARB); + SET_GetShaderSourceARB(disp, glGetShaderSourceARB); + SET_BindAttribLocationARB(disp, glBindAttribLocationARB); + SET_GetActiveAttribARB(disp, glGetActiveAttribARB); + SET_GetAttribLocationARB(disp, glGetAttribLocationARB); + SET_GetVertexAttribdvNV(disp, glGetVertexAttribdvNV); + SET_GetVertexAttribfvNV(disp, glGetVertexAttribfvNV); + SET_GetVertexAttribivNV(disp, glGetVertexAttribivNV); + SET_VertexAttrib1dNV(disp, glVertexAttrib1dNV); + SET_VertexAttrib1dvNV(disp, glVertexAttrib1dvNV); + SET_VertexAttrib1fNV(disp, glVertexAttrib1fNV); + SET_VertexAttrib1fvNV(disp, glVertexAttrib1fvNV); + SET_VertexAttrib1sNV(disp, glVertexAttrib1sNV); + SET_VertexAttrib1svNV(disp, glVertexAttrib1svNV); + SET_VertexAttrib2dNV(disp, glVertexAttrib2dNV); + SET_VertexAttrib2dvNV(disp, glVertexAttrib2dvNV); + SET_VertexAttrib2fNV(disp, glVertexAttrib2fNV); + SET_VertexAttrib2fvNV(disp, glVertexAttrib2fvNV); + SET_VertexAttrib2sNV(disp, glVertexAttrib2sNV); + SET_VertexAttrib2svNV(disp, glVertexAttrib2svNV); + SET_VertexAttrib3dNV(disp, glVertexAttrib3dNV); + SET_VertexAttrib3dvNV(disp, glVertexAttrib3dvNV); + SET_VertexAttrib3fNV(disp, glVertexAttrib3fNV); + SET_VertexAttrib3fvNV(disp, glVertexAttrib3fvNV); + SET_VertexAttrib3sNV(disp, glVertexAttrib3sNV); + SET_VertexAttrib3svNV(disp, glVertexAttrib3svNV); + SET_VertexAttrib4dNV(disp, glVertexAttrib4dNV); + SET_VertexAttrib4dvNV(disp, glVertexAttrib4dvNV); + SET_VertexAttrib4fNV(disp, glVertexAttrib4fNV); + SET_VertexAttrib4fvNV(disp, glVertexAttrib4fvNV); + SET_VertexAttrib4sNV(disp, glVertexAttrib4sNV); + SET_VertexAttrib4svNV(disp, glVertexAttrib4svNV); + SET_VertexAttrib4ubNV(disp, glVertexAttrib4ubNV); + SET_VertexAttrib4ubvNV(disp, glVertexAttrib4ubvNV); + SET_GenFragmentShadersATI(disp, glGenFragmentShadersATI); + SET_BindFragmentShaderATI(disp, glBindFragmentShaderATI); + SET_DeleteFragmentShaderATI(disp, glDeleteFragmentShaderATI); + SET_BeginFragmentShaderATI(disp, glBeginFragmentShaderATI); + SET_EndFragmentShaderATI(disp, glEndFragmentShaderATI); + SET_PassTexCoordATI(disp, glPassTexCoordATI); + SET_SampleMapATI(disp, glSampleMapATI); + SET_ColorFragmentOp1ATI(disp, glColorFragmentOp1ATI); + SET_ColorFragmentOp2ATI(disp, glColorFragmentOp2ATI); + SET_ColorFragmentOp3ATI(disp, glColorFragmentOp3ATI); + SET_AlphaFragmentOp1ATI(disp, glAlphaFragmentOp1ATI); + SET_AlphaFragmentOp2ATI(disp, glAlphaFragmentOp2ATI); + SET_AlphaFragmentOp3ATI(disp, glAlphaFragmentOp3ATI); + SET_SetFragmentShaderConstantATI(disp, glSetFragmentShaderConstantATI); + SET_IsRenderbufferEXT(disp, glIsRenderbufferEXT); + SET_BindRenderbufferEXT(disp, glBindRenderbufferEXT); + SET_DeleteRenderbuffersEXT(disp, glDeleteRenderbuffersEXT); + SET_GenRenderbuffersEXT(disp, glGenRenderbuffersEXT); + SET_RenderbufferStorageEXT(disp, glRenderbufferStorageEXT); + SET_GetRenderbufferParameterivEXT(disp, glGetRenderbufferParameterivEXT); + SET_IsFramebufferEXT(disp, glIsFramebufferEXT); + SET_BindFramebufferEXT(disp, glBindFramebufferEXT); + SET_DeleteFramebuffersEXT(disp, glDeleteFramebuffersEXT); + SET_GenFramebuffersEXT(disp, glGenFramebuffersEXT); + SET_CheckFramebufferStatusEXT(disp, glCheckFramebufferStatusEXT); + SET_FramebufferTexture1DEXT(disp, glFramebufferTexture1DEXT); + SET_FramebufferTexture2DEXT(disp, glFramebufferTexture2DEXT); + SET_FramebufferTexture3DEXT(disp, glFramebufferTexture3DEXT); + SET_FramebufferRenderbufferEXT(disp, glFramebufferRenderbufferEXT); + SET_GetFramebufferAttachmentParameterivEXT(disp, glGetFramebufferAttachmentParameterivEXT); + SET_GenerateMipmapEXT(disp, glGenerateMipmapEXT); + SET_StencilFuncSeparate(disp, glStencilFuncSeparate); + SET_StencilOpSeparate(disp, glStencilOpSeparate); + SET_StencilMaskSeparate(disp, glStencilMaskSeparate); + SET_GetQueryObjecti64vEXT(disp, glGetQueryObjecti64vEXT); + SET_GetQueryObjectui64vEXT(disp, glGetQueryObjectui64vEXT); + SET_BlitFramebufferEXT(disp, glBlitFramebufferEXT); + SET_LoadTransposeMatrixfARB(disp, glLoadTransposeMatrixfARB); + SET_LoadTransposeMatrixdARB(disp, glLoadTransposeMatrixdARB); + SET_MultTransposeMatrixfARB(disp, glMultTransposeMatrixfARB); + SET_MultTransposeMatrixdARB(disp, glMultTransposeMatrixdARB); + SET_SampleCoverageARB(disp, glSampleCoverageARB); + SET_DrawBuffersARB(disp, glDrawBuffersARB); + SET_PolygonOffsetEXT(disp, glPolygonOffsetEXT); + SET_GetTexFilterFuncSGIS(disp, glGetTexFilterFuncSGIS); + SET_TexFilterFuncSGIS(disp, glTexFilterFuncSGIS); + SET_GetHistogramEXT(disp, glGetHistogramEXT); + SET_GetHistogramParameterfvEXT(disp, glGetHistogramParameterfvEXT); + SET_GetHistogramParameterivEXT(disp, glGetHistogramParameterivEXT); + SET_GetMinmaxEXT(disp, glGetMinmaxEXT); + SET_GetMinmaxParameterfvEXT(disp, glGetMinmaxParameterfvEXT); + SET_GetMinmaxParameterivEXT(disp, glGetMinmaxParameterivEXT); + SET_GetConvolutionFilterEXT(disp, glGetConvolutionFilterEXT); + SET_GetConvolutionParameterfvEXT(disp, glGetConvolutionParameterfvEXT); + SET_GetConvolutionParameterivEXT(disp, glGetConvolutionParameterivEXT); + SET_GetSeparableFilterEXT(disp, glGetSeparableFilterEXT); + SET_GetColorTableSGI(disp, glGetColorTableSGI); + SET_GetColorTableParameterfvSGI(disp, glGetColorTableParameterfvSGI); + SET_GetColorTableParameterivSGI(disp, glGetColorTableParameterivSGI); + SET_PixelTexGenSGIX(disp, glPixelTexGenSGIX); + SET_PixelTexGenParameteriSGIS(disp, glPixelTexGenParameteriSGIS); + SET_PixelTexGenParameterivSGIS(disp, glPixelTexGenParameterivSGIS); + SET_PixelTexGenParameterfSGIS(disp, glPixelTexGenParameterfSGIS); + SET_PixelTexGenParameterfvSGIS(disp, glPixelTexGenParameterfvSGIS); + SET_GetPixelTexGenParameterivSGIS(disp, glGetPixelTexGenParameterivSGIS); + SET_GetPixelTexGenParameterfvSGIS(disp, glGetPixelTexGenParameterfvSGIS); + SET_TexImage4DSGIS(disp, glTexImage4DSGIS); + SET_TexSubImage4DSGIS(disp, glTexSubImage4DSGIS); + SET_AreTexturesResidentEXT(disp, glAreTexturesResidentEXT); + SET_GenTexturesEXT(disp, glGenTexturesEXT); + SET_IsTextureEXT(disp, glIsTextureEXT); + SET_DetailTexFuncSGIS(disp, glDetailTexFuncSGIS); + SET_GetDetailTexFuncSGIS(disp, glGetDetailTexFuncSGIS); + SET_SharpenTexFuncSGIS(disp, glSharpenTexFuncSGIS); + SET_GetSharpenTexFuncSGIS(disp, glGetSharpenTexFuncSGIS); + SET_SampleMaskSGIS(disp, glSampleMaskSGIS); + SET_SamplePatternSGIS(disp, glSamplePatternSGIS); + SET_ColorPointerEXT(disp, glColorPointerEXT); + SET_EdgeFlagPointerEXT(disp, glEdgeFlagPointerEXT); + SET_IndexPointerEXT(disp, glIndexPointerEXT); + SET_NormalPointerEXT(disp, glNormalPointerEXT); + SET_TexCoordPointerEXT(disp, glTexCoordPointerEXT); + SET_VertexPointerEXT(disp, glVertexPointerEXT); + SET_SpriteParameterfSGIX(disp, glSpriteParameterfSGIX); + SET_SpriteParameterfvSGIX(disp, glSpriteParameterfvSGIX); + SET_SpriteParameteriSGIX(disp, glSpriteParameteriSGIX); + SET_SpriteParameterivSGIX(disp, glSpriteParameterivSGIX); + SET_PointParameterfEXT(disp, glPointParameterfEXT); + SET_PointParameterfvEXT(disp, glPointParameterfvEXT); + SET_GetInstrumentsSGIX(disp, glGetInstrumentsSGIX); + SET_InstrumentsBufferSGIX(disp, glInstrumentsBufferSGIX); + SET_PollInstrumentsSGIX(disp, glPollInstrumentsSGIX); + SET_ReadInstrumentsSGIX(disp, glReadInstrumentsSGIX); + SET_StartInstrumentsSGIX(disp, glStartInstrumentsSGIX); + SET_StopInstrumentsSGIX(disp, glStopInstrumentsSGIX); + SET_FrameZoomSGIX(disp, glFrameZoomSGIX); + SET_TagSampleBufferSGIX(disp, glTagSampleBufferSGIX); + SET_ReferencePlaneSGIX(disp, glReferencePlaneSGIX); + SET_FlushRasterSGIX(disp, glFlushRasterSGIX); + SET_GetListParameterfvSGIX(disp, glGetListParameterfvSGIX); + SET_GetListParameterivSGIX(disp, glGetListParameterivSGIX); + SET_ListParameterfSGIX(disp, glListParameterfSGIX); + SET_ListParameterfvSGIX(disp, glListParameterfvSGIX); + SET_ListParameteriSGIX(disp, glListParameteriSGIX); + SET_ListParameterivSGIX(disp, glListParameterivSGIX); + SET_FragmentColorMaterialSGIX(disp, glFragmentColorMaterialSGIX); + SET_FragmentLightfSGIX(disp, glFragmentLightfSGIX); + SET_FragmentLightfvSGIX(disp, glFragmentLightfvSGIX); + SET_FragmentLightiSGIX(disp, glFragmentLightiSGIX); + SET_FragmentLightivSGIX(disp, glFragmentLightivSGIX); + SET_FragmentLightModelfSGIX(disp, glFragmentLightModelfSGIX); + SET_FragmentLightModelfvSGIX(disp, glFragmentLightModelfvSGIX); + SET_FragmentLightModeliSGIX(disp, glFragmentLightModeliSGIX); + SET_FragmentLightModelivSGIX(disp, glFragmentLightModelivSGIX); + SET_FragmentMaterialfSGIX(disp, glFragmentMaterialfSGIX); + SET_FragmentMaterialfvSGIX(disp, glFragmentMaterialfvSGIX); + SET_FragmentMaterialiSGIX(disp, glFragmentMaterialiSGIX); + SET_FragmentMaterialivSGIX(disp, glFragmentMaterialivSGIX); + SET_GetFragmentLightfvSGIX(disp, glGetFragmentLightfvSGIX); + SET_GetFragmentLightivSGIX(disp, glGetFragmentLightivSGIX); + SET_GetFragmentMaterialfvSGIX(disp, glGetFragmentMaterialfvSGIX); + SET_GetFragmentMaterialivSGIX(disp, glGetFragmentMaterialivSGIX); + SET_LightEnviSGIX(disp, glLightEnviSGIX); + SET_VertexWeightfEXT(disp, glVertexWeightfEXT); + SET_VertexWeightfvEXT(disp, glVertexWeightfvEXT); + SET_VertexWeightPointerEXT(disp, glVertexWeightPointerEXT); + SET_FlushVertexArrayRangeNV(disp, glFlushVertexArrayRangeNV); + SET_VertexArrayRangeNV(disp, glVertexArrayRangeNV); + SET_CombinerParameterfvNV(disp, glCombinerParameterfvNV); + SET_CombinerParameterfNV(disp, glCombinerParameterfNV); + SET_CombinerParameterivNV(disp, glCombinerParameterivNV); + SET_CombinerParameteriNV(disp, glCombinerParameteriNV); + SET_CombinerInputNV(disp, glCombinerInputNV); + SET_CombinerOutputNV(disp, glCombinerOutputNV); + SET_FinalCombinerInputNV(disp, glFinalCombinerInputNV); + SET_GetCombinerInputParameterfvNV(disp, glGetCombinerInputParameterfvNV); + SET_GetCombinerInputParameterivNV(disp, glGetCombinerInputParameterivNV); + SET_GetCombinerOutputParameterfvNV(disp, glGetCombinerOutputParameterfvNV); + SET_GetCombinerOutputParameterivNV(disp, glGetCombinerOutputParameterivNV); + SET_GetFinalCombinerInputParameterfvNV(disp, glGetFinalCombinerInputParameterfvNV); + SET_GetFinalCombinerInputParameterivNV(disp, glGetFinalCombinerInputParameterivNV); + SET_ResizeBuffersMESA(disp, glResizeBuffersMESA); + SET_WindowPos2dMESA(disp, glWindowPos2dMESA); + SET_WindowPos2dvMESA(disp, glWindowPos2dvMESA); + SET_WindowPos2fMESA(disp, glWindowPos2fMESA); + SET_WindowPos2fvMESA(disp, glWindowPos2fvMESA); + SET_WindowPos2iMESA(disp, glWindowPos2iMESA); + SET_WindowPos2ivMESA(disp, glWindowPos2ivMESA); + SET_WindowPos2sMESA(disp, glWindowPos2sMESA); + SET_WindowPos2svMESA(disp, glWindowPos2svMESA); + SET_WindowPos3dMESA(disp, glWindowPos3dMESA); + SET_WindowPos3dvMESA(disp, glWindowPos3dvMESA); + SET_WindowPos3fMESA(disp, glWindowPos3fMESA); + SET_WindowPos3fvMESA(disp, glWindowPos3fvMESA); + SET_WindowPos3iMESA(disp, glWindowPos3iMESA); + SET_WindowPos3ivMESA(disp, glWindowPos3ivMESA); + SET_WindowPos3sMESA(disp, glWindowPos3sMESA); + SET_WindowPos3svMESA(disp, glWindowPos3svMESA); + SET_WindowPos4dMESA(disp, glWindowPos4dMESA); + SET_WindowPos4dvMESA(disp, glWindowPos4dvMESA); + SET_WindowPos4fMESA(disp, glWindowPos4fMESA); + SET_WindowPos4fvMESA(disp, glWindowPos4fvMESA); + SET_WindowPos4iMESA(disp, glWindowPos4iMESA); + SET_WindowPos4ivMESA(disp, glWindowPos4ivMESA); + SET_WindowPos4sMESA(disp, glWindowPos4sMESA); + SET_WindowPos4svMESA(disp, glWindowPos4svMESA); + SET_BlendFuncSeparateEXT(disp, glBlendFuncSeparateEXT); + SET_IndexMaterialEXT(disp, glIndexMaterialEXT); + SET_IndexFuncEXT(disp, glIndexFuncEXT); + SET_LockArraysEXT(disp, glLockArraysEXT); + SET_UnlockArraysEXT(disp, glUnlockArraysEXT); + SET_CullParameterdvEXT(disp, glCullParameterdvEXT); + SET_CullParameterfvEXT(disp, glCullParameterfvEXT); + SET_HintPGI(disp, glHintPGI); + SET_FogCoordfEXT(disp, glFogCoordfEXT); + SET_FogCoordfvEXT(disp, glFogCoordfvEXT); + SET_FogCoorddEXT(disp, glFogCoorddEXT); + SET_FogCoorddvEXT(disp, glFogCoorddvEXT); + SET_FogCoordPointerEXT(disp, glFogCoordPointerEXT); + SET_GetColorTableEXT(disp, glGetColorTableEXT); + SET_GetColorTableParameterivEXT(disp, glGetColorTableParameterivEXT); + SET_GetColorTableParameterfvEXT(disp, glGetColorTableParameterfvEXT); + SET_TbufferMask3DFX(disp, glTbufferMask3DFX); + SET_CompressedTexImage3DARB(disp, glCompressedTexImage3DARB); + SET_CompressedTexImage2DARB(disp, glCompressedTexImage2DARB); + SET_CompressedTexImage1DARB(disp, glCompressedTexImage1DARB); + SET_CompressedTexSubImage3DARB(disp, glCompressedTexSubImage3DARB); + SET_CompressedTexSubImage2DARB(disp, glCompressedTexSubImage2DARB); + SET_CompressedTexSubImage1DARB(disp, glCompressedTexSubImage1DARB); + SET_GetCompressedTexImageARB(disp, glGetCompressedTexImageARB); + SET_SecondaryColor3bEXT(disp, glSecondaryColor3bEXT); + SET_SecondaryColor3bvEXT(disp, glSecondaryColor3bvEXT); + SET_SecondaryColor3dEXT(disp, glSecondaryColor3dEXT); + SET_SecondaryColor3dvEXT(disp, glSecondaryColor3dvEXT); + SET_SecondaryColor3fEXT(disp, glSecondaryColor3fEXT); + SET_SecondaryColor3fvEXT(disp, glSecondaryColor3fvEXT); + SET_SecondaryColor3iEXT(disp, glSecondaryColor3iEXT); + SET_SecondaryColor3ivEXT(disp, glSecondaryColor3ivEXT); + SET_SecondaryColor3sEXT(disp, glSecondaryColor3sEXT); + SET_SecondaryColor3svEXT(disp, glSecondaryColor3svEXT); + SET_SecondaryColor3ubEXT(disp, glSecondaryColor3ubEXT); + SET_SecondaryColor3ubvEXT(disp, glSecondaryColor3ubvEXT); + SET_SecondaryColor3uiEXT(disp, glSecondaryColor3uiEXT); + SET_SecondaryColor3uivEXT(disp, glSecondaryColor3uivEXT); + SET_SecondaryColor3usEXT(disp, glSecondaryColor3usEXT); + SET_SecondaryColor3usvEXT(disp, glSecondaryColor3usvEXT); + SET_SecondaryColorPointerEXT(disp, glSecondaryColorPointerEXT); + SET_AreProgramsResidentNV(disp, glAreProgramsResidentNV); + SET_BindProgramNV(disp, glBindProgramNV); + SET_DeleteProgramsNV(disp, glDeleteProgramsNV); + SET_ExecuteProgramNV(disp, glExecuteProgramNV); + SET_GenProgramsNV(disp, glGenProgramsNV); + SET_GetProgramParameterdvNV(disp, glGetProgramParameterdvNV); + SET_GetProgramParameterfvNV(disp, glGetProgramParameterfvNV); + SET_GetProgramivNV(disp, glGetProgramivNV); + SET_GetProgramStringNV(disp, glGetProgramStringNV); + SET_GetTrackMatrixivNV(disp, glGetTrackMatrixivNV); + SET_GetVertexAttribdvARB(disp, glGetVertexAttribdvARB); + SET_GetVertexAttribfvARB(disp, glGetVertexAttribfvARB); + SET_GetVertexAttribivARB(disp, glGetVertexAttribivARB); + SET_GetVertexAttribPointervNV(disp, glGetVertexAttribPointervNV); + SET_IsProgramNV(disp, glIsProgramNV); + SET_LoadProgramNV(disp, glLoadProgramNV); + SET_ProgramParameter4dNV(disp, glProgramParameter4dNV); + SET_ProgramParameter4dvNV(disp, glProgramParameter4dvNV); + SET_ProgramParameter4fNV(disp, glProgramParameter4fNV); + SET_ProgramParameter4fvNV(disp, glProgramParameter4fvNV); + SET_ProgramParameters4dvNV(disp, glProgramParameters4dvNV); + SET_ProgramParameters4fvNV(disp, glProgramParameters4fvNV); + SET_RequestResidentProgramsNV(disp, glRequestResidentProgramsNV); + SET_TrackMatrixNV(disp, glTrackMatrixNV); + SET_VertexAttribPointerNV(disp, glVertexAttribPointerNV); + SET_VertexAttrib1dARB(disp, glVertexAttrib1dARB); + SET_VertexAttrib1dvARB(disp, glVertexAttrib1dvARB); + SET_VertexAttrib1fARB(disp, glVertexAttrib1fARB); + SET_VertexAttrib1fvARB(disp, glVertexAttrib1fvARB); + SET_VertexAttrib1sARB(disp, glVertexAttrib1sARB); + SET_VertexAttrib1svARB(disp, glVertexAttrib1svARB); + SET_VertexAttrib2dARB(disp, glVertexAttrib2dARB); + SET_VertexAttrib2dvARB(disp, glVertexAttrib2dvARB); + SET_VertexAttrib2fARB(disp, glVertexAttrib2fARB); + SET_VertexAttrib2fvARB(disp, glVertexAttrib2fvARB); + SET_VertexAttrib2sARB(disp, glVertexAttrib2sARB); + SET_VertexAttrib2svARB(disp, glVertexAttrib2svARB); + SET_VertexAttrib3dARB(disp, glVertexAttrib3dARB); + SET_VertexAttrib3dvARB(disp, glVertexAttrib3dvARB); + SET_VertexAttrib3fARB(disp, glVertexAttrib3fARB); + SET_VertexAttrib3fvARB(disp, glVertexAttrib3fvARB); + SET_VertexAttrib3sARB(disp, glVertexAttrib3sARB); + SET_VertexAttrib3svARB(disp, glVertexAttrib3svARB); + SET_VertexAttrib4dARB(disp, glVertexAttrib4dARB); + SET_VertexAttrib4dvARB(disp, glVertexAttrib4dvARB); + SET_VertexAttrib4fARB(disp, glVertexAttrib4fARB); + SET_VertexAttrib4fvARB(disp, glVertexAttrib4fvARB); + SET_VertexAttrib4sARB(disp, glVertexAttrib4sARB); + SET_VertexAttrib4svARB(disp, glVertexAttrib4svARB); + SET_VertexAttrib4NubARB(disp, glVertexAttrib4NubARB); + SET_VertexAttrib4NubvARB(disp, glVertexAttrib4NubvARB); + SET_VertexAttribs1dvNV(disp, glVertexAttribs1dvNV); + SET_VertexAttribs1fvNV(disp, glVertexAttribs1fvNV); + SET_VertexAttribs1svNV(disp, glVertexAttribs1svNV); + SET_VertexAttribs2dvNV(disp, glVertexAttribs2dvNV); + SET_VertexAttribs2fvNV(disp, glVertexAttribs2fvNV); + SET_VertexAttribs2svNV(disp, glVertexAttribs2svNV); + SET_VertexAttribs3dvNV(disp, glVertexAttribs3dvNV); + SET_VertexAttribs3fvNV(disp, glVertexAttribs3fvNV); + SET_VertexAttribs3svNV(disp, glVertexAttribs3svNV); + SET_VertexAttribs4dvNV(disp, glVertexAttribs4dvNV); + SET_VertexAttribs4fvNV(disp, glVertexAttribs4fvNV); + SET_VertexAttribs4svNV(disp, glVertexAttribs4svNV); + SET_VertexAttribs4ubvNV(disp, glVertexAttribs4ubvNV); + SET_PointParameteriNV(disp, glPointParameteriNV); + SET_PointParameterivNV(disp, glPointParameterivNV); + SET_MultiDrawArraysEXT(disp, glMultiDrawArraysEXT); + SET_MultiDrawElementsEXT(disp, glMultiDrawElementsEXT); + SET_ActiveStencilFaceEXT(disp, glActiveStencilFaceEXT); + SET_DeleteFencesNV(disp, glDeleteFencesNV); + SET_GenFencesNV(disp, glGenFencesNV); + SET_IsFenceNV(disp, glIsFenceNV); + SET_TestFenceNV(disp, glTestFenceNV); + SET_GetFenceivNV(disp, glGetFenceivNV); + SET_FinishFenceNV(disp, glFinishFenceNV); + SET_SetFenceNV(disp, glSetFenceNV); + SET_VertexAttrib4bvARB(disp, glVertexAttrib4bvARB); + SET_VertexAttrib4ivARB(disp, glVertexAttrib4ivARB); + SET_VertexAttrib4ubvARB(disp, glVertexAttrib4ubvARB); + SET_VertexAttrib4usvARB(disp, glVertexAttrib4usvARB); + SET_VertexAttrib4uivARB(disp, glVertexAttrib4uivARB); + SET_VertexAttrib4NbvARB(disp, glVertexAttrib4NbvARB); + SET_VertexAttrib4NsvARB(disp, glVertexAttrib4NsvARB); + SET_VertexAttrib4NivARB(disp, glVertexAttrib4NivARB); + SET_VertexAttrib4NusvARB(disp, glVertexAttrib4NusvARB); + SET_VertexAttrib4NuivARB(disp, glVertexAttrib4NuivARB); + SET_VertexAttribPointerARB(disp, glVertexAttribPointerARB); + SET_EnableVertexAttribArrayARB(disp, glEnableVertexAttribArrayARB); + SET_DisableVertexAttribArrayARB(disp, glDisableVertexAttribArrayARB); + SET_ProgramStringARB(disp, glProgramStringARB); + SET_ProgramEnvParameter4dARB(disp, glProgramEnvParameter4dARB); + SET_ProgramEnvParameter4dvARB(disp, glProgramEnvParameter4dvARB); + SET_ProgramEnvParameter4fARB(disp, glProgramEnvParameter4fARB); + SET_ProgramEnvParameter4fvARB(disp, glProgramEnvParameter4fvARB); + SET_ProgramLocalParameter4dARB(disp, glProgramLocalParameter4dARB); + SET_ProgramLocalParameter4dvARB(disp, glProgramLocalParameter4dvARB); + SET_ProgramLocalParameter4fARB(disp, glProgramLocalParameter4fARB); + SET_ProgramLocalParameter4fvARB(disp, glProgramLocalParameter4fvARB); + SET_GetProgramEnvParameterdvARB(disp, glGetProgramEnvParameterdvARB); + SET_GetProgramEnvParameterfvARB(disp, glGetProgramEnvParameterfvARB); + SET_GetProgramLocalParameterdvARB(disp, glGetProgramLocalParameterdvARB); + SET_GetProgramLocalParameterfvARB(disp, glGetProgramLocalParameterfvARB); + SET_GetProgramivARB(disp, glGetProgramivARB); + SET_GetProgramStringARB(disp, glGetProgramStringARB); + SET_ProgramNamedParameter4fNV(disp, glProgramNamedParameter4fNV); + SET_ProgramNamedParameter4dNV(disp, glProgramNamedParameter4dNV); + SET_ProgramNamedParameter4fvNV(disp, glProgramNamedParameter4fvNV); + SET_ProgramNamedParameter4dvNV(disp, glProgramNamedParameter4dvNV); + SET_GetProgramNamedParameterfvNV(disp, glGetProgramNamedParameterfvNV); + SET_GetProgramNamedParameterdvNV(disp, glGetProgramNamedParameterdvNV); + SET_BindBufferARB(disp, glBindBufferARB); + SET_BufferDataARB(disp, glBufferDataARB); + SET_BufferSubDataARB(disp, glBufferSubDataARB); + SET_DeleteBuffersARB(disp, glDeleteBuffersARB); + SET_GenBuffersARB(disp, glGenBuffersARB); + SET_GetBufferParameterivARB(disp, glGetBufferParameterivARB); + SET_GetBufferPointervARB(disp, glGetBufferPointervARB); + SET_GetBufferSubDataARB(disp, glGetBufferSubDataARB); + SET_IsBufferARB(disp, glIsBufferARB); + SET_MapBufferARB(disp, glMapBufferARB); + SET_UnmapBufferARB(disp, glUnmapBufferARB); + SET_DepthBoundsEXT(disp, glDepthBoundsEXT); + SET_GenQueriesARB(disp, glGenQueriesARB); + SET_DeleteQueriesARB(disp, glDeleteQueriesARB); + SET_IsQueryARB(disp, glIsQueryARB); + SET_BeginQueryARB(disp, glBeginQueryARB); + SET_EndQueryARB(disp, glEndQueryARB); + SET_GetQueryivARB(disp, glGetQueryivARB); + SET_GetQueryObjectivARB(disp, glGetQueryObjectivARB); + SET_GetQueryObjectuivARB(disp, glGetQueryObjectuivARB); + SET_MultiModeDrawArraysIBM(disp, glMultiModeDrawArraysIBM); + SET_MultiModeDrawElementsIBM(disp, glMultiModeDrawElementsIBM); + SET_BlendEquationSeparateEXT(disp, glBlendEquationSeparateEXT); + SET_DeleteObjectARB(disp, glDeleteObjectARB); + SET_GetHandleARB(disp, glGetHandleARB); + SET_DetachObjectARB(disp, glDetachObjectARB); + SET_CreateShaderObjectARB(disp, glCreateShaderObjectARB); + SET_ShaderSourceARB(disp, glShaderSourceARB); + SET_CompileShaderARB(disp, glCompileShaderARB); + SET_CreateProgramObjectARB(disp, glCreateProgramObjectARB); + SET_AttachObjectARB(disp, glAttachObjectARB); + SET_LinkProgramARB(disp, glLinkProgramARB); + SET_UseProgramObjectARB(disp, glUseProgramObjectARB); + SET_ValidateProgramARB(disp, glValidateProgramARB); + SET_Uniform1fARB(disp, glUniform1fARB); + SET_Uniform2fARB(disp, glUniform2fARB); + SET_Uniform3fARB(disp, glUniform3fARB); + SET_Uniform4fARB(disp, glUniform4fARB); + SET_Uniform1iARB(disp, glUniform1iARB); + SET_Uniform2iARB(disp, glUniform2iARB); + SET_Uniform3iARB(disp, glUniform3iARB); + SET_Uniform4iARB(disp, glUniform4iARB); + SET_Uniform1fvARB(disp, glUniform1fvARB); + SET_Uniform2fvARB(disp, glUniform2fvARB); + SET_Uniform3fvARB(disp, glUniform3fvARB); + SET_Uniform4fvARB(disp, glUniform4fvARB); + SET_Uniform1ivARB(disp, glUniform1ivARB); + SET_Uniform2ivARB(disp, glUniform2ivARB); + SET_Uniform3ivARB(disp, glUniform3ivARB); + SET_Uniform4ivARB(disp, glUniform4ivARB); + SET_UniformMatrix2fvARB(disp, glUniformMatrix2fvARB); + SET_UniformMatrix3fvARB(disp, glUniformMatrix3fvARB); + SET_UniformMatrix4fvARB(disp, glUniformMatrix4fvARB); + SET_GetObjectParameterfvARB(disp, glGetObjectParameterfvARB); + SET_GetObjectParameterivARB(disp, glGetObjectParameterivARB); + SET_GetInfoLogARB(disp, glGetInfoLogARB); + SET_GetAttachedObjectsARB(disp, glGetAttachedObjectsARB); + SET_GetUniformLocationARB(disp, glGetUniformLocationARB); + SET_GetActiveUniformARB(disp, glGetActiveUniformARB); + SET_GetUniformfvARB(disp, glGetUniformfvARB); + SET_GetUniformivARB(disp, glGetUniformivARB); + SET_GetShaderSourceARB(disp, glGetShaderSourceARB); + SET_BindAttribLocationARB(disp, glBindAttribLocationARB); + SET_GetActiveAttribARB(disp, glGetActiveAttribARB); + SET_GetAttribLocationARB(disp, glGetAttribLocationARB); + SET_GetVertexAttribdvNV(disp, glGetVertexAttribdvNV); + SET_GetVertexAttribfvNV(disp, glGetVertexAttribfvNV); + SET_GetVertexAttribivNV(disp, glGetVertexAttribivNV); + SET_VertexAttrib1dNV(disp, glVertexAttrib1dNV); + SET_VertexAttrib1dvNV(disp, glVertexAttrib1dvNV); + SET_VertexAttrib1fNV(disp, glVertexAttrib1fNV); + SET_VertexAttrib1fvNV(disp, glVertexAttrib1fvNV); + SET_VertexAttrib1sNV(disp, glVertexAttrib1sNV); + SET_VertexAttrib1svNV(disp, glVertexAttrib1svNV); + SET_VertexAttrib2dNV(disp, glVertexAttrib2dNV); + SET_VertexAttrib2dvNV(disp, glVertexAttrib2dvNV); + SET_VertexAttrib2fNV(disp, glVertexAttrib2fNV); + SET_VertexAttrib2fvNV(disp, glVertexAttrib2fvNV); + SET_VertexAttrib2sNV(disp, glVertexAttrib2sNV); + SET_VertexAttrib2svNV(disp, glVertexAttrib2svNV); + SET_VertexAttrib3dNV(disp, glVertexAttrib3dNV); + SET_VertexAttrib3dvNV(disp, glVertexAttrib3dvNV); + SET_VertexAttrib3fNV(disp, glVertexAttrib3fNV); + SET_VertexAttrib3fvNV(disp, glVertexAttrib3fvNV); + SET_VertexAttrib3sNV(disp, glVertexAttrib3sNV); + SET_VertexAttrib3svNV(disp, glVertexAttrib3svNV); + SET_VertexAttrib4dNV(disp, glVertexAttrib4dNV); + SET_VertexAttrib4dvNV(disp, glVertexAttrib4dvNV); + SET_VertexAttrib4fNV(disp, glVertexAttrib4fNV); + SET_VertexAttrib4fvNV(disp, glVertexAttrib4fvNV); + SET_VertexAttrib4sNV(disp, glVertexAttrib4sNV); + SET_VertexAttrib4svNV(disp, glVertexAttrib4svNV); + SET_VertexAttrib4ubNV(disp, glVertexAttrib4ubNV); + SET_VertexAttrib4ubvNV(disp, glVertexAttrib4ubvNV); + SET_GenFragmentShadersATI(disp, glGenFragmentShadersATI); + SET_BindFragmentShaderATI(disp, glBindFragmentShaderATI); + SET_DeleteFragmentShaderATI(disp, glDeleteFragmentShaderATI); + SET_BeginFragmentShaderATI(disp, glBeginFragmentShaderATI); + SET_EndFragmentShaderATI(disp, glEndFragmentShaderATI); + SET_PassTexCoordATI(disp, glPassTexCoordATI); + SET_SampleMapATI(disp, glSampleMapATI); + SET_ColorFragmentOp1ATI(disp, glColorFragmentOp1ATI); + SET_ColorFragmentOp2ATI(disp, glColorFragmentOp2ATI); + SET_ColorFragmentOp3ATI(disp, glColorFragmentOp3ATI); + SET_AlphaFragmentOp1ATI(disp, glAlphaFragmentOp1ATI); + SET_AlphaFragmentOp2ATI(disp, glAlphaFragmentOp2ATI); + SET_AlphaFragmentOp3ATI(disp, glAlphaFragmentOp3ATI); + SET_SetFragmentShaderConstantATI(disp, glSetFragmentShaderConstantATI); + SET_IsRenderbufferEXT(disp, glIsRenderbufferEXT); + SET_BindRenderbufferEXT(disp, glBindRenderbufferEXT); + SET_DeleteRenderbuffersEXT(disp, glDeleteRenderbuffersEXT); + SET_GenRenderbuffersEXT(disp, glGenRenderbuffersEXT); + SET_RenderbufferStorageEXT(disp, glRenderbufferStorageEXT); + SET_GetRenderbufferParameterivEXT(disp, glGetRenderbufferParameterivEXT); + SET_IsFramebufferEXT(disp, glIsFramebufferEXT); + SET_BindFramebufferEXT(disp, glBindFramebufferEXT); + SET_DeleteFramebuffersEXT(disp, glDeleteFramebuffersEXT); + SET_GenFramebuffersEXT(disp, glGenFramebuffersEXT); + SET_CheckFramebufferStatusEXT(disp, glCheckFramebufferStatusEXT); + SET_FramebufferTexture1DEXT(disp, glFramebufferTexture1DEXT); + SET_FramebufferTexture2DEXT(disp, glFramebufferTexture2DEXT); + SET_FramebufferTexture3DEXT(disp, glFramebufferTexture3DEXT); + SET_FramebufferRenderbufferEXT(disp, glFramebufferRenderbufferEXT); + SET_GetFramebufferAttachmentParameterivEXT(disp, glGetFramebufferAttachmentParameterivEXT); + SET_GenerateMipmapEXT(disp, glGenerateMipmapEXT); + SET_StencilFuncSeparate(disp, glStencilFuncSeparate); + SET_StencilOpSeparate(disp, glStencilOpSeparate); + SET_StencilMaskSeparate(disp, glStencilMaskSeparate); + SET_GetQueryObjecti64vEXT(disp, glGetQueryObjecti64vEXT); + SET_GetQueryObjectui64vEXT(disp, glGetQueryObjectui64vEXT); + SET_BlitFramebufferEXT(disp, glBlitFramebufferEXT); */ + +} --- xorg-server-1.4.2.orig/xfixes/Makefile.in +++ xorg-server-1.4.2/xfixes/Makefile.in @@ -142,7 +142,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -276,10 +276,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/Makefile.in +++ xorg-server-1.4.2/hw/Makefile.in @@ -133,7 +133,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -267,10 +267,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/dmx/Makefile.in +++ xorg-server-1.4.2/hw/dmx/Makefile.in @@ -189,7 +189,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -323,10 +323,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/dmx/glxProxy/Makefile.in +++ xorg-server-1.4.2/hw/dmx/glxProxy/Makefile.in @@ -149,7 +149,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -283,10 +283,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ @@ -399,6 +402,7 @@ unpack.h AM_CFLAGS = \ + @GLX_ARCH_DEFINES@ \ $(DIX_CFLAGS) \ -I$(top_srcdir)/hw/dmx \ -I$(top_srcdir)/include \ --- xorg-server-1.4.2.orig/hw/dmx/config/Makefile.in +++ xorg-server-1.4.2/hw/dmx/config/Makefile.in @@ -181,7 +181,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -315,10 +315,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/dmx/input/Makefile.in +++ xorg-server-1.4.2/hw/dmx/input/Makefile.in @@ -163,7 +163,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -297,10 +297,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/dmx/doc/Makefile.in +++ xorg-server-1.4.2/hw/dmx/doc/Makefile.in @@ -145,7 +145,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -279,10 +279,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/dmx/examples/Makefile.in +++ xorg-server-1.4.2/hw/dmx/examples/Makefile.in @@ -246,7 +246,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -380,10 +380,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xnest/Makefile.in +++ xorg-server-1.4.2/hw/xnest/Makefile.in @@ -173,7 +173,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -307,10 +307,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/kdrive/Kdrive.tmpl +++ xorg-server-1.4.2/hw/kdrive/Kdrive.tmpl @@ -0,0 +1,17 @@ +XCOMM $RCSId: xc/programs/Xserver/hw/kdrive/Kdrive.tmpl,v 1.3tsi Exp $ + +#include + +#if BuildRender +RENDERINCS=-I$(KDRIVE)/../../render +#endif + +#if BuildRandR +RANDRINCS=-I$(KDRIVE)/../../randr +#endif + +KDINCS = -I$(KDRIVE) -I$(XBUILDINCDIR) -I$(FONTINCSRC) \ + -I$(KDRIVE)/../../fb -I$(KDRIVE)/../../mi -I$(KDRIVE)/../../Xext \ + -I$(KDRIVE)/../../miext/shadow -I$(KDRIVE)/../../miext/layer \ + -I$(KDRIVE)/../../include -I$(KDRIVE)/../../os \ + -I$(EXTINCSRC) -I$(XINCLUDESRC) $(RENDERINCS) $(RANDRINCS) --- xorg-server-1.4.2.orig/hw/kdrive/Makefile.in +++ xorg-server-1.4.2/hw/kdrive/Makefile.in @@ -133,7 +133,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -267,10 +267,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/kdrive/Xkdrive.man +++ xorg-server-1.4.2/hw/kdrive/Xkdrive.man @@ -0,0 +1,77 @@ +.\" $RCSId: xc/programs/Xserver/hw/kdrive/Xkdrive.man,v 1.3 2001/01/24 00:06:10 dawes Exp $ +.\" +.TH Xkdrive 1 __vendorversion__ +.SH NAME +Xkdrive \- tiny X server +.SH SYNOPSIS +.B Xvesa +.RI [ :display ] +.RI [ option ...] + +.B Xfbdev +.RI [ :display ] +.RI [ option ...] + +.B Xigs +.RI [ :display ] +.RI [ option ...] + +.B Xtrident +.RI [ :display ] +.RI [ option ...] + +.B Xsis530 +.RI [ :display ] +.RI [ option ...] + +.B Xtrio +.RI [ :display ] +.RI [ option ...] + +.B Xitsy +.RI [ :display ] +.RI [ option ...] +.SH DESCRIPTION +.B Xkdrive +is a family of X servers designed to be particularly small. This +manual page describes the common functionality of the +.B Xkdrive +servers; for information on a specific X server, please refer to the +relevant manual page. +.SH OPTIONS +In addition to the standard options accepted by all X servers (see +Xserver(1)), all the +.B Xkdrive +servers accept the following options: +.TP 8 +.B -card \fIpcmcia\fP +use pcmcia card as additional screen. +.TP 8 +.B -dumb +disable hardware acceleration. +.TP 8 +.B -origin \fIX\fP,\fIY\fP +Locates the next screen in the Xinerama virtual screen. +.TP 8 +.B -screen \fIwidth\fBx\fIheight\fR[\fBx\fIdepth\fR[\fBx\fIfreq\fR]]\fR[\fB@\fIrotation\fR]\fB +use a screen of the specified \fIwidth\fP, \fIheight\fP, screen \fIdepth\fP, \fIfrequency\fP, and \fIrotation\fP (0, 90, 180 and 270 are legal values). +.TP 8 +.B -softCursor +disable the hardware cursor. +.TP 8 +.B -videoTest +start the server, pause momentarily, and exit. +.TP 8 +.B -zaphod +disable switching screens by moving the pointer across a screen boundary. +.TP 8 +.B -2button +enable emulation of a middle mouse button by chording. +.TP 8 +.B -3button +disable emulation of a middle mouse button by chording. +.SH SEE ALSO +X(__miscmansuffix__), Xserver(1), xdm(1), xinit(1), Xvesa(1), Xfbdev(1). +.SH AUTHORS +The Xkdrive common core was written by Keith Packard, +and is based on the Sample Implementation of X. --- xorg-server-1.4.2.orig/hw/kdrive/nvidia/nvidiavideo.c +++ xorg-server-1.4.2/hw/kdrive/nvidia/nvidiavideo.c @@ -0,0 +1,1016 @@ +/* + * Copyright © 2003 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_CONFIG_H +#include +#endif +#include "nvidia.h" + +#include +#include "fourcc.h" + +#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) + +static Atom xvBrightness, xvSaturation, xvColorKey; + +#define IMAGE_MAX_WIDTH 720 +#define IMAGE_MAX_HEIGHT 576 + +static void +nvidiaStopVideo(KdScreenInfo *screen, pointer data, Bool exit) +{ + ScreenPtr pScreen = screen->pScreen; + KdScreenPriv(pScreen); + KdCardInfo *card = pScreenPriv->card; + NvidiaScreenInfo *nvidias = (NvidiaScreenInfo *) screen->driver; + NvidiaCardInfo *nvidiac = (NvidiaCardInfo *) card->driver; + NvidiaPortPrivPtr pPortPriv = nvidias->pAdaptor->pPortPrivates[0].ptr; + Reg *reg = nvidiac->reg; + MediaReg *media = nvidiac->media_reg; + + REGION_EMPTY(screen->pScreen, &pPortPriv->clip); + + if (!media) + return; + + if(pPortPriv->videoOn) + { + nvidiaWaitIdle (reg); + /* wait for buffer to be displayed */ + while (((media->TRIG_CNTL >> 5) & 1) != pPortPriv->currentBuf) + ; + /* wait for buffer to be finished */ + while (((media->TRIG_CNTL >> 6) & 1) != 0) + ; + nvidiaWaitAvail (reg, 1); + media->OVERLAY_SCALE_CNTL = 0; + pPortPriv->videoOn = FALSE; + nvidiaWaitIdle (reg); + } +} + +static int +nvidiaSetPortAttribute(KdScreenInfo *screen, + Atom attribute, + int value, + pointer data) +{ + ScreenPtr pScreen = screen->pScreen; + KdScreenPriv(pScreen); + KdCardInfo *card = pScreenPriv->card; + NvidiaScreenInfo *nvidias = (NvidiaScreenInfo *) screen->driver; + NvidiaCardInfo *nvidiac = (NvidiaCardInfo *) card->driver; + NvidiaPortPrivPtr pPortPriv = nvidias->pAdaptor->pPortPrivates[0].ptr; + MediaReg *media = nvidiac->media_reg; + + if(attribute == xvBrightness) + { + if(value < -1000) + value = -1000; + if (value > 1000) + value = 1000; + pPortPriv->brightness = value; + } + else if(attribute == xvSaturation) + { + if (value < -1000) + value = -1000; + if (value > 1000) + value = 1000; + pPortPriv->saturation = value; + } + else if(attribute == xvColorKey) + { + if (pPortPriv->colorKey != value) + { + pPortPriv->colorKey = value; + REGION_EMPTY(screen->pScreen, &pPortPriv->clip); + } + } + else + return BadMatch; + + return Success; +} + +static int +nvidiaGetPortAttribute(KdScreenInfo *screen, + Atom attribute, + int *value, + pointer data) +{ + NvidiaPortPrivPtr pPortPriv = (NvidiaPortPrivPtr)data; + + if(attribute == xvBrightness) + *value = pPortPriv->brightness; + else if(attribute == xvSaturation) + *value = pPortPriv->saturation; + else if(attribute == xvColorKey) + *value = pPortPriv->colorKey; + else + return BadMatch; + + return Success; +} + +static void +nvidiaQueryBestSize(KdScreenInfo *screen, + Bool motion, + short vid_w, + short vid_h, + short drw_w, + short drw_h, + unsigned int *p_w, + unsigned int *p_h, + pointer data) +{ + *p_w = drw_w; + *p_h = drw_h; +} + + +static void +nvidiaCopyPackedData(KdScreenInfo *screen, + unsigned char *buf, + int randr, + int srcPitch, + int dstPitch, + int srcW, + int srcH, + int top, + int left, + int h, + int w) +{ + ScreenPtr pScreen = screen->pScreen; + KdScreenPriv(pScreen); + KdCardInfo *card = pScreenPriv->card; + NvidiaScreenInfo *nvidias = (NvidiaScreenInfo *) screen->driver; + NvidiaCardInfo *nvidiac = (NvidiaCardInfo *) card->driver; + NvidiaPortPrivPtr pPortPriv = nvidias->pAdaptor->pPortPrivates[0].ptr; + CARD8 *src, *dst; + int srcDown, srcRight, srcNext; + int p; + + switch (randr & RR_Rotate_All) { + case RR_Rotate_0: + src = buf; + srcDown = srcPitch; + srcRight = 2; + break; + case RR_Rotate_90: + src = buf + (srcH - 1) * 2; + srcDown = -2; + srcRight = srcPitch; + break; + case RR_Rotate_180: + src = buf + srcPitch * (srcH - 1) + (srcW - 1) * 2; + srcDown = -srcPitch; + srcRight = -2; + break; + case RR_Rotate_270: + src = buf + srcPitch * (srcW - 1); + srcDown = 2; + srcRight = -srcPitch; + break; + } + + src = src + top*srcDown + left*srcRight; + + if (pPortPriv->currentBuf == 0) + dst = (CARD8 *) nvidias->vesa.fb + pPortPriv->YBuf0Offset; + else + dst = (CARD8 *) nvidias->vesa.fb + pPortPriv->YBuf1Offset; + + w >>= 1; + srcRight >>= 1; + srcNext = srcRight >> 1; + while(h--) + { + CARD16 *s = (CARD16 *) src; + CARD32 *d = (CARD32 *) dst; + p = w; + while (p--) + { + *d++ = s[0] | (s[srcNext] << 16); + s += srcRight; + } + src += srcPitch; + dst += dstPitch; + } +} + +static void +nvidiaCopyPlanarData(KdScreenInfo *screen, + unsigned char *buf, + int randr, + int srcPitch, + int srcPitch2, + int dstPitch, /* of chroma */ + int srcW, + int srcH, + int height, + int top, + int left, + int h, + int w, + int id) +{ + ScreenPtr pScreen = screen->pScreen; + KdScreenPriv(pScreen); + KdCardInfo *card = pScreenPriv->card; + NvidiaScreenInfo *nvidias = (NvidiaScreenInfo *) screen->driver; + NvidiaCardInfo *nvidiac = (NvidiaCardInfo *) card->driver; + NvidiaPortPrivPtr pPortPriv = nvidias->pAdaptor->pPortPrivates[0].ptr; + int i, j; + CARD8 *src1, *src2, *src3, *dst1; + int srcDown, srcDown2, srcRight, srcRight2, srcNext; + + /* compute source data pointers */ + src1 = buf; + src2 = src1 + height * srcPitch; + src3 = src2 + (height >> 1) * srcPitch2; + switch (randr & RR_Rotate_All) { + case RR_Rotate_0: + srcDown = srcPitch; + srcDown2 = srcPitch2; + srcRight = 2; + srcRight2 = 1; + srcNext = 1; + break; + case RR_Rotate_90: + src1 = src1 + srcH - 1; + src2 = src2 + (srcH >> 1) - 1; + src3 = src3 + (srcH >> 1) - 1; + srcDown = -1; + srcDown2 = -1; + srcRight = srcPitch * 2; + srcRight2 = srcPitch2; + srcNext = srcPitch; + break; + case RR_Rotate_180: + src1 = src1 + srcPitch * (srcH - 1) + (srcW - 1); + src2 = src2 + srcPitch2 * ((srcH >> 1) - 1) + ((srcW >> 1) - 1); + src3 = src3 + srcPitch2 * ((srcH >> 1) - 1) + ((srcW >> 1) - 1); + srcDown = -srcPitch; + srcDown2 = -srcPitch2; + srcRight = -2; + srcRight2 = -1; + srcNext = -1; + break; + case RR_Rotate_270: + src1 = src1 + srcPitch * (srcW - 1); + src2 = src2 + srcPitch2 * ((srcW >> 1) - 1); + src3 = src3 + srcPitch2 * ((srcW >> 1) - 1); + srcDown = 1; + srcDown2 = 1; + srcRight = -srcPitch * 2; + srcRight2 = -srcPitch2; + srcNext = -srcPitch; + break; + } + + /* adjust for origin */ + src1 += top * srcDown + left * srcNext; + src2 += (top >> 1) * srcDown2 + (left >> 1) * srcRight2; + src3 += (top >> 1) * srcDown2 + (left >> 1) * srcRight2; + + if (id == FOURCC_I420) + { + CARD8 *srct = src2; + src2 = src3; + src3 = srct; + } + + if (pPortPriv->currentBuf == 0) + dst1 = (CARD8 *) nvidias->vesa.fb + pPortPriv->YBuf0Offset; + else + dst1 = (CARD8 *) nvidias->vesa.fb + pPortPriv->YBuf1Offset; + + w >>= 1; + for (j = 0; j < h; j++) + { + CARD32 *dst = (CARD32 *) dst1; + CARD8 *s1l = src1; + CARD8 *s1r = src1 + srcNext; + CARD8 *s2 = src2; + CARD8 *s3 = src3; + + for (i = 0; i < w; i++) + { + *dst++ = *s1l | (*s1r << 16) | (*s3 << 8) | (*s2 << 24); + s1l += srcRight; + s1r += srcRight; + s2 += srcRight2; + s3 += srcRight2; + } + src1 += srcDown; + dst1 += dstPitch; + if (j & 1) + { + src2 += srcDown2; + src3 += srcDown2; + } + } +} + +static void +nvidiaPaintRegion (ScreenPtr pScreen, RegionPtr pRgn, Pixel fg) +{ + WindowPtr pRoot = WindowTable[pScreen->myNum]; + GCPtr pGC; + CARD32 val[2]; + xRectangle *rects, *r; + BoxPtr pBox = REGION_RECTS (pRgn); + int nBox = REGION_NUM_RECTS (pRgn); + + rects = ALLOCATE_LOCAL (nBox * sizeof (xRectangle)); + if (!rects) + goto bail0; + r = rects; + while (nBox--) + { + r->x = pBox->x1; + r->y = pBox->y1; + r->width = pBox->x2 - pBox->x1; + r->height = pBox->y2 - pBox->y1; + r++; + pBox++; + } + + pGC = GetScratchGC (pRoot->drawable.depth, pScreen); + if (!pGC) + goto bail1; + + val[0] = fg; + val[1] = IncludeInferiors; + ChangeGC (pGC, GCForeground|GCSubwindowMode, val); + + ValidateGC (&pRoot->drawable, pGC); + + (*pGC->ops->PolyFillRect) (&pRoot->drawable, pGC, + REGION_NUM_RECTS (pRgn), rects); + + FreeScratchGC (pGC); +bail1: + DEALLOCATE_LOCAL (rects); +bail0: + ; +} + +/* NvidiaClipVideo - + + 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. +*/ + +static void +NvidiaClipVideo(BoxPtr dst, + INT32 *x1, + INT32 *x2, + INT32 *y1, + INT32 *y2, + BoxPtr extents, /* extents of the clip region */ + INT32 width, + INT32 height) +{ + INT32 vscale, hscale, delta; + int diff; + + hscale = ((*x2 - *x1) << 16) / (dst->x2 - dst->x1); + vscale = ((*y2 - *y1) << 16) / (dst->y2 - dst->y1); + + *x1 <<= 16; *x2 <<= 16; + *y1 <<= 16; *y2 <<= 16; + + diff = extents->x1 - dst->x1; + if(diff > 0) { + dst->x1 = extents->x1; + *x1 += diff * hscale; + } + diff = dst->x2 - extents->x2; + if(diff > 0) { + dst->x2 = extents->x2; + *x2 -= diff * hscale; + } + diff = extents->y1 - dst->y1; + if(diff > 0) { + dst->y1 = extents->y1; + *y1 += diff * vscale; + } + diff = dst->y2 - extents->y2; + if(diff > 0) { + dst->y2 = extents->y2; + *y2 -= diff * vscale; + } + + if(*x1 < 0) { + diff = (- *x1 + hscale - 1)/ hscale; + dst->x1 += diff; + *x1 += diff * hscale; + } + delta = *x2 - (width << 16); + if(delta > 0) { + diff = (delta + hscale - 1)/ hscale; + dst->x2 -= diff; + *x2 -= diff * hscale; + } + if(*y1 < 0) { + diff = (- *y1 + vscale - 1)/ vscale; + dst->y1 += diff; + *y1 += diff * vscale; + } + delta = *y2 - (height << 16); + if(delta > 0) { + diff = (delta + vscale - 1)/ vscale; + dst->y2 -= diff; + *y2 -= diff * vscale; + } +} + +static void +nvidiaDisplayVideo(KdScreenInfo *screen, + int id, + int dstPitch, /* of chroma for 4:2:0 */ + int x1, + int y1, + int x2, + int y2, + int dst_x1, + int dst_y1, + int dst_x2, + int dst_y2, + short src_w, + short src_h, + short drw_w, + short drw_h) +{ + ScreenPtr pScreen = screen->pScreen; + KdScreenPriv(pScreen); + KdCardInfo *card = pScreenPriv->card; + NvidiaScreenInfo *nvidias = (NvidiaScreenInfo *) screen->driver; + NvidiaCardInfo *nvidiac = (NvidiaCardInfo *) card->driver; + NvidiaPortPrivPtr pPortPriv = nvidias->pAdaptor->pPortPrivates[0].ptr; + Reg *reg = nvidiac->reg; + MediaReg *media = nvidiac->media_reg; + int xscaleInt, xscaleFract, yscaleInt, yscaleFract; + int xscaleIntUV = 0, xscaleFractUV = 0; + int yscaleIntUV = 0, yscaleFractUV = 0; + int randr = nvidias->vesa.randr; + int HORZ_INC, VERT_INC; + CARD32 SCALER_IN; + CARD32 OVERLAY_SCALE_CNTL; + int tmp; + int left; + int bright; + int sat; + + if (id == FOURCC_UYVY) + SCALER_IN = SCALER_IN_YVYU422; + else + SCALER_IN = SCALER_IN_VYUY422; + + nvidiaWaitAvail (reg, 4); + + media->VIDEO_FORMAT = SCALER_IN | VIDEO_IN_VYUY422; + + /* color key */ + media->OVERLAY_GRAPHICS_KEY_MSK = (1 << screen->fb[0].depth) - 1; + media->OVERLAY_GRAPHICS_KEY_CLR = pPortPriv->colorKey; + /* set key control to obey only graphics color key */ + media->OVERLAY_KEY_CNTL = 0x50; + + nvidiaWaitAvail (reg, 9); + media->CAPTURE_DEBUG = 0; + /* no exclusive video region */ + media->OVERLAY_EXCLUSIVE_HORZ = 0; + media->OVERLAY_EXCLUSIVE_VERT = 0; + /* scaling coefficients */ + media->SCALER_H_COEFF0 = 0x00002000; + media->SCALER_H_COEFF1 = 0x0D06200D; + media->SCALER_H_COEFF2 = 0x0D0A1C0D; + media->SCALER_H_COEFF3 = 0x0C0E1A0C; + media->SCALER_H_COEFF4 = 0x0C14140C; + media->SCALER_TEST = 0; + + nvidiaWaitAvail (reg, 2); + media->OVERLAY_SCALE_CNTL = (SCALE_PIX_EXPAND | + SCALE_GAMMA_BRIGHT | + SCALE_BANDWIDTH | + SCALE_OVERLAY_EN | + SCALE_EN); + + bright = (pPortPriv->brightness * 64 / 1000); + if (bright < -0x40) + bright = -0x40; + if (bright > 0x3f) + bright = 0x3f; + bright = bright & 0x7f; + sat = ((pPortPriv->saturation * 31 + 31000) / 2000); + if (sat > 0x1f) + sat = 0x1f; + if (sat < 0) + sat = 0; + + media->SCALER_COLOUR_CNTL = ((bright << 0) | /* BRIGHTNESS */ + (sat << 8) | /* SATURATION_U */ + (sat << 16) | /* SATURATION_V */ + (0 << 21) | /* SCALER_VERT_ADJ_UV */ + (0 << 28)); /* SCALER_HORZ_ADJ_UV */ + + VERT_INC = (src_h << 12) / drw_h; + HORZ_INC = (src_w << 12) / drw_w; + + nvidiaWaitAvail (reg, 13); + + /* lock registers to prevent non-atomic update */ + media->OVERLAY_Y_X_START = 0x80000000 | NVIDIA_YX (dst_x1, dst_y1); + /* ending screen coordinate */ + media->OVERLAY_Y_X_END = 0x80000000 | NVIDIA_YX (dst_x2, dst_y2); + + media->OVERLAY_SCALE_INC = NVIDIA_YX(HORZ_INC, VERT_INC); + + media->SCALER_BUF0_OFFSET = pPortPriv->YBuf0Offset; + media->SCALER_BUF1_OFFSET = pPortPriv->YBuf1Offset; + + media->SCALER_BUF0_OFFSET_U = pPortPriv->YBuf0Offset; + media->SCALER_BUF1_OFFSET_U = pPortPriv->YBuf1Offset; + + media->SCALER_BUF0_OFFSET_V = pPortPriv->YBuf0Offset; + media->SCALER_BUF1_OFFSET_V = pPortPriv->YBuf1Offset; + + media->SCALER_BUF_PITCH = dstPitch >> 1; + media->SCALER_HEIGHT_WIDTH = NVIDIA_YX(src_w - (x1 >> 16), src_h - (y1 >> 16)); + + media->CAPTURE_CONFIG = pPortPriv->currentBuf << 28; + + /* set XY location and unlock */ + media->OVERLAY_Y_X_START = NVIDIA_YX (dst_x1, dst_y1); +} + +static int +nvidiaPutImage(KdScreenInfo *screen, + 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, + pointer data) +{ + KdCardInfo *card = screen->card; + NvidiaScreenInfo *nvidias = (NvidiaScreenInfo *) screen->driver; + NvidiaCardInfo *nvidiac = (NvidiaCardInfo *) card->driver; + NvidiaPortPrivPtr pPortPriv = (NvidiaPortPrivPtr)data; + Reg *reg = nvidiac->reg; + MediaReg *media = nvidiac->media_reg; + INT32 x1, x2, y1, y2; + int randr = nvidias->vesa.randr; + int srcPitch, srcPitch2, dstPitch; + int top, left, npixels, nlines, size; + BoxRec dstBox; + int dst_width = width, dst_height = height; + int rot_x1, rot_y1, rot_x2, rot_y2; + int dst_x1, dst_y1, dst_x2, dst_y2; + int rot_src_w, rot_src_h, rot_drw_w, rot_drw_h; + + /* Clip */ + x1 = src_x; + x2 = src_x + src_w; + y1 = src_y; + y2 = src_y + src_h; + + dstBox.x1 = drw_x; + dstBox.x2 = drw_x + drw_w; + dstBox.y1 = drw_y; + dstBox.y2 = drw_y + drw_h; + + NvidiaClipVideo(&dstBox, &x1, &x2, &y1, &y2, + REGION_EXTENTS(pScreen, clipBoxes), width, height); + + if((x1 >= x2) || (y1 >= y2)) + return Success; + + if (!media) + return BadAlloc; + + if (randr & (RR_Rotate_0|RR_Rotate_180)) + { + dst_width = width; + dst_height = height; + rot_src_w = src_w; + rot_src_h = src_h; + rot_drw_w = drw_w; + rot_drw_h = drw_h; + } + else + { + dst_width = height; + dst_height = width; + rot_src_w = src_h; + rot_src_h = src_w; + rot_drw_w = drw_h; + rot_drw_h = drw_w; + } + + switch (randr & RR_Rotate_All) { + case RR_Rotate_0: + dst_x1 = dstBox.x1; + dst_y1 = dstBox.y1; + dst_x2 = dstBox.x2; + dst_y2 = dstBox.y2; + rot_x1 = x1; + rot_y1 = y1; + rot_x2 = x2; + rot_y2 = y2; + break; + case RR_Rotate_90: + dst_x1 = dstBox.y1; + dst_y1 = screen->height - dstBox.x2; + dst_x2 = dstBox.y2; + dst_y2 = screen->height - dstBox.x1; + + rot_x1 = y1; + rot_y1 = (src_w << 16) - x2; + rot_x2 = y2; + rot_y2 = (src_w << 16) - x1; + break; + case RR_Rotate_180: + dst_x1 = screen->width - dstBox.x2; + dst_y1 = screen->height - dstBox.y2; + dst_x2 = screen->width - dstBox.x1; + dst_y2 = screen->height - dstBox.y1; + rot_x1 = (src_w << 16) - x2; + rot_y1 = (src_h << 16) - y2; + rot_x2 = (src_w << 16) - x1; + rot_y2 = (src_h << 16) - y1; + break; + case RR_Rotate_270: + dst_x1 = screen->width - dstBox.y2; + dst_y1 = dstBox.x1; + dst_x2 = screen->width - dstBox.y1; + dst_y2 = dstBox.x2; + rot_x1 = (src_h << 16) - y2; + rot_y1 = x1; + rot_x2 = (src_h << 16) - y1; + rot_y2 = x2; + break; + } + + switch(id) { + case FOURCC_YV12: + case FOURCC_I420: + dstPitch = ((dst_width << 1) + 15) & ~15; + srcPitch = (width + 3) & ~3; + srcPitch2 = ((width >> 1) + 3) & ~3; + size = dstPitch * (int) dst_height; + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + dstPitch = ((dst_width << 1) + 15) & ~15; + srcPitch = (width << 1); + size = dstPitch * (int) dst_height; + break; + } + + pPortPriv->offset = nvidias->off_screen - (CARD8 *) nvidias->vesa.fb; + /* fixup pointers */ + + pPortPriv->YBuf0Offset = pPortPriv->offset; + pPortPriv->YBuf1Offset = pPortPriv->offset + size; + +#if 0 + nvidiaWaitIdle (reg); + + if (pPortPriv->videoOn) + { + /* wait for buffer to be displayed */ + while (((media->TRIG_CNTL >> 5) & 1) != pPortPriv->currentBuf) + ; + } +#endif + /* + * Use the other buffer + */ + pPortPriv->currentBuf = 1 - pPortPriv->currentBuf; + + /* copy data */ + top = rot_y1 >> 16; + left = (rot_x1 >> 16) & ~1; + npixels = ((((rot_x2 + 0xffff) >> 16) + 1) & ~1) - left; + + switch(id) { + case FOURCC_YV12: + case FOURCC_I420: + top &= ~1; + nlines = ((((rot_y2 + 0xffff) >> 16) + 1) & ~1) - top; + nvidiaCopyPlanarData(screen, buf, randr, + srcPitch, srcPitch2, dstPitch, + rot_src_w, rot_src_h, height, + top, left, nlines, npixels, id); + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + nlines = ((rot_y2 + 0xffff) >> 16) - top; + nvidiaCopyPackedData(screen, buf, randr, + srcPitch, dstPitch, + rot_src_w, rot_src_h, + top, left, nlines, + npixels); + break; + } + + nvidiaDisplayVideo(screen, id, dstPitch, + rot_x1, rot_y1, rot_x2, rot_y2, + dst_x1, dst_y1, + dst_x2, dst_y2, + rot_src_w, rot_src_h, rot_drw_w, rot_drw_h); + + /* update cliplist */ + if (!REGION_EQUAL (screen->pScreen, &pPortPriv->clip, clipBoxes)) + { + REGION_COPY (screen->pScreen, &pPortPriv->clip, clipBoxes); + nvidiaPaintRegion (screen->pScreen, &pPortPriv->clip, pPortPriv->colorKey); + } + + pPortPriv->videoOn = TRUE; + + return Success; +} + +static int +nvidiaQueryImageAttributes(KdScreenInfo *screen, + int id, + unsigned short *w, + unsigned short *h, + int *pitches, + int *offsets) +{ + int size, tmp; + + if(*w > IMAGE_MAX_WIDTH) + *w = IMAGE_MAX_WIDTH; + if(*h > IMAGE_MAX_HEIGHT) + *h = IMAGE_MAX_HEIGHT; + + *w = (*w + 1) & ~1; + if(offsets) offsets[0] = 0; + + switch(id) { + case FOURCC_YV12: + case FOURCC_I420: + *h = (*h + 1) & ~1; + size = (*w + 3) & ~3; + if(pitches) + pitches[0] = size; + size *= *h; + if(offsets) + offsets[1] = size; + tmp = ((*w >> 1) + 3) & ~3; + if(pitches) + pitches[1] = pitches[2] = tmp; + tmp *= (*h >> 1); + size += tmp; + if(offsets) + offsets[2] = size; + size += tmp; + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + size = *w << 1; + if(pitches) + pitches[0] = size; + size *= *h; + break; + } + + return size; +} + + +/* client libraries expect an encoding */ +static KdVideoEncodingRec DummyEncoding[1] = +{ + { + 0, + "XV_IMAGE", + IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT, + {1, 1} + } +}; + +#define NUM_FORMATS 3 + +static KdVideoFormatRec Formats[NUM_FORMATS] = +{ + {15, TrueColor}, {16, TrueColor}, {24, TrueColor} +}; + +#define NUM_ATTRIBUTES 3 + +static KdAttributeRec Attributes[NUM_ATTRIBUTES] = +{ + {XvSettable | XvGettable, 0, ~0, "XV_COLORKEY"}, + {XvSettable | XvGettable, -1000, 1000, "XV_BRIGHTNESS"}, + {XvSettable | XvGettable, -1000, 1000, "XV_SATURATION"} +}; + +#define NUM_IMAGES 4 + +static KdImageRec Images[NUM_IMAGES] = +{ + XVIMAGE_YUY2, + XVIMAGE_YV12, + XVIMAGE_I420, + XVIMAGE_UYVY +}; + +static void nvidiaResetVideo(KdScreenInfo *screen) +{ + ScreenPtr pScreen = screen->pScreen; + KdScreenPriv(pScreen); + KdCardInfo *card = pScreenPriv->card; + NvidiaScreenInfo *nvidias = (NvidiaScreenInfo *) screen->driver; + NvidiaCardInfo *nvidiac = (NvidiaCardInfo *) card->driver; + NvidiaPortPrivPtr pPortPriv = nvidias->pAdaptor->pPortPrivates[0].ptr; + MediaReg *media = nvidiac->media_reg; + + /* + * Default to maximum image size in YV12 + */ + +} + +static int +nvidiaReputImage (KdScreenInfo *screen, + short drw_x, + short drw_y, + RegionPtr clipBoxes, + pointer data) +{ + ScreenPtr pScreen = screen->pScreen; + NvidiaPortPrivPtr pPortPriv = (NvidiaPortPrivPtr)data; + BoxPtr pOldExtents = REGION_EXTENTS (pScreen, &pPortPriv->clip); + BoxPtr pNewExtents = REGION_EXTENTS (pScreen, clipBoxes); + + if (pOldExtents->x1 == pNewExtents->x1 && + pOldExtents->x2 == pNewExtents->x2 && + pOldExtents->y1 == pNewExtents->y1 && + pOldExtents->y2 == pNewExtents->y2) + { + /* update cliplist */ + if (!REGION_EQUAL (screen->pScreen, &pPortPriv->clip, clipBoxes)) + { + REGION_COPY (screen->pScreen, &pPortPriv->clip, clipBoxes); + nvidiaPaintRegion (screen->pScreen, &pPortPriv->clip, pPortPriv->colorKey); + } + return Success; + } + return BadMatch; +} + +static KdVideoAdaptorPtr +nvidiaSetupImageVideo(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + nvidiaCardInfo(pScreenPriv); + nvidiaScreenInfo(pScreenPriv); + KdScreenInfo *screen = pScreenPriv->screen; + KdCardInfo *card = pScreenPriv->card; + KdVideoAdaptorPtr adapt; + NvidiaPortPrivPtr pPortPriv; + + if(!(adapt = xcalloc(1, sizeof(KdVideoAdaptorRec) + + sizeof(NvidiaPortPrivRec) + + sizeof(DevUnion)))) + return NULL; + + adapt->type = XvWindowMask | XvInputMask | XvImageMask; + adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; + adapt->name = "Nvidia Video Overlay"; + adapt->nEncodings = 1; + adapt->pEncodings = DummyEncoding; + adapt->nFormats = NUM_FORMATS; + adapt->pFormats = Formats; + adapt->nPorts = 1; + adapt->pPortPrivates = (DevUnion*)(&adapt[1]); + + pPortPriv = (NvidiaPortPrivPtr)(&adapt->pPortPrivates[1]); + + adapt->pPortPrivates[0].ptr = (pointer)(pPortPriv); + adapt->pAttributes = Attributes; + adapt->nImages = NUM_IMAGES; + adapt->nAttributes = NUM_ATTRIBUTES; + adapt->pImages = Images; + adapt->PutVideo = NULL; + adapt->PutStill = NULL; + adapt->GetVideo = NULL; + adapt->GetStill = NULL; + adapt->StopVideo = nvidiaStopVideo; + adapt->SetPortAttribute = nvidiaSetPortAttribute; + adapt->GetPortAttribute = nvidiaGetPortAttribute; + adapt->QueryBestSize = nvidiaQueryBestSize; + adapt->PutImage = nvidiaPutImage; + adapt->ReputImage = nvidiaReputImage; + adapt->QueryImageAttributes = nvidiaQueryImageAttributes; + + pPortPriv->colorKey = nvidias->colorKey; + pPortPriv->videoOn = FALSE; + pPortPriv->brightness = 0; + pPortPriv->saturation = 0; + pPortPriv->currentBuf = 0; + + /* gotta uninit this someplace */ + REGION_INIT(pScreen, &pPortPriv->clip, NullBox, 0); + + nvidias->pAdaptor = adapt; + + xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); + xvSaturation = MAKE_ATOM("XV_SATURATION"); + xvColorKey = MAKE_ATOM("XV_COLORKEY"); + + nvidiaResetVideo(screen); + + return adapt; +} + +Bool nvidiaInitVideo(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + KdVideoAdaptorPtr *adaptors, *newAdaptors = NULL; + KdVideoAdaptorPtr newAdaptor = NULL; + int num_adaptors; + KdCardInfo *card = pScreenPriv->card; + NvidiaScreenInfo *nvidias = (NvidiaScreenInfo *) screen->driver; + NvidiaCardInfo *nvidiac = (NvidiaCardInfo *) card->driver; + + if (!nvidiac->media_reg) + return FALSE; + + newAdaptor = nvidiaSetupImageVideo(pScreen); + + num_adaptors = KdXVListGenericAdaptors(screen, &adaptors); + + if(newAdaptor) + { + if(!num_adaptors) + { + num_adaptors = 1; + adaptors = &newAdaptor; + } + else + { + newAdaptors = xalloc((num_adaptors + 1) * + sizeof(KdVideoAdaptorPtr*)); + if(newAdaptors) + { + memcpy(newAdaptors, adaptors, + num_adaptors * sizeof(KdVideoAdaptorPtr)); + newAdaptors[num_adaptors] = newAdaptor; + adaptors = newAdaptors; + num_adaptors++; + } + } + } + + if(num_adaptors) + KdXVScreenInit(pScreen, adaptors, num_adaptors); + + if(newAdaptors) + xfree(newAdaptors); + return TRUE; +} --- xorg-server-1.4.2.orig/hw/kdrive/nvidia/Makefile.in +++ xorg-server-1.4.2/hw/kdrive/nvidia/Makefile.in @@ -152,7 +152,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -286,10 +286,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/kdrive/nvidia/nvidiacurs.c +++ xorg-server-1.4.2/hw/kdrive/nvidia/nvidiacurs.c @@ -0,0 +1,389 @@ +/* + * 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_CONFIG_H +#include +#endif +#include "trident.h" +#include "cursorstr.h" + +#define SetupCursor(s) KdScreenPriv(s); \ + tridentCardInfo(pScreenPriv); \ + tridentScreenInfo(pScreenPriv); \ + TridentCursor *pCurPriv = &tridents->cursor + +static void +_tridentMoveCursor (ScreenPtr pScreen, int x, int y) +{ + SetupCursor(pScreen); + CARD8 xlow, xhigh, ylow, yhigh; + CARD8 xoff, yoff; + + x -= pCurPriv->xhot; + xoff = 0; + if (x < 0) + { + xoff = -x; + x = 0; + } + y -= pCurPriv->yhot; + yoff = 0; + if (y < 0) + { + yoff = -y; + y = 0; + } + xlow = (CARD8) x; + xhigh = (CARD8) (x >> 8); + ylow = (CARD8) y; + yhigh = (CARD8) (y >> 8); + + + /* This is the recommended order to move the cursor */ + + tridentWriteIndex (tridentc, 0x3d4, 0x41, xhigh); + tridentWriteIndex (tridentc, 0x3d4, 0x40, xlow); + tridentWriteIndex (tridentc, 0x3d4, 0x42, ylow); + tridentWriteIndex (tridentc, 0x3d4, 0x46, xoff); + tridentWriteIndex (tridentc, 0x3d4, 0x47, yoff); + tridentWriteIndex (tridentc, 0x3d4, 0x43, yhigh); +} + +static void +tridentMoveCursor (ScreenPtr pScreen, int x, int y) +{ + SetupCursor (pScreen); + + if (!pCurPriv->has_cursor) + return; + + if (!pScreenPriv->enabled) + return; + + _tridentMoveCursor (pScreen, x, y); +} + +static void +tridentAllocCursorColors (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + CursorPtr pCursor = pCurPriv->pCursor; + + KdAllocateCursorPixels (pScreen, 0, pCursor, + &pCurPriv->source, &pCurPriv->mask); + switch (pScreenPriv->screen->fb[0].bitsPerPixel) { + case 4: + pCurPriv->source |= pCurPriv->source << 4; + pCurPriv->mask |= pCurPriv->mask << 4; + case 8: + pCurPriv->source |= pCurPriv->source << 8; + pCurPriv->mask |= pCurPriv->mask << 8; + case 16: + pCurPriv->source |= pCurPriv->source << 16; + pCurPriv->mask |= pCurPriv->mask << 16; + } +} + +static void +tridentSetCursorColors (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + CursorPtr pCursor = pCurPriv->pCursor; + CARD32 fg, bg; + + fg = pCurPriv->source; + bg = pCurPriv->mask; + tridentWriteIndex (tridentc, 0x3d4, 0x48, fg); + tridentWriteIndex (tridentc, 0x3d4, 0x49, fg >> 8); + tridentWriteIndex (tridentc, 0x3d4, 0x4a, fg >> 16); + + tridentWriteIndex (tridentc, 0x3d4, 0x4c, bg); + tridentWriteIndex (tridentc, 0x3d4, 0x4d, bg >> 8); + tridentWriteIndex (tridentc, 0x3d4, 0x4e, bg >> 16); +} + +void +tridentRecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef) +{ + SetupCursor (pScreen); + CursorPtr pCursor = pCurPriv->pCursor; + xColorItem sourceColor, maskColor; + + if (!pCurPriv->has_cursor || !pCursor) + return; + + if (!pScreenPriv->enabled) + return; + + if (pdef) + { + while (ndef) + { + if (pdef->pixel == pCurPriv->source || + pdef->pixel == pCurPriv->mask) + break; + ndef--; + } + if (!ndef) + return; + } + tridentAllocCursorColors (pScreen); + tridentSetCursorColors (pScreen); +} + +#define InvertBits32(v) { \ + v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \ + v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \ + v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \ +} + +static void +tridentLoadCursor (ScreenPtr pScreen, int x, int y) +{ + SetupCursor(pScreen); + CursorPtr pCursor = pCurPriv->pCursor; + CursorBitsPtr bits = pCursor->bits; + int w, h; + CARD32 *ram, *msk, *mskLine, *src, *srcLine; + int i, j; + int cursor_address; + int lwsrc; + unsigned char ramdac_control_; + CARD32 offset; + + /* + * Allocate new colors + */ + tridentAllocCursorColors (pScreen); + + pCurPriv->pCursor = pCursor; + pCurPriv->xhot = pCursor->bits->xhot; + pCurPriv->yhot = pCursor->bits->yhot; + + /* + * Stick new image into cursor memory + */ + ram = (CARD32 *) tridents->cursor_base; + mskLine = (CARD32 *) bits->mask; + srcLine = (CARD32 *) bits->source; + + h = bits->height; + if (h > TRIDENT_CURSOR_HEIGHT) + h = TRIDENT_CURSOR_HEIGHT; + + lwsrc = BitmapBytePad(bits->width) / 4; /* words per line */ + + for (i = 0; i < TRIDENT_CURSOR_HEIGHT; i++) { + msk = mskLine; + src = srcLine; + mskLine += lwsrc; + srcLine += lwsrc; + for (j = 0; j < TRIDENT_CURSOR_WIDTH / 32; j++) { + + CARD32 m, s; + +#if 1 + if (i < h && j < lwsrc) + { + m = *msk++; + s = *src++; + InvertBits32(m); + InvertBits32(s); + } + else + { + m = 0; + s = 0; + } +#endif + *ram++ = m; + *ram++ = s; + } + } + + /* Set address for cursor bits */ + offset = tridents->cursor_base - (CARD8 *) tridents->screen; + offset >>= 10; + tridentWriteIndex (tridentc, 0x3d4, 0x44, (CARD8) (offset & 0xff)); + tridentWriteIndex (tridentc, 0x3d4, 0x45, (CARD8) (offset >> 8)); + + /* Set new color */ + tridentSetCursorColors (pScreen); + + /* Enable the cursor */ + tridentWriteIndex (tridentc, 0x3d4, 0x50, 0xc1); + + /* Move to new position */ + tridentMoveCursor (pScreen, x, y); +} + +static void +tridentUnloadCursor (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + /* Disable cursor */ + tridentWriteIndex (tridentc, 0x3d4, 0x50, 0); +} + +static Bool +tridentRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) +{ + SetupCursor(pScreen); + + if (!pScreenPriv->enabled) + return TRUE; + + /* miRecolorCursor does this */ + if (pCurPriv->pCursor == pCursor) + { + if (pCursor) + { + int x, y; + + miPointerPosition (&x, &y); + tridentLoadCursor (pScreen, x, y); + } + } + return TRUE; +} + +static Bool +tridentUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) +{ + return TRUE; +} + +static void +tridentSetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y) +{ + SetupCursor(pScreen); + + pCurPriv->pCursor = pCursor; + + if (!pScreenPriv->enabled) + return; + + if (pCursor) + tridentLoadCursor (pScreen, x, y); + else + tridentUnloadCursor (pScreen); +} + +miPointerSpriteFuncRec tridentPointerSpriteFuncs = { + tridentRealizeCursor, + tridentUnrealizeCursor, + tridentSetCursor, + tridentMoveCursor, +}; + +static void +tridentQueryBestSize (int class, + unsigned short *pwidth, unsigned short *pheight, + ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + switch (class) + { + case CursorShape: + if (*pwidth > pCurPriv->width) + *pwidth = pCurPriv->width; + if (*pheight > pCurPriv->height) + *pheight = pCurPriv->height; + if (*pwidth > pScreen->width) + *pwidth = pScreen->width; + if (*pheight > pScreen->height) + *pheight = pScreen->height; + break; + default: + fbQueryBestSize (class, pwidth, pheight, pScreen); + break; + } +} + +Bool +tridentCursorInit (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + if (!tridents->cursor_base) + { + pCurPriv->has_cursor = FALSE; + return FALSE; + } + + pCurPriv->width = TRIDENT_CURSOR_WIDTH; + pCurPriv->height= TRIDENT_CURSOR_HEIGHT; + pScreen->QueryBestSize = tridentQueryBestSize; + miPointerInitialize (pScreen, + &tridentPointerSpriteFuncs, + &kdPointerScreenFuncs, + FALSE); + pCurPriv->has_cursor = TRUE; + pCurPriv->pCursor = NULL; + return TRUE; +} + +void +tridentCursorEnable (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + if (pCurPriv->has_cursor) + { + if (pCurPriv->pCursor) + { + int x, y; + + miPointerPosition (&x, &y); + tridentLoadCursor (pScreen, x, y); + } + else + tridentUnloadCursor (pScreen); + } +} + +void +tridentCursorDisable (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + if (!pScreenPriv->enabled) + return; + + if (pCurPriv->has_cursor) + { + if (pCurPriv->pCursor) + { + tridentUnloadCursor (pScreen); + } + } +} + +void +tridentCursorFini (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + pCurPriv->pCursor = NULL; +} --- xorg-server-1.4.2.orig/hw/kdrive/epson/Xepson.man +++ xorg-server-1.4.2/hw/kdrive/epson/Xepson.man @@ -0,0 +1,26 @@ +.\" $XFree86: xc/programs/Xserver/hw/kdrive/epson/Xepson.man,v 1.5 2001/02/13 21:15:15 dawes Exp $ +.\" +.TH Xepson 1 __vendorversion__ +.SH NAME +Xepson \- Epson 13806 accelerated framebuffer device tiny X server +.SH SYNOPSIS +.B Xepson +.RI [ :display ] +.RI [ option ...] +.SH DESCRIPTION +.B Xepson +is a driver for the Epson LCD 13806 framebuffer. +.B Xepson +is heavily based upon the Kdrive Xfbdev driver, and behaves very similarly, except for accelerated operations targetted at the Epson chip. +.SH OPTIONS +.B Xepson +accepts the common options of the Xkdrive family of servers. Please +see Xkdrive(1). +.SH KEYBOARD +To be written. +.SH SEE ALSO +X(__miscmansuffix__), Xserver(1), Xkdrive(1), xdm(1), xinit(1). +.SH AUTHORS +The +.B Xepson +server was written by Costas Stylianou based on the Xfbdev sources with some contributions from Phil Blundell & Peter Naulls. --- xorg-server-1.4.2.orig/hw/kdrive/epson/Makefile.in +++ xorg-server-1.4.2/hw/kdrive/epson/Makefile.in @@ -151,7 +151,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -285,10 +285,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/kdrive/sis530/sisstub.c +++ xorg-server-1.4.2/hw/kdrive/sis530/sisstub.c @@ -0,0 +1,67 @@ +/* + * Copyright 1999 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_CONFIG_H +#include +#endif +#include "sis.h" + +static const int sisCards[] = { 0x6306, 0x0200 }; + +#define numSisCards (sizeof (sisCards) / sizeof (sisCards[0])) + +void +InitCard (char *name) +{ + KdCardAttr attr; + int i; + + for (i = 0; i < numSisCards; i++) + if (LinuxFindPci (0x1039, sisCards[i], 0, &attr)) + KdCardInfoAdd (&sisFuncs, &attr, (void *) sisCards[i]); +} + +void +InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) +{ + KdInitOutput (pScreenInfo, argc, argv); +} + +void +InitInput (int argc, char **argv) +{ + KdOsAddInputDrivers (); + KdInitInput (); +} + +void +ddxUseMsg (void) +{ + KdUseMsg(); +} + +int +ddxProcessArgument (int argc, char **argv, int i) +{ + return KdProcessArgument (argc, argv, i); +} --- xorg-server-1.4.2.orig/hw/kdrive/sis530/sisclock.c +++ xorg-server-1.4.2/hw/kdrive/sis530/sisclock.c @@ -0,0 +1,232 @@ +/* + * 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_CONFIG_H +#include +#endif +#include "sis.h" +#include + +#define FREF 14318180 +#define MIN_VCO FREF +#define MAX_VCO 230000000 +#define MAX_PSN 0 /* no pre scaler for this chip */ +#define TOLERANCE 0.01 /* search smallest M and N in this tolerance */ +#define max_VLD 1 + +/* + * Compute clock values given target frequency + */ +void +sisGetClock (unsigned long clock, SisCrtc *crtc) +{ + unsigned char reg7, reg13, reg2a, reg2b; + int M, N, P, VLD; + + int bestM, bestN, bestP, bestPSN, bestVLD; + double bestError, abest = 42.0, bestFout; + + double Fvco, Fout; + double error, aerror; + + double target = (double) clock; + + int M_min = 2; + int M_max = 128; + + int low_N = 2; + int high_N = 32; + int PSN = 1; + + /* + * fd = fref*(Numerator/Denumerator)*(Divider/PostScaler) + * + * M = Numerator [1:128] + * N = DeNumerator [1:32] + * VLD = Divider (Vco Loop Divider) : divide by 1, 2 + * P = Post Scaler : divide by 1, 2, 3, 4 + * PSN = Pre Scaler (Reference Divisor Select) + * + * result in vclk[] + */ + + P = 1; + if (target < MAX_VCO / 2) + P = 2; + if (target < MAX_VCO / 3) + P = 3; + if (target < MAX_VCO / 4) + P = 4; + if (target < MAX_VCO / 6) + P = 6; + if (target < MAX_VCO / 8) + P = 8; + + Fvco = P * target; + + for (N = low_N; N <= high_N; N++) + { + double M_desired = Fvco / FREF * N; + + if (M_desired > M_max * max_VLD) + continue; + + if ( M_desired > M_max ) + { + M = (int)(M_desired / 2 + 0.5); + VLD = 2; + } + else + { + M = (int)(M_desired + 0.5); + VLD = 1; + } + + Fout = (double)FREF * (M * VLD)/(N * P); + error = (target - Fout) / target; + aerror = (error < 0) ? -error : error; + if (aerror < abest) + { + abest = aerror; + bestError = error; + bestM = M; + bestN = N; + bestP = P; + bestPSN = PSN; + bestVLD = VLD; + bestFout = Fout; + } + } + + crtc->vclk_numerator = bestM - 1; + crtc->vclk_divide_by_2 = bestVLD == 2; + + crtc->vclk_denominator = bestN - 1; + switch (bestP) { + case 1: + crtc->vclk_post_scale = SIS_VCLK_POST_SCALE_1; + crtc->vclk_post_scale_2 = 0; + break; + case 2: + crtc->vclk_post_scale = SIS_VCLK_POST_SCALE_2; + crtc->vclk_post_scale_2 = 0; + break; + case 3: + crtc->vclk_post_scale = SIS_VCLK_POST_SCALE_3; + crtc->vclk_post_scale_2 = 0; + break; + case 4: + crtc->vclk_post_scale = SIS_VCLK_POST_SCALE_4; + crtc->vclk_post_scale_2 = 0; + break; + case 6: + crtc->vclk_post_scale = SIS_VCLK_POST_SCALE_3; + crtc->vclk_post_scale_2 = 1; + break; + case 8: + crtc->vclk_post_scale = SIS_VCLK_POST_SCALE_4; + crtc->vclk_post_scale_2 = 1; + break; + } + + crtc->vclk_vco_gain = 1; + + /* + * Don't know how to set mclk for local frame buffer; for + * shared frame buffer, mclk is hardwired to bus speed (100MHz)? + */ +} + +sisCalcMclk (SisCrtc *crtc) +{ + int mclk, Numer, DeNumer; + double Divider, Scalar; + + Numer = crtc->mclk_numerator; + DeNumer = crtc->mclk_denominator; + Divider = crtc->mclk_divide_by_2 ? 2.0 : 1.0; + Scalar = 1.0; + if (crtc->mclk_post_scale_2) + { + switch (crtc->mclk_post_scale) { + case 2: + Scalar = 6.0; + break; + case 3: + Scalar = 8.0; + break; + } + } + else + { + switch (crtc->mclk_post_scale) { + case 0: + Scalar = 1.0; + break; + case 1: + Scalar = 2.0; + break; + case 2: + Scalar = 3.0; + break; + case 3: + Scalar = 4.0; + break; + } + } + + mclk = (int)(FREF*((double)(Numer+1)/(double)(DeNumer+1))*(Divider/Scalar)); + + return(mclk); +} + +#define UMA_FACTOR 60 +#define LFB_FACTOR 30 // Only if local frame buffer +#define SIS_SAYS_SO 0x1F // But how is the performance?? +#define CRT_ENG_THRESH 0x0F // But how is the performance?? +#define BUS_WIDTH 64 +#define DFP_BUS_WIDTH 32 // rumour has it for digital flat panel ?? +#define MEGAHZ (1<<20) + +void +sisEngThresh (SisCrtc *crtc, unsigned long vclk, int bpp) +{ + int threshlow, mclk; + + mclk = sisCalcMclk(crtc) / 1000000; + vclk = vclk / 1000000; + threshlow = ((((UMA_FACTOR*vclk*bpp)/ + (mclk*BUS_WIDTH))+1)/2)+4; + + crtc->crt_cpu_threshold_low_0_3 = threshlow; + crtc->crt_cpu_threshold_low_4 = threshlow >> 4; + + crtc->crt_cpu_threshold_high_0_3 = (SIS_SAYS_SO & 0xf); + crtc->crt_cpu_threshold_high_4 = 0; + + crtc->crt_engine_threshold_high_0_3 = CRT_ENG_THRESH; + crtc->crt_engine_threshold_high_4 = 1; + + crtc->ascii_attribute_threshold_0_2 = (SIS_SAYS_SO >> 4); + + crtc->crt_threshold_full_control = SIS_CRT_64_STAGE_THRESHOLD; +} --- xorg-server-1.4.2.orig/hw/kdrive/sis530/siscurs.c +++ xorg-server-1.4.2/hw/kdrive/sis530/siscurs.c @@ -0,0 +1,364 @@ +/* + * 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_CONFIG_H +#include +#endif +#include "sis.h" +#include "cursorstr.h" + +#define SetupCursor(s) KdScreenPriv(s); \ + sisCardInfo(pScreenPriv); \ + sisScreenInfo(pScreenPriv); \ + SisPtr sis = sisc->sis; \ + SisCursor *pCurPriv = &siss->cursor + +static void +_sisMoveCursor (ScreenPtr pScreen, int x, int y) +{ + SetupCursor(pScreen); + CARD8 xlow, xhigh, ylow, yhigh; + CARD8 xoff, yoff; + + x -= pCurPriv->xhot; + xoff = 0; + if (x < 0) + { + xoff = -x; + x = 0; + } + y -= pCurPriv->yhot; + yoff = 0; + if (y < 0) + { + yoff = -y; + y = 0; + } + xlow = (CARD8) x; + xhigh = (CARD8) (x >> 8); + ylow = (CARD8) y; + yhigh = (CARD8) (y >> 8); + + PutSrtc (sisc, 0x5, 0x86); + PutSrtc (sisc, 0x1c, xoff & 0x3f); + PutSrtc (sisc, 0x1f, yoff & 0x3f); + + PutSrtc (sisc, 0x1a, xlow); + PutSrtc (sisc, 0x1b, xhigh & 0xf); + + PutSrtc (sisc, 0x1d, ylow); + PutSrtc (sisc, 0x1e, yhigh & 0x7); +} + +static void +sisMoveCursor (ScreenPtr pScreen, int x, int y) +{ + SetupCursor (pScreen); + + if (!pCurPriv->has_cursor) + return; + + if (!pScreenPriv->enabled) + return; + + LockSis(sisc); + _sisMoveCursor (pScreen, x, y); + UnlockSis(sisc); +} + +static void +_sisSetCursorColors (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + CursorPtr pCursor = pCurPriv->pCursor; + /* set foreground */ + PutSrtc (sisc, 0x17, pCursor->foreRed >> 10); + PutSrtc (sisc, 0x18, pCursor->foreGreen >> 10); + PutSrtc (sisc, 0x19, pCursor->foreBlue >> 10); + + /* set background */ + PutSrtc (sisc, 0x14, pCursor->backRed >> 10); + PutSrtc (sisc, 0x15, pCursor->backGreen >> 10); + PutSrtc (sisc, 0x16, pCursor->backBlue >> 10); +} + +static void +sisLoadCursor (ScreenPtr pScreen, int x, int y) +{ + SetupCursor(pScreen); + CursorPtr pCursor = pCurPriv->pCursor; + CursorBitsPtr bits = pCursor->bits; + int w, h; + unsigned short *ram, r; + unsigned char *msk, *mskLine, *src, *srcLine; + unsigned short m, s; + + int i, j; + int cursor_address; + int src_stride, src_width; + + CARD8 sr6; + + /* + * Lock Sis so the cursor doesn't move while we're setting it + */ + LockSis(sisc); + + pCurPriv->pCursor = pCursor; + pCurPriv->xhot = pCursor->bits->xhot; + pCurPriv->yhot = pCursor->bits->yhot; + + /* + * Stick new image into cursor memory + */ + ram = (unsigned short *) siss->cursor_base; + mskLine = (unsigned char *) bits->mask; + srcLine = (unsigned char *) bits->source; + + h = bits->height; + if (h > SIS_CURSOR_HEIGHT) + h = SIS_CURSOR_HEIGHT; + + src_stride = BitmapBytePad(bits->width); /* bytes per line */ + src_width = (bits->width + 7) >> 3; + + for (i = 0; i < SIS_CURSOR_HEIGHT; i++) { + msk = mskLine; + src = srcLine; + mskLine += src_stride; + srcLine += src_stride; + for (j = 0; j < SIS_CURSOR_WIDTH / 8; j++) { + + unsigned short m, s; + + if (i < h && j < src_width) + { + m = *msk++; + s = *src++ & m; + m = ~m; + /* mask off right side */ + if (j == src_width - 1 && (bits->width & 7)) + { + m |= 0xff << (bits->width & 7); + } + } + else + { + m = 0xff; + s = 0x00; + } + + /* + * The SIS530 HW cursor format is: source(AND) bit, + * then a mask(XOR) bit, etc. + * byte swapping in sis530 is: + * abcd ==> cdab + */ + +#define bit(a,n) (((a) >> (n)) & 0x1) + + r = ((bit(m, 0) << 7) | (bit(s, 0) << 6) | + (bit(m, 1) << 5) | (bit(s, 1) << 4) | + (bit(m, 2) << 3) | (bit(s, 2) << 2) | + (bit(m, 3) << 1) | (bit(s, 3) << 0) | + (bit(m, 4) << 15) | (bit(s, 4) << 14) | + (bit(m, 5) << 13) | (bit(s, 5) << 12) | + (bit(m, 6) << 11) | (bit(s, 6) << 10) | + (bit(m, 7) << 9) | (bit(s, 7) << 8)); + + *ram++ = r; + } + } + + /* Set new color */ + _sisSetCursorColors (pScreen); + + /* Move to new position */ + _sisMoveCursor (pScreen, x, y); + + /* Enable cursor */ + sr6 = GetSrtc (sisc, 0x6); + sr6 |= 0x40; + PutSrtc (sisc, 0x6, sr6); + + UnlockSis(sisc); +} + +static void +sisUnloadCursor (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + CARD8 sr6; + + LockSis (sisc); + + /* Disable cursor */ + sr6 = GetSrtc (sisc, 0x6); + sr6 &= ~0x40; + PutSrtc (sisc, 0x6, sr6); + PutSrtc (sisc, 0x1b, 0x00); + + UnlockSis (sisc); +} + +static Bool +sisRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) +{ + SetupCursor(pScreen); + + if (!pScreenPriv->enabled) + return TRUE; + + /* miRecolorCursor does this */ + if (pCurPriv->pCursor == pCursor) + { + if (pCursor) + { + int x, y; + + miPointerPosition (&x, &y); + sisLoadCursor (pScreen, x, y); + } + } + return TRUE; +} + +static Bool +sisUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) +{ + return TRUE; +} + +static void +sisSetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y) +{ + SetupCursor(pScreen); + + pCurPriv->pCursor = pCursor; + + if (!pScreenPriv->enabled) + return; + + if (pCursor) + sisLoadCursor (pScreen, x, y); + else + sisUnloadCursor (pScreen); +} + +miPointerSpriteFuncRec sisPointerSpriteFuncs = { + sisRealizeCursor, + sisUnrealizeCursor, + sisSetCursor, + sisMoveCursor, +}; + +static void +sisQueryBestSize (int class, + unsigned short *pwidth, unsigned short *pheight, + ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + switch (class) + { + case CursorShape: + if (*pwidth > pCurPriv->width) + *pwidth = pCurPriv->width; + if (*pheight > pCurPriv->height) + *pheight = pCurPriv->height; + if (*pwidth > pScreen->width) + *pwidth = pScreen->width; + if (*pheight > pScreen->height) + *pheight = pScreen->height; + break; + default: + fbQueryBestSize (class, pwidth, pheight, pScreen); + break; + } +} + +Bool +sisCursorInit (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + if (!siss->cursor_base) + { + pCurPriv->has_cursor = FALSE; + return FALSE; + } + + pCurPriv->width = SIS_CURSOR_WIDTH; + pCurPriv->height= SIS_CURSOR_HEIGHT; + pScreen->QueryBestSize = sisQueryBestSize; + miPointerInitialize (pScreen, + &sisPointerSpriteFuncs, + &kdPointerScreenFuncs, + FALSE); + pCurPriv->has_cursor = TRUE; + pCurPriv->pCursor = NULL; + return TRUE; +} + +void +sisCursorEnable (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + if (pCurPriv->has_cursor) + { + if (pCurPriv->pCursor) + { + int x, y; + + miPointerPosition (&x, &y); + sisLoadCursor (pScreen, x, y); + } + else + sisUnloadCursor (pScreen); + } +} + +void +sisCursorDisable (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + if (!pScreenPriv->enabled) + return; + + if (pCurPriv->has_cursor) + { + if (pCurPriv->pCursor) + { + sisUnloadCursor (pScreen); + } + } +} + +void +sisCursorFini (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + pCurPriv->pCursor = NULL; +} --- xorg-server-1.4.2.orig/hw/kdrive/sis530/sisdraw.h +++ xorg-server-1.4.2/hw/kdrive/sis530/sisdraw.h @@ -0,0 +1,180 @@ +/* + * 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. + */ + +#ifndef _SISDRAW_H_ +#define _SISDRAW_H_ + +#define SetupSis(s) KdScreenPriv(s); \ + sisCardInfo(pScreenPriv); \ + SisPtr sis = sisc->sis + +#define SIS_CMD_BITBLT (0) +#define SIS_CMD_COLOR_EXPAND (1) +#define SIS_CMD_ENH_COLOR_EXPAND (2) +#define SIS_CMD_MULTI_SCANLINE (3) +#define SIS_CMD_LINE (4) +#define SIS_CMD_TRAPEZOID (5) +#define SIS_CMD_TRANSPARENT_BITBLT (6) + +#define SIS_CMD_SRC_SCREEN (0 << 4) +#define SIS_CMD_SRC_CPU (1 << 4) + +#define SIS_CMD_PAT_FG (0 << 6) +#define SIS_CMD_PAT_PATTERN (1 << 6) +#define SIS_CMD_PAT_MONO (2 << 6) + +/* 8->15 rop */ + +#define SIS_CMD_DEC_X (0 << 16) +#define SIS_CMD_INC_X (1 << 16) + +#define SIS_CMD_DEC_Y (0 << 17) +#define SIS_CMD_INC_Y (1 << 17) + +#define SIS_CMD_RECT_CLIP_DISABLE (0 << 18) +#define SIS_CMD_RECT_CLIP_ENABLE (1 << 18) + +#define SIS_CMD_OPAQUE (0 << 20) +#define SIS_CMD_TRANSPARENT (1 << 20) + +#define SIS_CMD_RECT_CLIP_MERGE (0 << 26) +#define SIS_CMD_RECT_CLIP_DONT_MERGE (1 << 26) + +#define SIS_STAT_2D_IDLE (1 << 31) +#define SIS_STAT_3D_IDLE (1 << 30) +#define SIS_STAT_EMPTY (1 << 29) +#define SIS_STAT_CPU_BITBLT (0xf << 24) +#define SIS_STAT_ENH_COLOR_EXPAND (1 << 23) +#define SIS_STAT_AVAIL (0x1fff) + +extern CARD8 sisPatRop[16]; +extern CARD8 sisBltRop[16]; + +#define _sisSetSolidRect(sis,pix,alu,cmd) {\ + (sis)->u.general.pattern_fg = (pix); \ + (cmd) = (SIS_CMD_BITBLT | \ + SIS_CMD_SRC_SCREEN | \ + SIS_CMD_PAT_FG | \ + (sisPatRop[alu] << 8) | \ + SIS_CMD_INC_X | \ + SIS_CMD_INC_Y | \ + SIS_CMD_RECT_CLIP_DISABLE | \ + SIS_CMD_OPAQUE | \ + SIS_CMD_RECT_CLIP_DONT_MERGE); \ +} + +#define _sisClip(sis,x1,y1,x2,y2) { \ + (sis)->u.general.clip_left = (x1); \ + (sis)->u.general.clip_top = (y1); \ + (sis)->u.general.clip_right = (x2); \ + (sis)->u.general.clip_bottom = (y2); \ +} + +#define _sisRect(sis,x,y,w,h,cmd) { \ + (sis)->u.general.dst_x = (x); \ + (sis)->u.general.dst_y = (y); \ + (sis)->u.general.rect_width = (w); \ + (sis)->u.general.rect_height = (h); \ + (sis)->u.general.command = (cmd); \ +} + +#define _sisSetTransparentPlaneBlt(sis, alu, fg, cmd) { \ + (sis)->u.general.src_fg = (fg); \ + (cmd) = (SIS_CMD_ENH_COLOR_EXPAND | \ + SIS_CMD_SRC_CPU | \ + SIS_CMD_PAT_FG | \ + (sisBltRop[alu] << 8) | \ + SIS_CMD_INC_X | \ + SIS_CMD_INC_Y | \ + SIS_CMD_RECT_CLIP_DISABLE | \ + SIS_CMD_TRANSPARENT | \ + SIS_CMD_RECT_CLIP_DONT_MERGE); \ +} + +#define _sisSetOpaquePlaneBlt(sis, alu, fg, bg, cmd) { \ + (sis)->u.general.src_fg = (fg); \ + (sis)->u.general.src_bg = (bg); \ + (cmd) = (SIS_CMD_ENH_COLOR_EXPAND | \ + SIS_CMD_SRC_CPU | \ + SIS_CMD_PAT_FG | \ + (sisBltRop[alu] << 8) | \ + SIS_CMD_INC_X | \ + SIS_CMD_INC_Y | \ + SIS_CMD_RECT_CLIP_DISABLE | \ + SIS_CMD_OPAQUE | \ + SIS_CMD_RECT_CLIP_DONT_MERGE); \ +} + +#define _sisPlaneBlt(sis,x,y,w,h,cmd) _sisSolidRect(sis,x,y,w,h,cmd) + +#define _sisSetBlt(sis,alu,cmd) { \ + (sis)->u.general.src_base = (sis)->u.general.dst_base; \ + (sis)->u.general.src_pitch = (sis)->u.general.dst_pitch; \ + (cmd) = (SIS_CMD_RECT_CLIP_DONT_MERGE |\ + (sisBltRop[alu] << 8) |\ + SIS_CMD_PAT_FG |\ + SIS_CMD_SRC_SCREEN |\ + SIS_CMD_BITBLT); \ +} + +#define _sisBlt(sis,sx,sy,dx,dy,w,h,cmd) { \ + (sis)->u.general.src_x = (sx); \ + (sis)->u.general.src_y = (sy); \ + (sis)->u.general.dst_x = (dx); \ + (sis)->u.general.dst_y = (dy); \ + (sis)->u.general.rect_width = (w); \ + (sis)->u.general.rect_height = (h); \ + (sis)->u.general.command = (cmd); \ +} + +#define SIS_IE (SIS_STAT_2D_IDLE|SIS_STAT_EMPTY) + +#define _sisWaitIdleEmpty(sis) \ + while (((sis)->u.general.status & SIS_IE) != SIS_IE) + +/* + * Ok, so the Sis530 is broken -- it expects bitmaps to come MSB bit order, + * but it's willing to take them in LSB byte order. These macros + * flip bits around without flipping bytes. Instead of using a table + * and burning memory bandwidth, do them in place with the CPU. + */ + +/* The MIPS compiler automatically places these constants in registers */ +#define SisInvertBits32(v) { \ + v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \ + v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \ + v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \ +} + +#define SisInvertBits16(v) { \ + v = ((v & 0x5555) << 1) | ((v >> 1) & 0x5555); \ + v = ((v & 0x3333) << 2) | ((v >> 2) & 0x3333); \ + v = ((v & 0x0f0f) << 4) | ((v >> 4) & 0x0f0f); \ +} + +#define SisInvertBits8(v) { \ + v = ((v & 0x55) << 1) | ((v >> 1) & 0x55); \ + v = ((v & 0x33) << 2) | ((v >> 2) & 0x33); \ + v = ((v & 0x0f) << 4) | ((v >> 4) & 0x0f); \ +} + +#endif --- xorg-server-1.4.2.orig/hw/kdrive/sis530/siscmap.c +++ xorg-server-1.4.2/hw/kdrive/sis530/siscmap.c @@ -0,0 +1,64 @@ +/* + * 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_CONFIG_H +#include +#endif +#include "sis.h" + +void +sisGetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs) +{ + KdScreenPriv(pScreen); + sisCardInfo(pScreenPriv); + + LockSis (sisc); + while (ndef--) + { + _sisOutb (pdefs->pixel, sisc->io_base+SIS_DAC_INDEX_READ); + pdefs->red = _sisInb (sisc->io_base+SIS_DAC_DATA) << 10; + pdefs->green = _sisInb (sisc->io_base+SIS_DAC_DATA) << 10; + pdefs->blue = _sisInb (sisc->io_base+SIS_DAC_DATA) << 10; + pdefs++; + } + UnlockSis (sisc); +} + +void +sisPutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs) +{ + KdScreenPriv(pScreen); + sisCardInfo(pScreenPriv); + + LockSis(sisc); + _sisWaitVRetrace (sisc); + while (ndef--) + { + _sisOutb (pdefs->pixel, sisc->io_base+SIS_DAC_INDEX_WRITE); + _sisOutb (pdefs->red >> 10, sisc->io_base+SIS_DAC_DATA); + _sisOutb (pdefs->green >> 10, sisc->io_base+SIS_DAC_DATA); + _sisOutb (pdefs->blue >> 10, sisc->io_base+SIS_DAC_DATA); + pdefs++; + } + UnlockSis(sisc); +} + --- xorg-server-1.4.2.orig/hw/kdrive/sis530/sisio.c +++ xorg-server-1.4.2/hw/kdrive/sis530/sisio.c @@ -0,0 +1,30 @@ +/* + * 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_CONFIG_H +#include +#endif +#ifdef linux +#define extern +#include +#undef extern +#endif --- xorg-server-1.4.2.orig/hw/kdrive/sis530/sis.h +++ xorg-server-1.4.2/hw/kdrive/sis530/sis.h @@ -0,0 +1,1215 @@ +/* + * 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. + */ + +#ifndef _SIS_H_ +#define _SIS_H_ +#include "kdrive.h" +#include +#include +#include +#include +#include + +/* + * Linear Addressing 000 0000 - 0ff ffff (16m) + * Image data transfer 100 0000 - 100 7fff (32k) + * Empty 100 8000 - 100 81ff + * MMIO registers 100 8200 - 100 8480 + * + * We don't care about the image transfer or PCI regs, so + * this structure starts at the MMIO regs + */ + +typedef volatile CARD32 VOL32; +typedef volatile CARD16 VOL16; +typedef volatile CARD8 VOL8; + +#define SIS_MMIO_OFFSET 0x8200 + +typedef struct _sis530General { + VOL32 src_base; /* 8200 */ + VOL16 src_pitch; /* 8204 */ + VOL16 _pad0; /* 8206 */ + VOL16 src_y; /* 8208 */ + VOL16 src_x; /* 820a */ + VOL16 dst_y; /* 820c */ + VOL16 dst_x; /* 820e */ + VOL32 dst_base; /* 8210 */ + VOL16 dst_pitch; /* 8214 */ + VOL16 dst_height; /* 8216 */ + VOL16 rect_width; /* 8218 */ + VOL16 rect_height; /* 821a */ + VOL32 pattern_fg; /* 821c */ + VOL32 pattern_bg; /* 8220 */ + VOL32 src_fg; /* 8224 */ + VOL32 src_bg; /* 8228 */ + VOL8 mask[8]; /* 822c */ + VOL16 clip_left; /* 8234 */ + VOL16 clip_top; /* 8236 */ + VOL16 clip_right; /* 8238 */ + VOL16 clip_bottom; /* 823a */ + VOL32 command; /* 823c */ + VOL32 status; /* 8240 */ + VOL8 _pad1[0xbc]; /* 8244 */ + VOL8 pattern[256]; /* 8300 */ + /* 8400 */ +} SisGeneral; + +typedef struct _sis530Line { + VOL8 _pad0[8]; /* 8200 */ + VOL16 x0; /* 8208 */ + VOL16 y0; /* 820a */ + VOL16 x1; /* 820c */ + VOL16 y1; /* 820e */ + VOL32 dst_base; /* 8210 */ + VOL16 dst_pitch; /* 8214 */ + VOL16 dst_height; /* 8216 */ + VOL16 count; /* 8218 */ + VOL16 style_period; /* 821a */ + VOL32 fg; /* 821c */ + VOL32 bg; /* 8220 */ + VOL8 _pad1[8]; /* 8224 */ + VOL32 style0; /* 822c */ + VOL32 style1; /* 8228 */ + VOL16 clip_left; /* 8234 */ + VOL16 clip_top; /* 8236 */ + VOL16 clip_right; /* 8238 */ + VOL16 clip_bottom; /* 823a */ + VOL32 command; /* 823c */ + VOL32 status; /* 8240 */ + VOL8 _pad2[0xbc]; /* 8244 */ + struct { + VOL16 x; + VOL16 y; + } data[96]; /* 8300 */ + /* 8480 */ +} SisLine; + +typedef struct _sis530Transparent { + VOL32 src_base; /* 8200 */ + VOL16 src_pitch; /* 8204 */ + VOL16 _pad0; /* 8206 */ + VOL16 src_y; /* 8208 */ + VOL16 src_x; /* 820a */ + VOL16 dst_y; /* 820c */ + VOL16 dst_x; /* 820e */ + VOL32 dst_base; /* 8210 */ + VOL16 dst_pitch; /* 8214 */ + VOL16 dst_height; /* 8216 */ + VOL16 rect_width; /* 8218 */ + VOL16 rect_height; /* 821a */ + VOL32 dst_key_high; /* 821c */ + VOL32 dst_key_low; /* 8220 */ + VOL32 src_key_high; /* 8224 */ + VOL32 src_key_low; /* 8228 */ + VOL8 _pad1[8]; /* 822c */ + VOL16 clip_left; /* 8234 */ + VOL16 clip_top; /* 8236 */ + VOL16 clip_right; /* 8238 */ + VOL16 clip_bottom; /* 823a */ + VOL32 command; /* 823c */ + VOL32 status; /* 8240 */ + /* 8244 */ +} SisTransparent; + +typedef struct _sis530Multiple { + VOL8 _pad0[8]; /* 8200 */ + VOL16 count; /* 8208 */ + VOL16 y; /* 820a */ + VOL16 x0_start; /* 820c */ + VOL16 x0_end; /* 820e */ + VOL32 dst_base; /* 8210 */ + VOL16 dst_pitch; /* 8214 */ + VOL16 dst_height; /* 8216 */ + VOL8 _pad1[4]; /* 8218 */ + VOL32 fg; /* 821c */ + VOL32 bg; /* 8220 */ + VOL8 _pad2[8]; /* 8224 */ + VOL8 mask[8]; /* 822c */ + VOL16 clip_left; /* 8234 */ + VOL16 clip_top; /* 8236 */ + VOL16 clip_right; /* 8238 */ + VOL16 clip_bottom; /* 823a */ + VOL32 command; /* 823c */ + VOL32 status; /* 8240 */ + VOL16 x1_start; /* 8244 */ + VOL16 x1_end; /* 8246 */ + VOL8 _pad3[0xb8]; /* 8248 */ + VOL8 pattern[64]; /* 8300 */ + struct { + VOL16 x_start; + VOL16 y_end; + } data[80]; /* 8340 */ + /* 8480 */ +} SisMultiple; + +typedef struct _sis530Trapezoid { + VOL8 _pad0[8]; /* 8200 */ + VOL16 height; /* 8208 */ + VOL16 y; /* 820a */ + VOL16 left_x; /* 820c */ + VOL16 right_x; /* 820e */ + VOL32 dst_base; /* 8210 */ + VOL16 dst_pitch; /* 8214 */ + VOL16 dst_height; /* 8216 */ + VOL8 _pad1[4]; /* 8218 */ + VOL32 fg; /* 821c */ + VOL32 bg; /* 8220 */ + VOL8 _pad2[8]; /* 8224 */ + VOL8 mask[8]; /* 822c */ + VOL16 clip_left; /* 8234 */ + VOL16 clip_top; /* 8236 */ + VOL16 clip_right; /* 8238 */ + VOL16 clip_bottom; /* 823a */ + VOL32 command; /* 823c */ + VOL32 status; /* 8240 */ + VOL16 left_dx; /* 8244 */ + VOL16 left_dy; /* 8246 */ + VOL16 right_dx; /* 8248 */ + VOL16 right_dy; /* 824a */ + VOL32 left_error; /* 824c */ + VOL32 right_error; /* 8250 */ + /* 8254 */ +} SisTrapezoid; + +typedef struct _sisAccel { + VOL8 pad[0x80]; /* 8200 */ + VOL32 src_addr; /* 8280 */ + VOL32 dst_addr; /* 8284 */ + VOL32 pitch; /* 8288 */ + VOL32 dimension; /* 828c */ + VOL32 fg; /* 8290 */ + VOL32 bg; /* 8294 */ + + + VOL32 clip_ul; /* 82a0 */ + VOL32 clip_br; /* 82a4 */ + + VOL16 cmd; /* 82aa */ + + VOL8 pattern[256]; /* 82ac */ + +} SisAccel; + +typedef struct _sis530 { + union { + SisGeneral general; + SisLine line; + SisTransparent transparent; + SisMultiple multiple; + SisTrapezoid trapezoid; + SisAccel accel; + } u; +} SisRec, *SisPtr; + +typedef struct _sisCursor { + int width, height; + int xhot, yhot; + Bool has_cursor; + CursorPtr pCursor; +} SisCursor; + +#define SIS_CURSOR_WIDTH 64 +#define SIS_CURSOR_HEIGHT 64 + +typedef struct _sisClock { + CARD32 vclk_numerator; + BOOL vclk_divide_by_2; + CARD32 vclk_denominator; + CARD32 vclk_post_scale; + BOOL vclk_post_scale_2; + BOOL high_speed_dac; +} SisClockRec, *SisClockPtr; + +typedef struct _crtc { + + union { + struct { + CARD8 _io_address_select : 1; + CARD8 _display_ram_enable : 1; + CARD8 _clock_select : 2; + CARD8 : 1; + CARD8 _odd_even_page : 1; + CARD8 _h_sync_polarity : 1; + CARD8 _v_sync_polarity : 1; + } _misc_output_s; + CARD8 _misc_output; + } _misc_output_u; /* 3CC/3C2 */ + +#define misc_output _misc_output_u._misc_output +#define io_address_select _misc_output_u._misc_output_s._io_address_select +#define display_ram_enable _misc_output_u._misc_output_s._display_ram_enable +#define clock_select _misc_output_u._misc_output_s._clock_select +#define odd_even_page _misc_output_u._misc_output_s._odd_even_page +#define h_sync_polarity _misc_output_u._misc_output_s._h_sync_polarity +#define v_sync_polarity _misc_output_u._misc_output_s._v_sync_polarity + + CARD8 h_total_0_7; /* CR0 */ + CARD8 h_display_end_0_7; /* CR1 */ + CARD8 h_blank_start_0_7; /* CR2 */ + union { + struct { + CARD8 _h_blank_end_0_4 : 5; + CARD8 _display_skew : 2; + CARD8 : 1; + } _h_blank_end_s; + CARD8 __h_blank_end; /* CR3 */ + } _h_blank_end_u; +#define h_blank_end_0_4 _h_blank_end_u._h_blank_end_s._h_blank_end_0_4 +#define display_skew _h_blank_end_u._h_blank_end_s._display_skew +#define _h_blank_end _h_blank_end_u.__h_blank_end + + CARD8 h_sync_start_0_7; /* CR4 */ + + union { + struct { + CARD8 _h_sync_end_0_4 : 5; + CARD8 _horizontal_skew : 2; + CARD8 _h_blank_end_5 : 1; + } _h_sync_end_s; + CARD8 __h_sync_end; /* CR5 */ + } _h_sync_end_u; + +#define h_sync_end_0_4 _h_sync_end_u._h_sync_end_s._h_sync_end_0_4 +#define horizontal_skew _h_sync_end_u._h_sync_end_s._horizontal_skew +#define h_blank_end_5 _h_sync_end_u._h_sync_end_s._h_blank_end_5 +#define _h_sync_end _h_sync_end_u.__h_sync_end + + CARD8 v_total_0_7; /* CR6 */ + + union { + struct { + CARD8 _v_total_8 : 1; + CARD8 _v_display_end_8 : 1; + CARD8 _v_retrace_start_8 : 1; + CARD8 _v_blank_start_8 : 1; + CARD8 _line_compare_8 : 1; + CARD8 _v_total_9 : 1; + CARD8 _v_display_end_9 : 1; + CARD8 _v_retrace_start_9 : 1; + } _crtc_overflow_s; + CARD8 _crtc_overflow; /* CR7 */ + } _crtc_overflow_u; + +#define v_total_8 _crtc_overflow_u._crtc_overflow_s._v_total_8 +#define v_display_end_8 _crtc_overflow_u._crtc_overflow_s._v_display_end_8 +#define v_retrace_start_8 _crtc_overflow_u._crtc_overflow_s._v_retrace_start_8 +#define v_blank_start_8 _crtc_overflow_u._crtc_overflow_s._v_blank_start_8 +#define line_compare_8 _crtc_overflow_u._crtc_overflow_s._line_compare_8 +#define v_total_9 _crtc_overflow_u._crtc_overflow_s._v_total_9 +#define v_display_end_9 _crtc_overflow_u._crtc_overflow_s._v_display_end_9 +#define v_retrace_start_9 _crtc_overflow_u._crtc_overflow_s._v_retrace_start_9 +#define crtc_overflow _crtc_overflow_u._crtc_overflow + + CARD8 preset_row_scan; /* CR8 (unused) */ + + union { + struct { + CARD8 ___max_scan_line : 5; + CARD8 _v_blank_start_9 : 1; + CARD8 _line_compare_9 : 1; + CARD8 _double_scan : 1; + } _max_scan_line_s; + CARD8 __max_scan_line; /* CR9 */ + } _max_scan_line_u; + +#define max_scan_line _max_scan_line_u._max_scan_line_s.___max_scan_line +#define v_blank_start_9 _max_scan_line_u._max_scan_line_s._v_blank_start_9 +#define line_compare_9 _max_scan_line_u._max_scan_line_s._line_compare_9 +#define double_scan _max_scan_line_u._max_scan_line_s._double_scan +#define _max_scan_line _max_scan_line_u.__max_scan_line + + CARD8 cursor_start; /* CRA */ + CARD8 cursor_end; /* CRB */ + + CARD8 start_address_8_15; /* CRC */ + CARD8 start_address_0_7; /* CRD */ + + CARD8 text_cursor_15_8; /* CRE */ + CARD8 text_cursor_7_0; /* CRF */ + + CARD8 cursor_loc_high; + CARD8 cursor_loc_low; + + CARD8 v_retrace_start_0_7; /* CR10 */ + union { + struct { + CARD8 _v_retrace_end_0_3 : 4; + CARD8 _clear_v_retrace_int : 1; + CARD8 _disable_v_retrace_int : 1; + CARD8 _refresh_cycle_select : 1; + CARD8 _lock_crtc : 1; + } _v_retrace_end_s; + CARD8 __v_retrace_end; /* CR11 */ + } _v_retrace_end_u; + +#define v_retrace_end_0_3 _v_retrace_end_u._v_retrace_end_s._v_retrace_end_0_3 +#define clear_v_retrace_int _v_retrace_end_u._v_retrace_end_s._clear_v_retrace_int +#define disable_v_retrace_int _v_retrace_end_u._v_retrace_end_s._disable_v_retrace_int +#define refresh_cycle_select _v_retrace_end_u._v_retrace_end_s._refresh_cycle_select +#define lock_crtc _v_retrace_end_u._v_retrace_end_s._lock_crtc +#define _v_retrace_end _v_retrace_end_u.__v_retrace_end + + CARD8 v_display_end_0_7; /* CR12 */ + + CARD8 screen_off_0_7; /* CR13 */ + + union { + struct { + CARD8 ___underline_location : 5; + CARD8 _count_by_four : 1; + CARD8 _doubleword_mode : 1; + CARD8 : 1; + } _underline_location_s; + CARD8 __underline_location; /* CR14 */ + } _underline_location_u; + +#define underline_location _underline_location_u._underline_location_s.___underline_location +#define count_by_four _underline_location_u._underline_location_s._count_by_four +#define doubleword_mode _underline_location_u._underline_location_s._doubleword_mode +#define _underline_location _underline_location_u.__underline_location + + CARD8 v_blank_start_0_7; /* CR15 */ + CARD8 v_blank_end_0_7; /* CR16 */ + + union { + struct { + CARD8 _two_bk_cga : 1; + CARD8 _four_bk_cga : 1; + CARD8 _v_total_double : 1; + CARD8 _count_by_two : 1; + CARD8 : 1; + CARD8 _address_wrap : 1; + CARD8 _byte_mode : 1; + CARD8 _hardware_reset : 1; + } _crtc_mode_s; + CARD8 _crtc_mode; /* CR17 */ + } _crtc_mode_u; + +#define crtc_mode _crtc_mode_u._crtc_mode +#define two_bk_cga _crtc_mode_u._crtc_mode_s._two_bk_cga +#define four_bk_cga _crtc_mode_u._crtc_mode_s._four_bk_cga +#define v_total_double _crtc_mode_u._crtc_mode_s._v_total_double +#define count_by_two _crtc_mode_u._crtc_mode_s._count_by_two +#define address_wrap _crtc_mode_u._crtc_mode_s._address_wrap +#define byte_mode _crtc_mode_u._crtc_mode_s._byte_mode +#define hardware_reset _crtc_mode_u._crtc_mode_s._hardware_reset + + CARD8 line_compare_0_7; /* CR18 (unused) */ + + union { + struct { + CARD8 _graphics_mode_enable : 1; + CARD8 _attribute_byte_mda : 1; + CARD8 _line_graphics_enable : 1; + CARD8 _background_blink : 1; + CARD8 : 1; + CARD8 _pel_panning_compat : 1; + CARD8 _pixel_clock_double : 1; + CARD8 p4_p5_source_select : 1; + } _mode_control_s; + CARD8 _mode_control; + } _mode_control_u; /* AR10 */ + +#define mode_control _mode_control_u._mode_control +#define graphics_mode_enable _mode_control_u._mode_control_s._graphics_mode_enable +#define pixel_clock_double _mode_control_u._mode_control_s._pixel_clock_double + + CARD8 screen_border_color; /* AR11 */ + CARD8 enable_color_plane; /* AR12 */ + CARD8 horizontal_pixel_pan; /* AR13 */ + + union { + struct { + CARD8 _write_mode : 2; + CARD8 : 1; + CARD8 _read_mode : 1; + CARD8 _odd_even_addressing : 1; + CARD8 _shift_register_mode : 1; + CARD8 _color_mode_256 : 1; + CARD8 : 1; + } _mode_register_s; + CARD8 _mode_register; + } _mode_register_u; /* GR5 */ + +#define mode_register _mode_register_u._mode_register +#define color_mode_256 _mode_register_u._mode_register_s._color_mode_256 +#define odd_even_addressing _mode_register_u._mode_register_s._odd_even_addressing + + union { + struct { + CARD8 _graphics_enable : 1; + CARD8 _chain_odd_even : 1; + CARD8 _memory_address_select : 2; + CARD8 : 4; + } _misc_register_s; + CARD8 _misc_register; + } _misc_register_u; /* GR6 */ + +#define misc_register _misc_register_u._misc_register +#define graphics_enable _misc_register_u._misc_register_s._graphics_enable +#define chain_odd_even _misc_register_u._misc_register_s._chain_odd_even +#define memory_address_select _misc_register_u._misc_register_s._memory_address_select + + CARD8 color_dont_care; /* GR7 */ + + union { + struct { + CARD8 _dot_clock_8_9 : 1; + CARD8 : 1; + CARD8 _shifter_load_16 : 1; + CARD8 _dot_clock_divide_2 : 1; + CARD8 _shifter_load_32 : 1; + CARD8 _display_off : 1; + CARD8 : 2; + } _clock_mode_s; + CARD8 _clock_mode; + } _clock_mode_u; /* SR1 */ + +#define clock_mode _clock_mode_u._clock_mode +#define dot_clock_8_9 _clock_mode_u._clock_mode_s._dot_clock_8_9 +#define shifter_load_16 _clock_mode_u._clock_mode_s._shifter_load_16 +#define dot_clock_divide_2 _clock_mode_u._clock_mode_s._dot_clock_divide_2 +#define shifter_load_32 _clock_mode_u._clock_mode_s._shifter_load_32 +#define display_off _clock_mode_u._clock_mode_s._display_off + + CARD8 color_plane_w_enable; /* SR2 */ + + union { + struct { + CARD8 : 1; + CARD8 _extended_memory_size : 1; + CARD8 _odd_even_disable : 1; + CARD8 _chain_4_enable : 1; + CARD8 : 4; + } _memory_mode_s; + CARD8 _memory_mode; + } _memory_mode_u; /* SR4 */ + +#define memory_mode _memory_mode_u._memory_mode +#define extended_memory_sz _memory_mode_u._memory_mode_s._extended_memory_size +#define odd_even_disable _memory_mode_u._memory_mode_s._odd_even_disable +#define chain_4_enable _memory_mode_u._memory_mode_s._chain_4_enable + + union { + struct { + CARD8 _enhanced_text_mode : 1; + CARD8 _enhanced_graphics_mode : 1; + CARD8 _graphics_mode_32k : 1; + CARD8 _graphics_mode_64k : 1; + CARD8 _graphics_mode_true : 1; + CARD8 _graphics_mode_interlaced: 1; + CARD8 _graphics_mode_hw_cursor: 1; + CARD8 _graphics_mode_linear : 1; + } _graphics_mode_s; + CARD8 _graphics_mode; + } _graphics_mode_u; /* SR6 */ + +#define graphics_mode _graphics_mode_u._graphics_mode +#define enhanced_text_mode _graphics_mode_u._graphics_mode_s._enhanced_text_mode +#define enhanced_graphics_mode _graphics_mode_u._graphics_mode_s._enhanced_graphics_mode +#define graphics_mode_32k _graphics_mode_u._graphics_mode_s._graphics_mode_32k +#define graphics_mode_64k _graphics_mode_u._graphics_mode_s._graphics_mode_64k +#define graphics_mode_true _graphics_mode_u._graphics_mode_s._graphics_mode_true +#define graphics_mode_interlaced _graphics_mode_u._graphics_mode_s._graphics_mode_interlaced +#define graphics_mode_hw_cursor _graphics_mode_u._graphics_mode_s._graphics_mode_hw_cursor +#define graphics_mode_linear _graphics_mode_u._graphics_mode_s._graphics_mode_linear + + union { + struct { + CARD8 _external_dac_reference : 1; + CARD8 _high_speed_dac_0 : 1; + CARD8 _direct_color_24bit : 1; + CARD8 _multi_line_prefetch : 1; + CARD8 _extended_video_div_2 : 1; + CARD8 _ramdac_power_save : 1; + CARD8 : 1; + CARD8 _merge_video_fifo : 1; + } _misc_control_0_s; + CARD8 _misc_control_0; + } _misc_control_0_u; /* SR7 */ + +#define misc_control_0 _misc_control_0_u._misc_control_0 +#define external_dac_reference _misc_control_0_u._misc_control_0_s._external_dac_reference +#define high_speed_dac_0 _misc_control_0_u._misc_control_0_s._high_speed_dac_0 +#define direct_color_24bit _misc_control_0_u._misc_control_0_s._direct_color_24bit +#define multi_line_prefetch _misc_control_0_u._misc_control_0_s._multi_line_prefetch +#define extended_video_div_2 _misc_control_0_u._misc_control_0_s._extended_video_div_2 +#define ramdac_power_save _misc_control_0_u._misc_control_0_s._ramdac_power_save +#define merge_video_fifo _misc_control_0_u._misc_control_0_s._merge_video_fifo + + union { + struct { + CARD8 _crt_engine_threshold_high_0_3 : 4; + CARD8 _crt_cpu_threshold_low_0_3 : 4; + } _crt_cpu_threshold_control_0_s; + CARD8 _crt_cpu_threshold_control_0; + } _crt_cpu_threshold_control_0_u; /* SR8 */ + +#define crt_cpu_threshold_control_0 _crt_cpu_threshold_control_0_u._crt_cpu_threshold_control_0 +#define crt_engine_threshold_high_0_3 _crt_cpu_threshold_control_0_u._crt_cpu_threshold_control_0_s._crt_engine_threshold_high_0_3 +#define crt_cpu_threshold_low_0_3 _crt_cpu_threshold_control_0_u._crt_cpu_threshold_control_0_s._crt_cpu_threshold_low_0_3 + + union { + struct { + CARD8 _crt_cpu_threshold_high_0_3 : 4; + CARD8 _ascii_attribute_threshold_0_2 : 3; + CARD8 _true_color_32bpp : 1; + } _crt_cpu_threshold_control_1_s; + CARD8 _crt_cpu_threshold_control_1; + } _crt_cpu_threshold_control_1_u; /* SR9 */ + +#define crt_cpu_threshold_control_1 _crt_cpu_threshold_control_1_u._crt_cpu_threshold_control_1 +#define crt_cpu_threshold_high_0_3 _crt_cpu_threshold_control_1_u._crt_cpu_threshold_control_1_s._crt_cpu_threshold_high_0_3 +#define ascii_attribute_threshold_0_2 _crt_cpu_threshold_control_1_u._crt_cpu_threshold_control_1_s._ascii_attribute_threshold_0_2 +#define true_color_32bpp _crt_cpu_threshold_control_1_u._crt_cpu_threshold_control_1_s._true_color_32bpp + + union { + struct { + CARD8 _v_total_10 : 1; + CARD8 _v_display_end_10 : 1; + CARD8 _v_blank_start_10 : 1; + CARD8 _v_retrace_start_10 : 1; + CARD8 _screen_off_8_11 : 4; + } _extended_crt_overflow_s; + CARD8 _extended_crt_overflow; + } _extended_crt_overflow_u; /* SRA */ + +#define extended_crt_overflow _extended_crt_overflow_u._extended_crt_overflow +#define v_total_10 _extended_crt_overflow_u._extended_crt_overflow_s._v_total_10 +#define v_display_end_10 _extended_crt_overflow_u._extended_crt_overflow_s._v_display_end_10 +#define v_blank_start_10 _extended_crt_overflow_u._extended_crt_overflow_s._v_blank_start_10 +#define v_retrace_start_10 _extended_crt_overflow_u._extended_crt_overflow_s._v_retrace_start_10 +#define screen_off_8_11 _extended_crt_overflow_u._extended_crt_overflow_s._screen_off_8_11 + + union { + struct { + CARD8 _cpu_bitblt_enable : 1; /* enable CPU bitblt */ + CARD8 _packed_16_color_enable : 1; /* 2 pixels per byte? */ + CARD8 _io_gating : 1; /* when write buffer not empty */ + CARD8 _dual_segment_enable : 1; /* ? */ + CARD8 _true_color_modulation : 1; /* ? */ + CARD8 _memory_mapped_mode : 2; /* mmio enable */ + CARD8 _true_color_order : 1; /* 0: RGB 1: BGR */ + } _misc_control_1_s; + CARD8 _misc_control_1; /* SRB */ + } _misc_control_1_u; + +#define misc_control_1 _misc_control_1_u._misc_control_1 +#define cpu_bitblt_enable _misc_control_1_u._misc_control_1_s._cpu_bitblt_enable +#define memory_mapped_mode _misc_control_1_u._misc_control_1_s._memory_mapped_mode +#define true_color_modulation _misc_control_1_u._misc_control_1_s._true_color_modulation +#define true_color_order _misc_control_1_u._misc_control_1_s._true_color_order + + union { + struct { + CARD8 _sync_reset_enable : 1; + CARD8 _memory_configuration : 3; +#define SIS_MEMORY_CONFIG_1M_1BANK 0 +#define SIS_MEMORY_CONFIG_2M_2BANK 1 +#define SIS_MEMORY_CONFIG_4M_2BANK 2 +#define SIS_MEMORY_CONFIG_2M_1BANK 5 +#define SIS_MEMORY_CONFIG_4M_1BANK 6 +#define SIS_MEMORY_CONFIG_8M_2BANK 7 + CARD8 _test_mode_enable : 1; + CARD8 _read_ahead_enable : 1; + CARD8 _text_mode_16bit_enable : 1; + CARD8 _graphics_mode_32bit_enable : 1; + } _misc_control_2_s; + CARD8 _misc_control_2; + } _misc_control_2_u; /* SRC */ + +#define misc_control_2 _misc_control_2_u._misc_control_2 +#define sync_reset_enable _misc_control_2_u._misc_control_2_s._sync_reset_enable +#define memory_configuration _misc_control_2_u._misc_control_2_s._memory_configuration +#define test_mode_enable _misc_control_2_u._misc_control_2_s._test_mode_enable +#define read_ahead_enable _misc_control_2_u._misc_control_2_s._read_ahead_enable +#define text_mode_16bit_enable _misc_control_2_u._misc_control_2_s._text_mode_16bit_enable +#define graphics_mode_32bit_enable _misc_control_2_u._misc_control_2_s._graphics_mode_32bit_enable + + union ddc_and_power_control_u { + struct { + CARD8 _ddc_clk_programming : 1; + CARD8 _ddc_data_programming : 1; + CARD8 : 1; + CARD8 _acpi_enable : 1; + CARD8 _kbd_cursor_activate : 1; + CARD8 _video_memory_activate : 1; + CARD8 _vga_standby : 1; + CARD8 _vga_suspend : 1; + } _ddc_and_power_control_s; + CARD8 _ddc_and_power_control; + } _ddc_and_power_control_u; /* SR11 */ + +#define ddc_and_power_control _ddc_and_power_control_u._ddc_and_power_control +#define ddc_clk_programming _ddc_and_power_control_u._ddc_and_power_control_s._ddc_clk_programming +#define ddc_data_programming _ddc_and_power_control_u._ddc_and_power_control_s._ddc_data_programming +#define acpi_enable _ddc_and_power_control_u._ddc_and_power_control_s._acpi_enable +#define kbd_cursor_activate _ddc_and_power_control_u._ddc_and_power_control_s._kbd_cursor_activate +#define video_memory_activate _ddc_and_power_control_u._ddc_and_power_control_s._video_memory_activate +#define vga_standby _ddc_and_power_control_u._ddc_and_power_control_s._vga_standby +#define vga_suspend _ddc_and_power_control_u._ddc_and_power_control_s._vga_suspend + + union { + struct { + CARD8 _h_total_8 : 1; + CARD8 _h_display_end_8 : 1; + CARD8 _h_blank_start_8 : 1; + CARD8 _h_sync_start_8 : 1; + CARD8 _h_blank_end_6 : 1; + CARD8 _h_retrace_skew : 3; + } _extended_horizontal_overflow_s; + CARD8 _extended_horizontal_overflow; + } _extended_horizontal_overflow_u; /* SR12 */ +#define extended_horizontal_overflow _extended_horizontal_overflow_u._extended_horizontal_overflow +#define h_total_8 _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_total_8 +#define h_display_end_8 _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_display_end_8 +#define h_blank_start_8 _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_blank_start_8 +#define h_sync_start_8 _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_sync_start_8 +#define h_blank_end_6 _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_blank_end_6 +#define h_retrace_skew _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_retrace_skew + + union { + struct { + CARD8 : 6; + CARD8 _vclk_post_scale_2 : 1; + CARD8 _mclk_post_scale_2 : 1; + } _extended_clock_generator_s; + CARD8 _extended_clock_generator; + } _extended_clock_generator_u; /* SR13 */ + +#define extended_clock_generator _extended_clock_generator_u._extended_clock_generator +#define vclk_post_scale_2 _extended_clock_generator_u._extended_clock_generator_s._vclk_post_scale_2 +#define mclk_post_scale_2 _extended_clock_generator_u._extended_clock_generator_s._mclk_post_scale_2 + + CARD8 cursor_0_red; /* SR14 */ + CARD8 cursor_0_green; /* SR15 */ + CARD8 cursor_0_blue; /* SR16 */ + + CARD8 cursor_1_red; /* SR17 */ + CARD8 cursor_1_green; /* SR18 */ + CARD8 cursor_1_blue; /* SR19 */ + + CARD8 cursor_h_start_0_7; /* SR1A */ + union { + struct { + CARD8 _cursor_h_start_8_11 : 4; + CARD8 : 3; + CARD8 _cursor_mmio_enable : 1; + } _cusor_h_start_1_s; + CARD8 _cursor_h_start_1; + } _cursor_h_start_1_u; /* SR1B */ + +#define cursor_h_start_1 _cursor_h_start_1_u._cursor_h_start_1 +#define cursor_h_start_8_11 _cursor_h_start_1_u._cursor_h_start_1_s._cursor_h_start_8_11 + + CARD8 cursor_h_preset_0_5; /* SR1C */ + + CARD8 cursor_v_start_0_7; /* SR1D */ + + union { + struct { + CARD8 _cursor_v_start_8_10 : 3; + CARD8 _cursor_side_pattern : 1; + CARD8 _cursor_pattern : 4; + } _cusor_v_start_1_s; + CARD8 _cursor_v_start_1; + } _cursor_v_start_1_u; /* SR1E */ + +#define cursor_v_start_1 _cursor_v_start_1_u._cursor_v_start_1 + + CARD8 cursor_v_preset_0_5; /* SR1F */ + + CARD8 linear_base_19_26; /* SR20 */ + + union { + struct { + CARD8 _linear_base_27_31 : 5; + CARD8 _linear_aperture : 3; +#define SIS_LINEAR_APERTURE_512K 0 +#define SIS_LINEAR_APERTURE_1M 1 +#define SIS_LINEAR_APERTURE_2M 2 +#define SIS_LINEAR_APERTURE_4M 3 +#define SIS_LINEAR_APERTURE_8M 4 + } _linear_base_1_s; + CARD8 _linear_base_1; + } _linear_base_1_u; /* SR21 */ + +#define linear_base_1 _linear_base_1_u._linear_base_1 +#define linear_base_27_31 _linear_base_1_u._linear_base_1_s._linear_base_27_31 +#define linear_aperture _linear_base_1_u._linear_base_1_s._linear_aperture + + union { + struct { + CARD8 _screen_start_addr_20 : 1; + CARD8 : 3; + CARD8 _continuous_mem_access : 1; + CARD8 : 1; + CARD8 _power_down_dac : 1; + CARD8 : 1; + } _graphics_engine_0_s; + CARD8 _graphics_engine_0; + } _graphics_engine_0_u; /* SR26 */ + +#define graphics_engine_0 _graphics_engine_0_u._graphics_engine_0 + + + union { + struct { + CARD8 _screen_start_addr_16_19: 4; + CARD8 _logical_screen_width : 2; +#define SIS_LOG_SCREEN_WIDTH_1024 0 +#define SIS_LOG_SCREEN_WIDTH_2048 1 +#define SIS_LOG_SCREEN_WIDTH_4096 2 + CARD8 _graphics_prog_enable : 1; + CARD8 _turbo_queue_enable : 1; + } _graphics_engine_1_s; + CARD8 _graphics_engine_1; + } _graphics_engine_1_u; /* SR27 */ + +#define graphics_engine_1 _graphics_engine_1_u._graphics_engine_1 +#define screen_start_addr_16_19 _graphics_engine_1_u._graphics_engine_1_s._screen_start_addr_16_19 +#define logical_screen_width _graphics_engine_1_u._graphics_engine_1_s._logical_screen_width +#define graphics_prog_enable _graphics_engine_1_u._graphics_engine_1_s._graphics_prog_enable +#define turbo_queue_enable _graphics_engine_1_u._graphics_engine_1_s._turbo_queue_enable + + + union { + struct { + CARD8 _mclk_numerator : 7; + CARD8 _mclk_divide_by_2 : 1; + } _internal_mclk_0_s; + CARD8 _internal_mclk_0; + } _internal_mclk_0_u; /* SR28 */ + +#define internal_mclk_0 _internal_mclk_0_u._internal_mclk_0 +#define mclk_numerator _internal_mclk_0_u._internal_mclk_0_s._mclk_numerator +#define mclk_divide_by_2 _internal_mclk_0_u._internal_mclk_0_s._mclk_divide_by_2 + + union { + struct { + CARD8 _mclk_denominator : 5; + CARD8 _mclk_post_scale : 2; +#define SIS_MCLK_POST_SCALE_1 0 +#define SIS_MCLK_POST_SCALE_2 1 +#define SIS_MCLK_POST_SCALE_3 2 +#define SIS_MCLK_POST_SCALE_4 3 + CARD8 _mclk_vco_gain : 1; + } _internal_mclk_1_s; + CARD8 _internal_mclk_1; + } _internal_mclk_1_u; /* SR29 */ + +#define internal_mclk_1 _internal_mclk_1_u._internal_mclk_1 +#define mclk_denominator _internal_mclk_1_u._internal_mclk_1_s._mclk_denominator +#define mclk_post_scale _internal_mclk_1_u._internal_mclk_1_s._mclk_post_scale +#define mclk_vco_gain _internal_mclk_1_u._internal_mclk_1_s._mclk_vco_gain + + union { + struct { + CARD8 _vclk_numerator : 7; + CARD8 _vclk_divide_by_2 : 1; + } _internal_vclk_0_s; + CARD8 _internal_vclk_0; + } _internal_vclk_0_u; /* SR2A */ + +#define internal_vclk_0 _internal_vclk_0_u._internal_vclk_0 +#define vclk_numerator _internal_vclk_0_u._internal_vclk_0_s._vclk_numerator +#define vclk_divide_by_2 _internal_vclk_0_u._internal_vclk_0_s._vclk_divide_by_2 + + union { + struct { + CARD8 _vclk_denominator : 5; + CARD8 _vclk_post_scale : 2; +#define SIS_VCLK_POST_SCALE_1 0 +#define SIS_VCLK_POST_SCALE_2 1 +#define SIS_VCLK_POST_SCALE_3 2 +#define SIS_VCLK_POST_SCALE_4 3 + CARD8 _vclk_vco_gain : 1; + } _internal_vclk_1_s; + CARD8 _internal_vclk_1; + } _internal_vclk_1_u; /* SR2B */ + +#define internal_vclk_1 _internal_vclk_1_u._internal_vclk_1 +#define vclk_denominator _internal_vclk_1_u._internal_vclk_1_s._vclk_denominator +#define vclk_post_scale _internal_vclk_1_u._internal_vclk_1_s._vclk_post_scale +#define vclk_vco_gain _internal_vclk_1_u._internal_vclk_1_s._vclk_vco_gain + + union { + struct { + CARD8 _extended_clock_select : 2; +#define SIS_CLOCK_SELECT_INTERNAL 0 +#define SIS_CLOCK_SELECT_25MHZ 1 +#define SIS_CLOCK_SELECT_28MHZ 2 + CARD8 _disable_line_compare : 1; + CARD8 _disable_pci_read_t_o : 1; + CARD8 _cursor_start_addr_18_21: 4; + } _misc_control_7_s; + CARD8 _misc_control_7; + } _misc_control_7_u; /* SR38 */ + +#define misc_control_7 _misc_control_7_u._misc_control_7 +#define extended_clock_select _misc_control_7_u._misc_control_7_s._extended_clock_select +#define disable_line_compare _misc_control_7_u._misc_control_7_s._disable_line_compare +#define disable_pci_read_t_o _misc_control_7_u._misc_control_7_s._disable_pci_read_t_o +#define cursor_start_addr_18_21 _misc_control_7_u._misc_control_7_s._cursor_start_addr_18_21 + + union { + struct { + CARD8 _high_speed_dclk : 1; + CARD8 _sgram_block_write : 1; + CARD8 _cursor_start_addr_22 : 1; + CARD8 _dram_texture_read : 1; + CARD8 _sgram_16mb : 1; + CARD8 _agp_signal_delay : 2; + CARD8 _dclk_off : 1; + } _misc_control_11_s; + CARD8 _misc_control_11; + } _misc_control_11_u; /* SR3E */ + +#define misc_control_11 _misc_control_11_u._misc_control_11 +#define high_speed_dclk _misc_control_11_u._misc_control_11_s._high_speed_dclk +#define sgram_block_write _misc_control_11_u._misc_control_11_s.__sgram_block_write +#define cursor_start_addr_22 _misc_control_11_u._misc_control_11_s._cursor_start_addr_22 +#define dram_texture_read _misc_control_11_u._misc_control_11_s._dram_texture_read +#define sgram_16mb _misc_control_11_u._misc_control_11_s._sgram_16mb +#define agp_signal_delay _misc_control_11_u._misc_control_11_s._agp_signal_delay +#define dclk_off _misc_control_11_u._misc_control_11_s._dclk_off + + union { + struct { + CARD8 : 1; + CARD8 _flat_panel_low_enable : 1; + CARD8 _crt_cpu_threshold_low_4: 1; + CARD8 _crt_engine_threshold_high_4: 1; + CARD8 _crt_cpu_threshold_high_4 : 1; + CARD8 _crt_threshold_full_control : 2; +#define SIS_CRT_32_STAGE_THRESHOLD 0 +#define SIS_CRT_64_STAGE_THRESHOLD 1 +#define SIS_CRT_63_STAGE_THRESHOLD 2 +#define SIS_CRT_256_STAGE_THRESHOLD 3 + CARD8 _high_speed_dac_1 : 1; + } _misc_control_12_s; + CARD8 _misc_control_12; + } _misc_control_12_u; /* SR3F */ +#define misc_control_12 _misc_control_12_u._misc_control_12 +#define flat_panel_low_enable _misc_control_12_u._misc_control_12_s._flat_panel_low_enable +#define crt_cpu_threshold_low_4 _misc_control_12_u._misc_control_12_s._crt_cpu_threshold_low_4 +#define crt_engine_threshold_high_4 _misc_control_12_u._misc_control_12_s._crt_engine_threshold_high_4 +#define crt_cpu_threshold_high_4 _misc_control_12_u._misc_control_12_s._crt_cpu_threshold_high_4 +#define crt_threshold_full_control _misc_control_12_u._misc_control_12_s._crt_threshold_full_control +#define high_speed_dac_1 _misc_control_12_u._misc_control_12_s._high_speed_dac_1 + + /* computed values */ + CARD16 ge_screen_pitch; + CARD8 bits_per_pixel; + CARD8 depth; + CARD8 double_pixel_mode; + CARD16 pixel_width; +} SisCrtc; + +#define crtc_v_total(crtc) ((crtc)->v_total_0_7 | \ + ((crtc)->v_total_8 << 8) | \ + ((crtc)->v_total_9 << 9) | \ + ((crtc)->v_total_10 << 10)) + +#define crtc_set_v_total(crtc,v) { \ + ((crtc))->v_total_0_7 = (v); \ + ((crtc))->v_total_8 = (v) >> 8; \ + ((crtc))->v_total_9 = (v) >> 9; \ + ((crtc))->v_total_10 = (v) >> 10; \ +} + +#define crtc_v_display_end(crtc) ((crtc)->v_display_end_0_7 | \ + ((crtc)->v_display_end_8 << 8) | \ + ((crtc)->v_display_end_9 << 9) | \ + ((crtc)->v_display_end_10 << 10)) + +#define crtc_set_v_display_end(crtc,v) {\ + ((crtc))->v_display_end_0_7 = (v); \ + ((crtc))->v_display_end_8 = (v) >> 8; \ + ((crtc))->v_display_end_9 = (v) >> 9; \ + ((crtc))->v_display_end_10 = (v) >> 10; \ +} + +#define crtc_v_retrace_start(crtc) ((crtc)->v_retrace_start_0_7 | \ + ((crtc)->v_retrace_start_8 << 8) | \ + ((crtc)->v_retrace_start_9 << 9) | \ + ((crtc)->v_retrace_start_10 << 10)) + +#define crtc_set_v_retrace_start(crtc,v) {\ + ((crtc))->v_retrace_start_0_7 = (v); \ + ((crtc))->v_retrace_start_8 = (v) >> 8; \ + ((crtc))->v_retrace_start_9 = (v) >> 9; \ + ((crtc))->v_retrace_start_10 = (v) >> 10; \ +} + +#define crtc_v_blank_start(crtc) ((crtc)->v_blank_start_0_7 | \ + ((crtc)->v_blank_start_8 << 8) | \ + ((crtc)->v_blank_start_9 << 9) | \ + ((crtc)->v_blank_start_10 << 10)) + +#define crtc_set_v_blank_start(crtc,v) {\ + ((crtc))->v_blank_start_0_7 = (v); \ + ((crtc))->v_blank_start_8 = (v) >> 8; \ + ((crtc))->v_blank_start_9 = (v) >> 9; \ + ((crtc))->v_blank_start_10 = (v) >> 10; \ +} + +#define crtc_h_total(crtc) ((crtc)->h_total_0_7 | \ + ((crtc)->h_total_8 << 8)) + +#define crtc_set_h_total(crtc,v) {\ + ((crtc))->h_total_0_7 = (v); \ + ((crtc))->h_total_8 = (v) >> 8; \ +} + +#define crtc_h_display_end(crtc) ((crtc)->h_display_end_0_7 | \ + ((crtc)->h_display_end_8 << 8)) + +#define crtc_set_h_display_end(crtc,v) {\ + ((crtc))->h_display_end_0_7 = (v); \ + ((crtc))->h_display_end_8 = (v) >> 8; \ +} + +#define crtc_h_blank_start(crtc) ((crtc)->h_blank_start_0_7 | \ + ((crtc)->h_blank_start_8 << 8)) + +#define crtc_set_h_blank_start(crtc,v) {\ + ((crtc))->h_blank_start_0_7 = (v); \ + ((crtc))->h_blank_start_8 = (v) >> 8; \ +} + +#define crtc_h_blank_end(crtc) ((crtc)->h_blank_end_0_4 | \ + ((crtc)->h_blank_end_5 << 5)) + +#define crtc_set_h_blank_end(crtc,v) {\ + ((crtc))->h_blank_end_0_4 = (v); \ + ((crtc))->h_blank_end_5 = (v) >> 5; \ +} + +#define crtc_h_sync_start(crtc) ((crtc)->h_sync_start_0_7 | \ + ((crtc)->h_sync_start_8 << 8)) + +#define crtc_set_h_sync_start(crtc,v) {\ + ((crtc))->h_sync_start_0_7 = (v); \ + ((crtc))->h_sync_start_8 = (v) >> 8; \ +} + +#define crtc_h_sync_end(crtc) ((crtc)->h_sync_end_0_4) + +#define crtc_set_h_sync_end(crtc,v) {\ + ((crtc))->h_sync_end_0_4 = (v); \ +} + +#define crtc_screen_off(crtc) ((crtc)->screen_off_0_7 | \ + ((crtc)->screen_off_8_11 << 8)) + +#define crtc_set_screen_off(crtc,v) {\ + ((crtc))->screen_off_0_7 = (v); \ + ((crtc))->screen_off_8_11 = (v) >> 8; \ +} + +#define crtc_ge_screen_width(crtc) ((crtc)->ge_screen_width_0_1 | \ + ((crtc)->ge_screen_width_2 << 2)) + +#define crtc_set_ge_screen_width(crtc,v) { \ + (crtc)->ge_screen_width_0_1 = (v); \ + (crtc)->ge_screen_width_2 = (v) >> 2; \ +} + +#define crtc_h_start_fifo_fetch(crtc) ((crtc)->h_start_fifo_fetch_0_7 | \ + ((crtc)->h_start_fifo_fetch_8 << 8)) + +#define crtc_set_h_start_fifo_fetch(crtc,v) {\ + (crtc)->h_start_fifo_fetch_0_7 = (v); \ + (crtc)->h_start_fifo_fetch_8 = (v) >> 8; \ +} + +#define crtc_start_address(crtc) ((crtc)->start_address_0_7 | \ + ((crtc)->start_address_8_15 << 8) | \ + ((crtc)->start_address_16_19 << 16)) + +#define crtc_set_start_address(crtc,v) {\ + (crtc)->start_address_0_7 = (v); \ + (crtc)->start_address_8_15 = (v) >> 8; \ + (crtc)->start_address_16_19 = (v) >> 16; \ +} + +#define crtc_line_compare(crtc) ((crtc)->line_compare_0_7 | \ + ((crtc)->line_compare_8 << 8) | \ + ((crtc)->line_compare_9 << 9) | \ + ((crtc)->line_compare_10 << 10)) + +#define crtc_set_line_compare(crtc,v) { \ + ((crtc))->line_compare_0_7 = (v); \ + ((crtc))->line_compare_8 = (v) >> 8; \ + ((crtc))->line_compare_9 = (v) >> 9; \ + ((crtc))->line_compare_10 = (v) >> 10; \ +} + +#define crtc_set_cursor_start_addr(crtc,v) { \ + (crtc)->cursor_start_addr_18_21 = (v) >> 18; \ + (crtc)->cursor_start_addr_22 = (v) >> 22; \ +} + +#define _sisOutb(v,r) outb(v,r) +#define _sisInb(r) inb(r) + +#define SIS_DAC_INDEX_READ 0x47 +#define SIS_DAC_INDEX_WRITE 0x48 +#define SIS_DAC_DATA 0x49 + +#define GetCrtc(sisc,i) _sisReadIndexRegister ((sisc)->io_base+0x54,i) +#define PutCrtc(sisc,i,v) _sisWriteIndexRegister ((sisc)->io_base+0x54,i,v) + +#define GetSrtc(sisc,i) _sisReadIndexRegister ((sisc)->io_base+0x44,i) +#define PutSrtc(sisc,i,v) _sisWriteIndexRegister ((sisc)->io_base+0x44,i,v) + +#define GetArtc(sisc,i) _sisReadArtc ((sisc)->io_base+0x40,i) +#define PutArtc(sisc,i,v) _sisWriteArtc ((sisc)->io_base+0x40,i,v) + +#define GetGrtc(sisc,i) _sisReadIndexRegister ((sisc)->io_base+0x4e,i) +#define PutGrtc(sisc,i,v) _sisWriteIndexRegister ((sisc)->io_base+0x4e,i,v) + +#define _sisWaitVRetrace(sisc) + +#define LockSis(sisc) +#define UnlockSis(sisc) + +typedef struct _sisTiming { + /* label */ + int horizontal; + int vertical; + int rate; + /* horizontal timing */ + int hfp; /* front porch */ + int hbp; /* back porch */ + int hblank; /* blanking */ + /* vertical timing */ + int vfp; /* front porch */ + int vbp; /* back porch */ + int vblank; /* blanking */ +} SisTiming; + +#define SIS_TEXT_SAVE (64*1024) + +typedef struct _sisSave { + CARD8 srb; + CARD8 sr5; + SisCrtc crtc; + CARD8 text_save[SIS_TEXT_SAVE]; +} SisSave; + +typedef struct _sisCardInfo { + SisPtr sis; + int memory; + CARD8 *frameBuffer; + CARD8 *registers; + VOL32 *cpu_bitblt; + CARD32 io_base; + SisSave save; +} SisCardInfo; + +typedef struct _sisScreenInfo { + CARD8 *cursor_base; + CARD32 cursor_off; + CARD8 *expand; + CARD32 expand_off; + int expand_len; + SisCursor cursor; +} SisScreenInfo; + +#define getSisCardInfo(kd) ((SisCardInfo *) ((kd)->card->driver)) +#define sisCardInfo(kd) SisCardInfo *sisc = getSisCardInfo(kd) + +#define getSisScreenInfo(kd) ((SisScreenInfo *) ((kd)->screen->driver)) +#define sisScreenInfo(kd) SisScreenInfo *siss = getSisScreenInfo(kd) + +Bool sisCardInit (KdCardInfo *); +Bool sisScreenInit (KdScreenInfo *); +Bool sisEnable (ScreenPtr pScreen); +void sisDisable (ScreenPtr pScreen); +void sisFini (ScreenPtr pScreen); + +Bool sisCursorInit (ScreenPtr pScreen); +void sisCursorEnable (ScreenPtr pScreen); +void sisCursorDisable (ScreenPtr pScreen); +void sisCursorFini (ScreenPtr pScreen); +void sisRecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdefs); + +Bool sisDrawInit (ScreenPtr pScreen); +void sisDrawEnable (ScreenPtr pScreen); +void sisDrawSync (ScreenPtr pScreen); +void sisDrawDisable (ScreenPtr pScreen); +void sisDrawFini (ScreenPtr pScreen); + +void sisGetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs); +void sisPutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs); + +void SISInitCard (KdCardAttr *attr); + +CARD8 _sisReadIndexRegister (CARD32 base, CARD8 index); +void _sisWriteIndexRegister (CARD32 base, CARD8 index, CARD8 value); +CARD8 _sisReadArtc (CARD32 base, CARD8 index); +void _sisWriteArtc (CARD32 base, CARD8 index, CARD8 value); + +extern KdCardFuncs sisFuncs; + +/* + * sisclock.c + */ +void +sisGetClock (unsigned long clock, SisCrtc *crtc); + +void +sisEngThresh (SisCrtc *crtc, unsigned long vclk, int bpp); + +/* + * siscurs.c + */ + +Bool +sisCursorInit (ScreenPtr pScreen); + +void +sisCursorEnable (ScreenPtr pScreen); + +void +sisCursorDisable (ScreenPtr pScreen); + +void +sisCursorFini (ScreenPtr pScreen); + +/* sisdraw.c */ +Bool +sisDrawInit (ScreenPtr pScreen); + +void +sisDrawEnable (ScreenPtr pScreen); + +void +sisDrawDisable (ScreenPtr pScreen); + +void +sisDrawFini (ScreenPtr pScreen); + +#endif /* _SIS_H_ */ --- xorg-server-1.4.2.orig/hw/kdrive/sis530/sis.c +++ xorg-server-1.4.2/hw/kdrive/sis530/sis.c @@ -0,0 +1,921 @@ +/* + * 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_CONFIG_H +#include +#endif +#include "sis.h" + +#define MAX_FB_SIZE (4096 * 1024) + +#define MMIO_SIZE (64 * 1024) + +int sisMemoryTable[8] = { + 1, 2, 4, 0, 0, 2, 4, 8 +}; + +Bool +sisCardInit (KdCardInfo *card) +{ + SisCardInfo *sisc; + SisPtr sis; + int size; + CARD8 *registers; + CARD8 *temp_buffer; + CARD8 save_sr5; + + sisc = (SisCardInfo *) xalloc (sizeof (SisCardInfo)); + if (!sisc) + goto bail0; + + sisc->io_base = card->attr.io; + /* + * enable access to SiS ports (no MMIO available) + */ + iopl(3); + save_sr5 = GetSrtc(sisc,0x5); + if (save_sr5 != 0x21) + save_sr5 = 0x86; + PutSrtc(sisc,0x5,0x86); +#if 0 + { + int i; + + for (i = 0; i <= 0x3f; i++) + fprintf (stderr, "SR%02x = %02x\n", i, GetSrtc(sisc,i)); + } +#endif + sisc->memory = sisMemoryTable[GetSrtc(sisc,0xc)&0x7] * 1024 * 1024; + + PutSrtc(sisc,0x5,save_sr5); + + if (!sisc->memory) + { + ErrorF ("Can't detect SiS530 frame buffer\n"); + goto bail1; + } + + /* + * Map frame buffer and MMIO registers + */ + sisc->frameBuffer = KdMapDevice (card->attr.address[0], sisc->memory); + if (!sisc->frameBuffer) + goto bail1; + + sisc->registers = KdMapDevice (card->attr.address[1], MMIO_SIZE); + if (!sisc->registers) + goto bail2; + + /* + * Offset from base of MMIO to registers + */ + sisc->sis = (SisPtr) (sisc->registers + SIS_MMIO_OFFSET); + sisc->cpu_bitblt = (VOL32 *) sisc->registers; + + card->driver = sisc; + + return TRUE; +bail2: + KdUnmapDevice (sisc->frameBuffer, sisc->memory); +bail1: + xfree (sisc); +bail0: + return FALSE; +} + +Bool +sisModeSupported (KdScreenInfo *screen, const KdMonitorTiming *t) +{ + if (t->horizontal != 1600 && + t->horizontal != 1280 && + t->horizontal != 1152 && + t->horizontal != 1024 && + t->horizontal != 800 && + t->horizontal != 640) + return FALSE; + return TRUE; +} + +Bool +sisModeUsable (KdScreenInfo *screen) +{ + KdCardInfo *card = screen->card; + SisCardInfo *sisc = (SisCardInfo *) card->driver; + SisScreenInfo *siss; + int i; + KdMonitorTiming *t; + CARD32 memory; + int byte_width, pixel_width, screen_size; + + if (screen->fb[0].depth >= 24) + { + screen->fb[0].depth = 24; + screen->fb[0].bitsPerPixel = 24; + screen->dumb = TRUE; + } + else if (screen->fb[0].depth >= 16) + { + screen->fb[0].depth = 16; + screen->fb[0].bitsPerPixel = 16; + } + else if (screen->fb[0].depth >= 15) + { + screen->fb[0].depth = 15; + screen->fb[0].bitsPerPixel = 16; + } + else + { + screen->fb[0].depth = 8; + screen->fb[0].bitsPerPixel = 8; + } + byte_width = screen->width * (screen->fb[0].bitsPerPixel >> 3); + pixel_width = screen->width; + screen->fb[0].pixelStride = pixel_width; + screen->fb[0].byteStride = byte_width; + + screen_size = byte_width * screen->height; + + return screen_size <= sisc->memory; +} + +Bool +sisScreenInit (KdScreenInfo *screen) +{ + KdCardInfo *card = screen->card; + SisCardInfo *sisc = (SisCardInfo *) card->driver; + SisScreenInfo *siss; + int i; + const KdMonitorTiming *t; + CARD32 memory; + int byte_width, pixel_width, screen_size; + + siss = (SisScreenInfo *) xalloc (sizeof (SisScreenInfo)); + if (!siss) + return FALSE; + + memset (siss, '\0', sizeof (SisScreenInfo)); + + if (!screen->width || !screen->height) + { + screen->width = 800; + screen->height = 600; + screen->rate = 72; + } + if (!screen->fb[0].depth) + screen->fb[0].depth = 8; + + t = KdFindMode (screen, sisModeSupported); + + screen->rate = t->rate; + screen->width = t->horizontal; + screen->height = t->vertical; + + if (!KdTuneMode (screen, sisModeUsable, sisModeSupported)) + { + xfree (sisc); + return FALSE; + } + + memory = sisc->memory - screen_size; + + screen->fb[0].frameBuffer = sisc->frameBuffer; + + /* + * Cursor lives in the last 16k of memory + */ + if (memory >= 16384 && !screen->softCursor) + { + siss->cursor_base = sisc->frameBuffer + (sisc->memory - 16384); + siss->cursor_off = siss->cursor_base - sisc->frameBuffer; + memory -= 16384; + } + else + { + screen->softCursor = TRUE; + siss->cursor_base = 0; + siss->cursor_off = 0; + } + + if (memory > 8192) + { + siss->expand = screen->fb[0].frameBuffer + screen_size; + siss->expand_off = siss->expand - sisc->frameBuffer; + siss->expand_len = memory; + memory = 0; + } + else + { + siss->expand = 0; + siss->expand_len = 0; + } + + switch (screen->fb[0].depth) { + case 8: + screen->fb[0].visuals = ((1 << StaticGray) | + (1 << GrayScale) | + (1 << StaticColor) | + (1 << PseudoColor) | + (1 << TrueColor) | + (1 << DirectColor)); + screen->fb[0].blueMask = 0x00; + screen->fb[0].greenMask = 0x00; + screen->fb[0].redMask = 0x00; + break; + case 15: + screen->fb[0].visuals = (1 << TrueColor); + screen->fb[0].blueMask = 0x001f; + screen->fb[0].greenMask = 0x03e0; + screen->fb[0].redMask = 0x7c00; + break; + case 16: + screen->fb[0].visuals = (1 << TrueColor); + screen->fb[0].blueMask = 0x001f; + screen->fb[0].greenMask = 0x07e0; + screen->fb[0].redMask = 0xf800; + break; + case 24: + screen->fb[0].visuals = (1 << TrueColor); + screen->fb[0].blueMask = 0x0000ff; + screen->fb[0].greenMask = 0x00ff00; + screen->fb[0].redMask = 0xff0000; + break; + } + + screen->driver = siss; + + return TRUE; +} + +static void +_sisGetCrtc (SisCardInfo *sisc, SisCrtc *crtc) +{ + crtc->misc_output = _sisInb(sisc->io_base+0x4c); + crtc->h_total_0_7 = GetCrtc (sisc, 0x00); + crtc->h_display_end_0_7 = GetCrtc (sisc, 0x01); + crtc->h_blank_start_0_7 = GetCrtc (sisc, 0x02); + crtc->_h_blank_end = GetCrtc (sisc, 0x03); + crtc->h_sync_start_0_7 = GetCrtc (sisc, 0x04); + crtc->_h_sync_end = GetCrtc (sisc, 0x05); + crtc->v_total_0_7 = GetCrtc (sisc, 0x06); + crtc->crtc_overflow = GetCrtc (sisc, 0x07); + crtc->preset_row_scan = GetCrtc (sisc, 0x08); + crtc->_max_scan_line = GetCrtc (sisc, 0x09); + crtc->cursor_start = GetCrtc (sisc, 0x0a); + crtc->cursor_end = GetCrtc (sisc, 0x0a); + crtc->start_address_8_15 = GetCrtc (sisc, 0x0c); + crtc->start_address_0_7 = GetCrtc (sisc, 0x0d); + crtc->text_cursor_15_8 = GetCrtc (sisc, 0x0e); + crtc->text_cursor_7_0 = GetCrtc (sisc, 0x0f); + crtc->v_retrace_start_0_7 = GetCrtc (sisc, 0x10); + crtc->_v_retrace_end = GetCrtc (sisc, 0x11); + crtc->v_display_end_0_7 = GetCrtc (sisc, 0x12); + crtc->screen_off_0_7 = GetCrtc (sisc, 0x13); + crtc->_underline_location = GetCrtc (sisc, 0x14); + crtc->v_blank_start_0_7 = GetCrtc (sisc, 0x15); + crtc->v_blank_end_0_7 = GetCrtc (sisc, 0x16); + crtc->crtc_mode = GetCrtc (sisc, 0x17); + + crtc->line_compare_0_7 = GetCrtc (sisc, 0x18); + + crtc->mode_control = GetArtc (sisc, 0x10); + crtc->screen_border_color = GetArtc (sisc, 0x11); + crtc->enable_color_plane = GetArtc (sisc, 0x12); + crtc->horizontal_pixel_pan = GetArtc (sisc, 0x13); + + crtc->mode_register = GetGrtc (sisc, 0x5); + crtc->misc_register = GetGrtc (sisc, 0x6); + crtc->color_dont_care = GetGrtc (sisc, 0x7); + + crtc->clock_mode = GetSrtc (sisc, 0x1); + crtc->color_plane_w_enable = GetSrtc (sisc, 0x2); + crtc->memory_mode = GetSrtc (sisc, 0x4); + + crtc->graphics_mode = GetSrtc (sisc, 0x6); + crtc->misc_control_0 = GetSrtc (sisc, 0x7); + crtc->crt_cpu_threshold_control_0 = GetSrtc (sisc, 0x8); + crtc->crt_cpu_threshold_control_1 = GetSrtc (sisc, 0x9); + crtc->extended_crt_overflow = GetSrtc (sisc, 0xa); + crtc->misc_control_1 = GetSrtc (sisc, 0xb); + crtc->misc_control_2 = GetSrtc (sisc, 0xc); + + crtc->ddc_and_power_control = GetSrtc (sisc, 0x11); + crtc->extended_horizontal_overflow = GetSrtc (sisc, 0x12); + crtc->extended_clock_generator = GetSrtc (sisc, 0x13); + crtc->cursor_0_red = GetSrtc (sisc, 0x14); + crtc->cursor_0_green = GetSrtc (sisc, 0x15); + crtc->cursor_0_blue = GetSrtc (sisc, 0x16); + crtc->cursor_1_red = GetSrtc (sisc, 0x17); + crtc->cursor_1_green = GetSrtc (sisc, 0x18); + crtc->cursor_1_blue = GetSrtc (sisc, 0x19); + crtc->cursor_h_start_0_7 = GetSrtc (sisc, 0x1a); + crtc->cursor_h_start_1 = GetSrtc (sisc, 0x1b); + crtc->cursor_h_preset_0_5 = GetSrtc (sisc, 0x1c); + crtc->cursor_v_start_0_7 = GetSrtc (sisc, 0x1d); + crtc->cursor_v_start_1 = GetSrtc (sisc, 0x1e); + crtc->cursor_v_preset_0_5 = GetSrtc (sisc, 0x1f); + crtc->linear_base_19_26 = GetSrtc (sisc, 0x20); + crtc->linear_base_1 = GetSrtc (sisc, 0x21); + + crtc->graphics_engine_0 = GetSrtc (sisc, 0x26); + crtc->graphics_engine_1 = GetSrtc (sisc, 0x27); + crtc->internal_mclk_0 = GetSrtc (sisc, 0x28); + crtc->internal_mclk_1 = GetSrtc (sisc, 0x29); + crtc->internal_vclk_0 = GetSrtc (sisc, 0x2A); + crtc->internal_vclk_1 = GetSrtc (sisc, 0x2B); + + crtc->misc_control_7 = GetSrtc (sisc, 0x38); + + crtc->misc_control_11 = GetSrtc (sisc, 0x3E); + crtc->misc_control_12 = GetSrtc (sisc, 0x3F); +} + +static void +_sisSetBlank (SisCardInfo *sisc, Bool blank) +{ + CARD8 clock; + + clock = GetSrtc (sisc, 0x01); + if (blank) + clock |= 0x20; + else + clock &= ~0x20; + PutSrtc (sisc, 0x01, clock); +} + +static void +_sisSetCrtc (SisCardInfo *sisc, SisCrtc *crtc) +{ + _sisSetBlank (sisc, TRUE); + PutCrtc (sisc, 0x00, crtc->h_total_0_7); + PutCrtc (sisc, 0x01, crtc->h_display_end_0_7); + PutCrtc (sisc, 0x02, crtc->h_blank_start_0_7); + PutCrtc (sisc, 0x03, crtc->_h_blank_end); + PutCrtc (sisc, 0x04, crtc->h_sync_start_0_7); + PutCrtc (sisc, 0x05, crtc->_h_sync_end); + PutCrtc (sisc, 0x06, crtc->v_total_0_7); + PutCrtc (sisc, 0x07, crtc->crtc_overflow); + PutCrtc (sisc, 0x08, crtc->preset_row_scan); + PutCrtc (sisc, 0x09, crtc->_max_scan_line); + PutCrtc (sisc, 0x0a, crtc->cursor_start); + PutCrtc (sisc, 0x0b, crtc->cursor_end); + PutCrtc (sisc, 0x0c, crtc->start_address_8_15); + PutCrtc (sisc, 0x0d, crtc->start_address_0_7); + PutCrtc (sisc, 0x0e, crtc->text_cursor_15_8); + PutCrtc (sisc, 0x0f, crtc->text_cursor_7_0); + PutCrtc (sisc, 0x10, crtc->v_retrace_start_0_7); + PutCrtc (sisc, 0x11, crtc->_v_retrace_end); + PutCrtc (sisc, 0x12, crtc->v_display_end_0_7); + PutCrtc (sisc, 0x13, crtc->screen_off_0_7); + PutCrtc (sisc, 0x14, crtc->_underline_location); + PutCrtc (sisc, 0x15, crtc->v_blank_start_0_7); + PutCrtc (sisc, 0x16, crtc->v_blank_end_0_7); + PutCrtc (sisc, 0x17, crtc->crtc_mode); + PutCrtc (sisc, 0x18, crtc->line_compare_0_7); + + PutArtc (sisc, 0x10, crtc->mode_control); + PutArtc (sisc, 0x11, crtc->screen_border_color); + PutArtc (sisc, 0x12, crtc->enable_color_plane); + PutArtc (sisc, 0x13, crtc->horizontal_pixel_pan); + + PutGrtc (sisc, 0x5, crtc->mode_register); + PutGrtc (sisc, 0x6, crtc->misc_register); + PutGrtc (sisc, 0x7, crtc->color_dont_care); + + PutSrtc (sisc, 0x1, crtc->clock_mode | 0x20); + PutSrtc (sisc, 0x2, crtc->color_plane_w_enable); + PutSrtc (sisc, 0x4, crtc->memory_mode); + + PutSrtc (sisc, 0x6, crtc->graphics_mode); + PutSrtc (sisc, 0x7, crtc->misc_control_0); + PutSrtc (sisc, 0x8, crtc->crt_cpu_threshold_control_0); + PutSrtc (sisc, 0x9, crtc->crt_cpu_threshold_control_1); + PutSrtc (sisc, 0xa, crtc->extended_crt_overflow); + PutSrtc (sisc, 0xb, crtc->misc_control_1); + PutSrtc (sisc, 0xc, crtc->misc_control_2); + + PutSrtc (sisc, 0x11, crtc->ddc_and_power_control); + PutSrtc (sisc, 0x12, crtc->extended_horizontal_overflow); + PutSrtc (sisc, 0x13, crtc->extended_clock_generator); + PutSrtc (sisc, 0x14, crtc->cursor_0_red); + PutSrtc (sisc, 0x15, crtc->cursor_0_green); + PutSrtc (sisc, 0x16, crtc->cursor_0_blue); + PutSrtc (sisc, 0x17, crtc->cursor_1_red); + PutSrtc (sisc, 0x18, crtc->cursor_1_green); + PutSrtc (sisc, 0x19, crtc->cursor_1_blue); + PutSrtc (sisc, 0x1a, crtc->cursor_h_start_0_7); + PutSrtc (sisc, 0x1b, crtc->cursor_h_start_1); + PutSrtc (sisc, 0x1c, crtc->cursor_h_preset_0_5); + PutSrtc (sisc, 0x1d, crtc->cursor_v_start_0_7); + PutSrtc (sisc, 0x1e, crtc->cursor_v_start_1); + PutSrtc (sisc, 0x1f, crtc->cursor_v_preset_0_5); + PutSrtc (sisc, 0x20, crtc->linear_base_19_26); + PutSrtc (sisc, 0x21, crtc->linear_base_1); + + PutSrtc (sisc, 0x26, crtc->graphics_engine_0); + PutSrtc (sisc, 0x27, crtc->graphics_engine_1); + PutSrtc (sisc, 0x28, crtc->internal_mclk_0); + PutSrtc (sisc, 0x29, crtc->internal_mclk_1); + PutSrtc (sisc, 0x2A, crtc->internal_vclk_0); + PutSrtc (sisc, 0x2B, crtc->internal_vclk_1); + + PutSrtc (sisc, 0x38, crtc->misc_control_7); + + PutSrtc (sisc, 0x3E, crtc->misc_control_11); + PutSrtc (sisc, 0x3F, crtc->misc_control_12); + +#if 0 + PutCrtc (sisc, 0x5b, 0x27); + PutCrtc (sisc, 0x5c, 0xe1); + PutCrtc (sisc, 0x5d, 0x00); + + PutSrtc (sisc, 0x5a, 0xe6); + PutSrtc (sisc, 0x5d, 0xa1); + PutSrtc (sisc, 0x9a, 0xe6); + PutSrtc (sisc, 0x9d, 0xa1); + PutSrtc (sisc, 0xda, 0xe6); + PutSrtc (sisc, 0xdd, 0x6c); +#endif + + _sisOutb(crtc->misc_output, sisc->io_base+0x42); + + outw (0x3c4, 0x0100); + outw (0x3c4, 0x0300); + + _sisSetBlank (sisc, FALSE); +} + +CARD8 +_sisReadIndexRegister (CARD32 base, CARD8 index) +{ + CARD8 ret; + + _sisOutb (index, base); + ret = _sisInb (base+1); + return ret; +} + +void +_sisWriteIndexRegister (CARD32 base, CARD8 index, CARD8 value) +{ + _sisOutb (index, base); + _sisOutb (value, base+1); +} + +CARD8 +_sisReadArtc (CARD32 base, CARD8 index) +{ + CARD8 ret; + + _sisInb (base+0x1a); + _sisOutb (index,base); + ret = _sisInb (base+1); + _sisInb (base+0x1a); + _sisOutb (0x20,base); + return ret; +} + +void +_sisWriteArtc (CARD32 base, CARD8 index, CARD8 value) +{ + _sisInb (base+0x1a); + _sisOutb (index|0x20,base); + _sisOutb (value,base); + _sisInb (base+0x1a); + _sisOutb (0x20,base); +} + +void +sisPreserve (KdCardInfo *card) +{ + SisCardInfo *sisc = card->driver; + CARD8 *r = sisc->registers; + int a, i, l; + CARD8 line[16]; + CARD8 prev[16]; + BOOL gotone; + + sisc->save.sr5 = GetSrtc(sisc,0x5); + if (sisc->save.sr5 != 0x21) + sisc->save.sr5 = 0x86; + /* unlock extension registers */ + PutSrtc(sisc,0x5,0x86); + /* unlock CRTC registers */ + PutCrtc(sisc,0x11,GetCrtc(sisc,0x11)&~0x80); + /* enable vga */ + _sisOutb(0x1,sisc->io_base+0x43); + + /* enable MMIO access to registers */ + sisc->save.srb = GetSrtc(sisc,0xb); + PutSrtc(sisc, 0xb, sisc->save.srb | 0x60); + _sisGetCrtc (sisc, &sisc->save.crtc); + memcpy (sisc->save.text_save, sisc->frameBuffer, SIS_TEXT_SAVE); +} + +Bool +sisEnable (ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + KdCardInfo *card = pScreenPriv->card; + SisCardInfo *sisc = card->driver; + SisScreenInfo *siss = screen->driver; + const KdMonitorTiming *t; + SisCrtc crtc; + unsigned long pixel; + + int hactive; + int hblank; + int hfp; + int hbp; + + int vactive; + int vblank; + int vfp; + int vbp; + + int h_total; + int h_display_end; + int h_blank_start; + int h_blank_end; + int h_sync_start; + int h_sync_end; + int h_screen_off; + + int h_adjust; + + int v_total; + int v_retrace_start; + int v_retrace_end; + int v_display_end; + int v_blank_start; + int v_blank_end; + + crtc = sisc->save.crtc; + + t = KdFindMode (screen, sisModeSupported); + + /* CR9 */ + crtc.max_scan_line = 0; + + /* CRA */ + crtc.cursor_start = 0; + + /* CRB */ + crtc.cursor_end = 0; + + /* CRE */ + crtc.text_cursor_15_8 = 0; + + /* CRF */ + crtc.text_cursor_7_0 = 0; + + /* CR11 */ + crtc.disable_v_retrace_int = 1; + + /* CR14 */ + crtc.underline_location = 0; + crtc.count_by_four = 0; + crtc.doubleword_mode = 1; + + /* 3CC/3C2 */ + crtc.io_address_select = 1; + crtc.display_ram_enable = 1; + crtc.clock_select = 3; + + /* SR1 */ + crtc.clock_mode = 0; + crtc.dot_clock_8_9 = 1; + + /* SR2 */ + crtc.color_plane_w_enable = 0xf; + + /* SR4 */ + crtc.memory_mode = 0; + crtc.chain_4_enable = 1; + crtc.odd_even_disable = 1; + crtc.extended_memory_sz = 1; + + /* SR6 */ + crtc.graphics_mode_linear = 1; + crtc.enhanced_graphics_mode = 1; + + /* SR9 */ + crtc.crt_cpu_threshold_control_1 = 0; + + /* SRB */ +#if 0 + crtc.cpu_bitblt_enable = 1; +#endif + crtc.memory_mapped_mode = 3; + + /* SRC */ + crtc.graphics_mode_32bit_enable = 1; + crtc.read_ahead_enable = 1; + + /* SR11 */ + crtc.acpi_enable = 0; + crtc.kbd_cursor_activate = 0; + crtc.video_memory_activate = 0; + crtc.vga_standby = 0; + crtc.vga_suspend = 0; + + crtc.cursor_0_red = 0x3f; + crtc.cursor_0_green = 0x3f; + crtc.cursor_0_blue = 0x3f; + + /* SR20 */ + crtc.linear_base_19_26 = (card->attr.address[0] & 0x07f80000) >> 19; + + /* SR21 */ + crtc.linear_base_27_31 = (card->attr.address[0] & 0xf8000000) >> 27; + crtc.linear_aperture = SIS_LINEAR_APERTURE_4M; + + /* SR27 */ + crtc.logical_screen_width = 3; + crtc.graphics_prog_enable = 1; + + /* SR38 */ + crtc.extended_clock_select = 0; + + /* AR10 */ + crtc.mode_control = 0; + crtc.graphics_mode_enable = 1; + /* AR11 */ + crtc.screen_border_color = 0; + /* AR12 */ + crtc.enable_color_plane = 0xf; + /* AR13 */ + crtc.horizontal_pixel_pan = 0; + + /* GR5 */ + crtc.mode_register = 0; + + /* GR6 */ + crtc.graphics_enable = 1; + crtc.chain_odd_even = 0; + crtc.memory_address_select = 1; + + /* GR7 */ + crtc.color_dont_care = 0xf; + if (siss->cursor_base) + { + crtc_set_cursor_start_addr (&crtc, siss->cursor_off); + crtc.graphics_mode_hw_cursor = 0; + } + + hactive = t->horizontal; + hblank = t->hblank; + hbp = t->hbp; + hfp = t->hfp; + + vactive = t->vertical; + vblank = t->vblank; + vbp = t->vbp; + vfp = t->vfp; + + pixel = (hactive + hblank) * (vactive + vblank) * t->rate; + + switch (screen->fb[0].bitsPerPixel) { + case 8: + hactive /= 8; + hblank /= 8; + hfp /= 8; + hbp /= 8; + + crtc.color_mode_256 = 1; + h_screen_off = hactive; + h_adjust = 1; + + break; + case 16: + hactive /= 8; + hblank /= 8; + hfp /= 8; + hbp /= 8; + + h_screen_off = hactive * 2; + h_adjust = 1; + + crtc.color_mode_256 = 0; + + if (screen->fb[0].depth == 15) + crtc.graphics_mode_32k = 1; + else + crtc.graphics_mode_64k = 1; + break; + case 24: + hactive /= 8; + hblank /= 8; + hfp /= 8; + hbp /= 8; + + h_screen_off = hactive * 3; + h_adjust = 1; + + crtc.color_mode_256 = 0; + + /* SR6 */ + crtc.graphics_mode_true = 1; + /* SR7 */ + crtc.direct_color_24bit = 0; + /* SR9 */ + crtc.true_color_32bpp = 0; + /* SRB */ + crtc.true_color_order = 1; + break; + case 32: + hactive /= 8; + hblank /= 8; + hfp /= 8; + hbp /= 8; + + h_screen_off = hactive * 4; + h_adjust = 1; + + crtc.color_mode_256 = 0; + + /* SR6 */ + crtc.graphics_mode_true = 1; + /* SR7 */ + crtc.direct_color_24bit = 0; + /* SR9 */ + crtc.true_color_32bpp = 1; + /* SRB */ + crtc.true_color_order = 1; + break; + } + + sisGetClock (pixel, &crtc); + + crtc.high_speed_dac_0 = crtc.high_speed_dac_1 = pixel > 135000000; + + sisEngThresh (&crtc, pixel, screen->fb[0].bitsPerPixel); + + /* + * Compute horizontal register values from timings + */ + h_total = hactive + hblank - 5; + h_display_end = hactive - 1; + h_blank_start = h_display_end; + h_blank_end = h_blank_start + hblank; + + h_sync_start = hactive + hfp + h_adjust; + h_sync_end = h_sync_start + hblank - hbp - hfp; + + crtc_set_h_total(&crtc, h_total); + crtc_set_h_display_end (&crtc, h_display_end); + crtc_set_h_blank_start (&crtc, h_blank_start); + crtc_set_h_blank_end (&crtc, h_blank_end); + crtc_set_h_sync_start (&crtc, h_sync_start); + crtc_set_h_sync_end (&crtc, h_sync_end); + crtc_set_screen_off (&crtc, h_screen_off); + + v_total = vactive + vblank - 2; + v_retrace_start = vactive + vfp - 1; + v_retrace_end = v_retrace_start + vblank - vbp - vfp; + v_display_end = vactive - 1; + v_blank_start = vactive - 1; + v_blank_end = v_blank_start + vblank /* - 1 */; + + crtc_set_v_total(&crtc, v_total); + crtc_set_v_retrace_start (&crtc, v_retrace_start); + crtc.v_retrace_end_0_3 = v_retrace_end; + crtc_set_v_display_end (&crtc, v_display_end); + crtc_set_v_blank_start (&crtc, v_blank_start); + crtc.v_blank_end_0_7 = v_blank_end; + +#if 0 + crtc.h_blank_start_0_7 = 0x6a; + crtc._h_blank_end = 0x9a; + crtc.h_sync_start_0_7 = 0x6b; + crtc._h_sync_end = 0x9a; + + crtc.v_retrace_start_0_7 = 0x7d; + crtc._v_retrace_end = 0x23; + crtc.v_blank_start_0_7 = 0x7d; + crtc.v_blank_end_0_7 = 0x84; + + crtc.crt_cpu_threshold_control_0 = 0xdf; /* SR8 */ + crtc.crt_cpu_threshold_control_1 = 0x00; /* SR9 */ + crtc.extended_clock_generator = 0x40; /* SR13 */ + + crtc.cursor_h_start_0_7 = 0x83; + crtc.cursor_v_start_0_7 = 0x6c; + + crtc.internal_vclk_0 = 0x68; + crtc.internal_vclk_1 = 0xc4; + crtc.misc_control_7 = 0x70; +#endif + + _sisSetCrtc (sisc, &crtc); + return TRUE; +} + +Bool +sisDPMS (ScreenPtr pScreen, int mode) +{ + KdScreenPriv(pScreen); + sisCardInfo(pScreenPriv); + union ddc_and_power_control_u _ddc_and_power_control_u; + + ddc_and_power_control = sisc->save.crtc.ddc_and_power_control; + + kbd_cursor_activate = 0; + video_memory_activate = 0; + vga_standby = 0; + vga_suspend = 0; + acpi_enable = 0; + switch (mode) { + case KD_DPMS_NORMAL: + break; + case KD_DPMS_STANDBY: + vga_standby = 1; + break; + case KD_DPMS_SUSPEND: + vga_suspend = 1; + break; + case KD_DPMS_POWERDOWN: + acpi_enable = 1; + break; + } + PutSrtc (sisc, 0x11, ddc_and_power_control); + return TRUE; +} + +void +sisDisable (ScreenPtr pScreen) +{ +} + +void +sisRestore (KdCardInfo *card) +{ + SisCardInfo *sisc = (SisCardInfo *) card->driver; + + memcpy (sisc->frameBuffer, sisc->save.text_save, SIS_TEXT_SAVE); + _sisSetCrtc (sisc, &sisc->save.crtc); + PutSrtc (sisc, 0xb, sisc->save.srb); + PutSrtc (sisc, 0x5, sisc->save.sr5); +} + +void +sisScreenFini (KdScreenInfo *screen) +{ + SisScreenInfo *siss = (SisScreenInfo *) screen->driver; + + xfree (siss); + screen->driver = 0; +} + +void +sisCardFini (KdCardInfo *card) +{ + SisCardInfo *sisc = (SisCardInfo *) card->driver; + + KdUnmapDevice (sisc->frameBuffer, sisc->memory); + KdUnmapDevice (sisc->registers, sizeof (SisRec)); +} + +KdCardFuncs sisFuncs = { + sisCardInit, + sisScreenInit, + 0, + sisPreserve, + sisEnable, + sisDPMS, + sisDisable, + sisRestore, + sisScreenFini, + sisCardFini, + sisCursorInit, + sisCursorEnable, + sisCursorDisable, + sisCursorFini, + 0, + sisDrawInit, + sisDrawEnable, + sisDrawSync, + sisDrawDisable, + sisDrawFini, + sisGetColors, + sisPutColors, +}; --- xorg-server-1.4.2.orig/hw/kdrive/sis530/sisdraw.c +++ xorg-server-1.4.2/hw/kdrive/sis530/sisdraw.c @@ -0,0 +1,1720 @@ +/* + * 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_CONFIG_H +#include +#endif +#include "sis.h" +#include "sisdraw.h" + +#include "Xmd.h" +#include "gcstruct.h" +#include "scrnintstr.h" +#include "pixmapstr.h" +#include "regionstr.h" +#include "mistruct.h" +#include "fontstruct.h" +#include "dixfontstr.h" +#include "fb.h" +#include "migc.h" +#include "miline.h" + +CARD8 sisPatRop[16] = { + /* GXclear */ 0x00, /* 0 */ + /* GXand */ 0xa0, /* src AND dst */ + /* GXandReverse */ 0x50, /* src AND NOT dst */ + /* GXcopy */ 0xf0, /* src */ + /* GXandInverted*/ 0x0a, /* NOT src AND dst */ + /* GXnoop */ 0xaa, /* dst */ + /* GXxor */ 0x5a, /* src XOR dst */ + /* GXor */ 0xfa, /* src OR dst */ + /* GXnor */ 0x05, /* NOT src AND NOT dst */ + /* GXequiv */ 0xa5, /* NOT src XOR dst */ + /* GXinvert */ 0x55, /* NOT dst */ + /* GXorReverse */ 0xf5, /* src OR NOT dst */ + /* GXcopyInverted*/ 0x0f, /* NOT src */ + /* GXorInverted */ 0xaf, /* NOT src OR dst */ + /* GXnand */ 0x5f, /* NOT src OR NOT dst */ + /* GXset */ 0xff, /* 1 */ +}; + +CARD8 sisBltRop[16] = { + /* GXclear */ 0x00, /* 0 */ + /* GXand */ 0x88, /* src AND dst */ + /* GXandReverse */ 0x44, /* src AND NOT dst */ + /* GXcopy */ 0xcc, /* src */ + /* GXandInverted*/ 0x22, /* NOT src AND dst */ + /* GXnoop */ 0xaa, /* dst */ + /* GXxor */ 0x66, /* src XOR dst */ + /* GXor */ 0xee, /* src OR dst */ + /* GXnor */ 0x11, /* NOT src AND NOT dst */ + /* GXequiv */ 0x99, /* NOT src XOR dst */ + /* GXinvert */ 0x55, /* NOT dst */ + /* GXorReverse */ 0xdd, /* src OR NOT dst */ + /* GXcopyInverted*/ 0x33, /* NOT src */ + /* GXorInverted */ 0xbb, /* NOT src OR dst */ + /* GXnand */ 0x77, /* NOT src OR NOT dst */ + /* GXset */ 0xff, /* 1 */ +}; + +/* Align blts to this boundary or risk trashing an in-progress expand */ +#define SIS_MIN_PATTERN 8 + +/* Do plane bits in this increment to balance CPU and graphics engine */ +#define SIS_PATTERN_INC 1024 + +typedef struct _SisExpand { + SisCardInfo *sisc; + SisScreenInfo *siss; + CARD32 off; + int last; +} SisExpand; + +static void +sisExpandInit (ScreenPtr pScreen, + SisExpand *e) +{ + KdScreenPriv(pScreen); + sisCardInfo(pScreenPriv); + sisScreenInfo(pScreenPriv); + + e->sisc = sisc; + e->siss = siss; + e->off = siss->expand_off; + e->last = 0; +} + +static CARD32 * +sisExpandAlloc (SisExpand *e, + int nb) +{ + SisCardInfo *sisc = e->sisc; + SisScreenInfo *siss = e->siss; + SisPtr sis = sisc->sis; + CARD32 off; + + /* round up to alignment boundary */ + nb = (nb + SIS_MIN_PATTERN-1) & ~(SIS_MIN_PATTERN-1); + + off = e->off + e->last; + if (off + nb > siss->expand_off + siss->expand_len) + { + _sisWaitIdleEmpty (sis); + off = siss->expand_off; + } + e->off = off; + e->last = nb; + return (CARD32 *) (sisc->frameBuffer + off); +} + +void +sisGlyphBltClipped (DrawablePtr pDrawable, + GCPtr pGC, + int x, + int y, + unsigned int nglyph, + CharInfoPtr *ppciInit, + Bool imageBlt) +{ + SetupSis(pDrawable->pScreen); + FbGCPrivPtr fbPriv = fbGetGCPrivate(pGC); + int height; + int width; + int xBack, yBack; + int hBack, wBack; + int nb, bwidth, nl; + FontPtr pfont = pGC->font; + CharInfoPtr pci; + CARD8 *bits8, b; + CARD16 *bits16; + CARD32 *bits32; + BoxPtr extents; + BoxRec bbox; + unsigned char alu; + CARD32 cmd; + SisExpand expand; + CARD32 *dst, d; + int nbytes; + int shift; + int x1, y1, x2, y2; + RegionPtr pClip = fbGetCompositeClip(pGC); + BoxPtr pBox; + int nbox; + int rect_in; + int widthBlt; + CharInfoPtr *ppci; + + x += pDrawable->x; + y += pDrawable->y; + + if (imageBlt) + { + xBack = x; + yBack = y - FONTASCENT(pGC->font); + wBack = 0; + hBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font); + if (hBack) + { + height = nglyph; + ppci = ppciInit; + while (height--) + wBack += (*ppci++)->metrics.characterWidth; + } + if (wBack < 0) + { + xBack = xBack + wBack; + wBack = -wBack; + } + if (hBack < 0) + { + yBack = yBack + hBack; + hBack = -hBack; + } + alu = GXcopy; + } + else + { + wBack = 0; + alu = pGC->alu; + } + + if (wBack) + { + _sisSetSolidRect (sis, pGC->bgPixel, GXcopy, cmd); + for (nbox = REGION_NUM_RECTS (pClip), + pBox = REGION_RECTS (pClip); + nbox--; + pBox++) + { + x1 = xBack; + x2 = xBack + wBack; + y1 = yBack; + y2 = yBack + hBack; + if (x1 < pBox->x1) x1 = pBox->x1; + if (x2 > pBox->x2) x2 = pBox->x2; + if (y1 < pBox->y1) y1 = pBox->y1; + if (y2 > pBox->y2) y2 = pBox->y2; + if (x1 < x2 && y1 < y2) + { + _sisRect (sis, x1, y1, x2 - x1, y2 - y1, cmd); + } + } + } + + sisExpandInit (pDrawable->pScreen, &expand); + + sis->u.general.src_fg = pGC->fgPixel; + sis->u.general.src_pitch = 0; + sis->u.general.src_x = 0; + sis->u.general.src_y = 0; + + cmd = (SIS_CMD_ENH_COLOR_EXPAND | + SIS_CMD_SRC_SCREEN | + SIS_CMD_PAT_FG | + (sisBltRop[alu] << 8) | + SIS_CMD_INC_X | + SIS_CMD_INC_Y | + SIS_CMD_RECT_CLIP_ENABLE | + SIS_CMD_TRANSPARENT); + + ppci = ppciInit; + while (nglyph--) + { + pci = *ppci++; + height = pci->metrics.ascent + pci->metrics.descent; + width = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing; + widthBlt = (width + 31) & ~31; + nb = (widthBlt >> 3) * height; + if (nb) + { + x1 = x + pci->metrics.leftSideBearing; + y1 = y - pci->metrics.ascent; + bbox.x1 = x1; + bbox.y1 = y1; + bbox.x2 = x1 + width; + bbox.y2 = y1 + height; + rect_in = RECT_IN_REGION(pGC->pScreen, pClip, &bbox); + if (rect_in != rgnOUT) + { + dst = sisExpandAlloc (&expand, nb); + + sis->u.general.src_base = expand.off; + sis->u.general.dst_x = x1; + sis->u.general.dst_y = y1; + sis->u.general.rect_width = widthBlt; + sis->u.general.rect_height = height; + nb >>= 2; + bits32 = (CARD32 *) pci->bits; + while (nb--) + { + d = *bits32++; + SisInvertBits32 (d); + *dst++ = d; + } + if (rect_in == rgnPART) + { + for (nbox = REGION_NUM_RECTS (pClip), + pBox = REGION_RECTS (pClip); + nbox--; + pBox++) + { + _sisClip (sis, pBox->x1, pBox->y1, pBox->x2, pBox->y2); + sis->u.general.command = cmd; + } + } + else + { + _sisClip (sis, 0, 0, x1+width, pScreenPriv->screen->height); + sis->u.general.command = cmd; + } + } + } + x += pci->metrics.characterWidth; + } + _sisClip (sis, 0, 0, + pScreenPriv->screen->width, pScreenPriv->screen->height); + KdMarkSync (pDrawable->pScreen); +} + +Bool +sisTEGlyphBlt (DrawablePtr pDrawable, + GCPtr pGC, + int xInit, + int yInit, + unsigned int nglyph, + CharInfoPtr *ppci, + Bool imageBlt) +{ + SetupSis(pDrawable->pScreen); + int x, y; + int widthGlyphs, widthGlyph; + int widthBlt; + FbBits depthMask; + int glyphsPer; + FontPtr pfont = pGC->font; + unsigned long *char1, *char2, *char3, *char4, *char5; + CARD8 alu; + CARD32 *dst, tmp; + CARD8 *dst8, *bits8; + int nb; + int bwidth; + CARD32 cmd; + int h; + BoxRec bbox; + SisExpand expand; + int lwTmp, lw; + int extra, n; + + widthGlyph = FONTMAXBOUNDS(pfont,characterWidth); + if (!widthGlyph) + return TRUE; + + h = FONTASCENT(pfont) + FONTDESCENT(pfont); + if (!h) + return TRUE; + + x = xInit + FONTMAXBOUNDS(pfont,leftSideBearing) + pDrawable->x; + y = yInit - FONTASCENT(pfont) + pDrawable->y; + + bbox.x1 = x; + bbox.x2 = x + (widthGlyph * nglyph); + bbox.y1 = y; + bbox.y2 = y + h; + + switch (RECT_IN_REGION(pGC->pScreen, fbGetCompositeClip(pGC), &bbox)) + { + case rgnPART: + if (x < 0 || y < 0) + return FALSE; + sisGlyphBltClipped (pDrawable, pGC, xInit, yInit, nglyph, ppci, imageBlt); + case rgnOUT: + return TRUE; + } + + if (widthGlyph <= 6) + glyphsPer = 5; + else if (widthGlyph <= 8) + glyphsPer = 4; + else if (widthGlyph <= 10) + glyphsPer = 3; + else if (widthGlyph <= 16) + glyphsPer = 2; + else + glyphsPer = 1; + + widthGlyphs = widthGlyph * glyphsPer; + widthBlt = widthGlyphs; + + /* make sure scanlines are 32-bit aligned */ + if (widthGlyphs <= 24) + widthBlt = 25; + + cmd = (SIS_CMD_ENH_COLOR_EXPAND | + SIS_CMD_SRC_SCREEN | + SIS_CMD_PAT_FG | + SIS_CMD_INC_X | + SIS_CMD_INC_Y); + + if (imageBlt) + { + sis->u.general.clip_right = bbox.x2; + cmd |= ((sisBltRop[GXcopy] << 8) | + SIS_CMD_OPAQUE | + SIS_CMD_RECT_CLIP_ENABLE); + } + else + { + cmd |= ((sisBltRop[pGC->alu] << 8) | + SIS_CMD_TRANSPARENT | + SIS_CMD_RECT_CLIP_DISABLE); + } + + sisExpandInit (pDrawable->pScreen, &expand); + + sis->u.general.src_fg = pGC->fgPixel; + sis->u.general.src_bg = pGC->bgPixel; + + bwidth = (widthBlt + 7) >> 3; + + nb = bwidth * h; + +#define LoopIt(count, loadup, fetch) \ + while (nglyph >= count) \ + { \ + nglyph -= count; \ + dst = sisExpandAlloc (&expand, nb); \ + sis->u.general.src_base = expand.off; \ + sis->u.general.src_pitch = 0; \ + sis->u.general.src_x = 0; \ + sis->u.general.src_y = 0; \ + sis->u.general.dst_x = x; \ + sis->u.general.dst_y = y; \ + sis->u.general.rect_width = widthBlt; \ + sis->u.general.rect_height = h; \ + x += widthGlyphs; \ + loadup \ + lwTmp = h; \ + while (lwTmp--) { \ + tmp = fetch; \ + SisInvertBits32(tmp); \ + *dst++ = tmp; \ + } \ + sis->u.general.command = cmd; \ + } + + switch (glyphsPer) { + case 5: + LoopIt(5, + char1 = (unsigned long *) (*ppci++)->bits; + char2 = (unsigned long *) (*ppci++)->bits; + char3 = (unsigned long *) (*ppci++)->bits; + char4 = (unsigned long *) (*ppci++)->bits; + char5 = (unsigned long *) (*ppci++)->bits;, + (*char1++ | ((*char2++ | ((*char3++ | ((*char4++ | (*char5++ + << widthGlyph)) + << widthGlyph)) + << widthGlyph)) + << widthGlyph))); + break; + case 4: + LoopIt(4, + char1 = (unsigned long *) (*ppci++)->bits; + char2 = (unsigned long *) (*ppci++)->bits; + char3 = (unsigned long *) (*ppci++)->bits; + char4 = (unsigned long *) (*ppci++)->bits;, + (*char1++ | ((*char2++ | ((*char3++ | (*char4++ + << widthGlyph)) + << widthGlyph)) + << widthGlyph))); + break; + case 3: + LoopIt(3, + char1 = (unsigned long *) (*ppci++)->bits; + char2 = (unsigned long *) (*ppci++)->bits; + char3 = (unsigned long *) (*ppci++)->bits;, + (*char1++ | ((*char2++ | (*char3++ << widthGlyph)) << widthGlyph))); + break; + case 2: + LoopIt(2, + char1 = (unsigned long *) (*ppci++)->bits; + char2 = (unsigned long *) (*ppci++)->bits;, + (*char1++ | (*char2++ << widthGlyph))); + break; + } + + widthBlt = (widthGlyph + 31) & ~31; + + bwidth = widthBlt >> 3; + + nb = bwidth * h; + + lw = (widthBlt >> 5) * h; + + while (nglyph--) + { + dst = (CARD32 *) sisExpandAlloc (&expand, nb); + char1 = (CARD32 *) (*ppci++)->bits; + sis->u.general.src_base = expand.off; + sis->u.general.src_pitch = 0; + sis->u.general.src_x = 0; + sis->u.general.src_y = 0; + sis->u.general.dst_x = x; + sis->u.general.dst_y = y; + sis->u.general.rect_width = widthBlt; + sis->u.general.rect_height = h; + lwTmp = lw; + while (lwTmp--) + { + tmp = *char1++; + SisInvertBits32 (tmp); + *dst++ = tmp; + } + sis->u.general.command = cmd; + x += widthGlyph; + } + if (imageBlt) + sis->u.general.clip_right = pScreenPriv->screen->width; + KdMarkSync (pDrawable->pScreen); + return TRUE; +} + +Bool +sisGlyphBlt(DrawablePtr pDrawable, + GCPtr pGC, + int x, + int y, + unsigned int nglyph, + CharInfoPtr *ppciInit, + Bool imageBlt) +{ + SetupSis(pDrawable->pScreen); + int height; + int width; + int xBack, yBack; + int hBack, wBack; + int nb, bwidth, nl; + FontPtr pfont = pGC->font; + CharInfoPtr pci; + CARD8 *bits8, b; + CARD16 *bits16; + CARD32 *bits32; + BoxPtr extents; + BoxRec bbox; + CharInfoPtr *ppci; + unsigned char alu; + CARD32 cmd; + SisExpand expand; + CARD32 *dst, d; + int nbytes; + int shift; + + x += pDrawable->x; + y += pDrawable->y; + + /* compute an approximate (but covering) bounding box */ + ppci = ppciInit; + width = 0; + height = nglyph; + while (height--) + width += (*ppci++)->metrics.characterWidth; + if (width < 0) + { + bbox.x1 = x + width; + bbox.x2 = x; + } + else + { + bbox.x1 = x; + bbox.x2 = x + width; + } + width = FONTMINBOUNDS(pfont,leftSideBearing); + if (width < 0) + bbox.x1 += width; + width = FONTMAXBOUNDS(pfont, rightSideBearing) - FONTMINBOUNDS(pfont, characterWidth); + if (width > 0) + bbox.x2 += width; + bbox.y1 = y - FONTMAXBOUNDS(pfont,ascent); + bbox.y2 = y + FONTMAXBOUNDS(pfont,descent); + + switch (RECT_IN_REGION(pGC->pScreen, fbGetCompositeClip(pGC), &bbox)) + { + case rgnPART: + if (bbox.x1 < 0 || bbox.y1 < 0) + return FALSE; + sisGlyphBltClipped (pDrawable, pGC, + x - pDrawable->x, y - pDrawable->y, + nglyph, ppciInit, imageBlt); + case rgnOUT: + return TRUE; + } + + if (imageBlt) + { + xBack = x; + yBack = y - FONTASCENT(pGC->font); + wBack = 0; + hBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font); + if (hBack) + { + height = nglyph; + ppci = ppciInit; + while (height--) + wBack += (*ppci++)->metrics.characterWidth; + } + if (wBack < 0) + { + xBack = xBack + wBack; + wBack = -wBack; + } + if (hBack < 0) + { + yBack = yBack + hBack; + hBack = -hBack; + } + alu = GXcopy; + } + else + { + wBack = 0; + alu = pGC->alu; + } + + if (wBack) + { + _sisSetSolidRect (sis, pGC->bgPixel, GXcopy, cmd); + _sisRect (sis, xBack, yBack, wBack, hBack, cmd); + } + + sisExpandInit (pDrawable->pScreen, &expand); + + sis->u.general.src_fg = pGC->fgPixel; + + cmd = (SIS_CMD_ENH_COLOR_EXPAND | + SIS_CMD_SRC_SCREEN | + SIS_CMD_PAT_FG | + (sisBltRop[alu] << 8) | + SIS_CMD_INC_X | + SIS_CMD_INC_Y | + SIS_CMD_RECT_CLIP_DISABLE | + SIS_CMD_TRANSPARENT); + + ppci = ppciInit; + while (nglyph--) + { + pci = *ppci++; + height = pci->metrics.ascent + pci->metrics.descent; + width = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing; + /* + * For glyphs wider than 16 pixels, expand the blt to the nearest multiple + * of 32; this allows the scanlines to be padded to a 32-bit boundary + * instead of requiring byte packing + */ + if (width > 16) + width = (width + 31) & ~31; + bwidth = (width + 7) >> 3; + nb = bwidth * height; + if (nb) + { + dst = sisExpandAlloc (&expand, nb); + + sis->u.general.src_base = expand.off; + sis->u.general.src_pitch = 0; + sis->u.general.src_x = 0; + sis->u.general.src_y = 0; + sis->u.general.dst_x = x + pci->metrics.leftSideBearing; + sis->u.general.dst_y = y - pci->metrics.ascent; + sis->u.general.rect_width = width; + sis->u.general.rect_height = height; + switch (bwidth) { + case 1: + bits8 = (CARD8 *) pci->bits; + while (height >= 4) + { + d = (bits8[0] | (bits8[4] << 8) | + (bits8[8] << 16) | (bits8[12] << 24)); + SisInvertBits32(d); + *dst++ = d; + bits8 += 16; + height -= 4; + } + if (height) + { + switch (height) { + case 3: + d = bits8[0] | (bits8[4] << 8) | (bits8[8] << 16); + break; + case 2: + d = bits8[0] | (bits8[4] << 8); + break; + case 1: + d = bits8[0]; + break; + } + SisInvertBits32(d); + *dst++ = d; + } + break; + case 2: + bits16 = (CARD16 *) pci->bits; + while (height >= 2) + { + d = bits16[0] | (bits16[2] << 16); + SisInvertBits32(d); + *dst++ = d; + bits16 += 4; + height -= 2; + } + if (height) + { + d = bits16[0]; + SisInvertBits32(d); + *dst++ = d; + } + break; + default: + nb >>= 2; + bits32 = (CARD32 *) pci->bits; + while (nb--) + { + d = *bits32++; + SisInvertBits32 (d); + *dst++ = d; + } + } + sis->u.general.command = cmd; + } + x += pci->metrics.characterWidth; + } + KdMarkSync (pDrawable->pScreen); + return TRUE; +} +/* + * Blt glyphs using Sis image transfer register, this does both + * poly glyph blt and image glyph blt (when pglyphBase == 1) + */ + +void +sisPolyGlyphBlt (DrawablePtr pDrawable, + GCPtr pGC, + int x, int y, + unsigned int nglyph, + CharInfoPtr *ppci, + pointer pglyphBase) +{ + FbBits depthMask; + + depthMask = FbFullMask (pDrawable->depth); + if ((pGC->planemask & depthMask) == depthMask && + pGC->fillStyle == FillSolid) + { + if (TERMINALFONT(pGC->font)) + { + if (sisTEGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, FALSE)) + return; + } + else + { + if (sisGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, FALSE)) + return; + } + } + KdCheckPolyGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); +} + +void +sisImageGlyphBlt (DrawablePtr pDrawable, + GCPtr pGC, + int x, int y, + unsigned int nglyph, + CharInfoPtr *ppci, + pointer pglyphBase) +{ + FbBits depthMask; + + depthMask = FbFullMask (pDrawable->depth); + if ((pGC->planemask & depthMask) == depthMask) + { + if (TERMINALFONT(pGC->font)) + { + if (sisTEGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, TRUE)) + return; + } + else + { + if (sisGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, TRUE)) + return; + } + } + KdCheckImageGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); +} + +#define sourceInvarient(alu) (((alu) & 3) == (((alu) >> 2) & 3)) + +#define sisPatternDimOk(d) ((d) <= 8 && (((d) & ((d) - 1)) == 0)) + +BOOL +sisFillOk (GCPtr pGC) +{ + FbBits depthMask; + + depthMask = FbFullMask(pGC->depth); + if ((pGC->planemask & depthMask) != depthMask) + return FALSE; + switch (pGC->fillStyle) { + case FillSolid: + return TRUE; + case FillTiled: + return (sisPatternDimOk (pGC->tile.pixmap->drawable.width) && + sisPatternDimOk (pGC->tile.pixmap->drawable.height)); + case FillStippled: + case FillOpaqueStippled: + return (sisPatternDimOk (pGC->stipple->drawable.width) && + sisPatternDimOk (pGC->stipple->drawable.height)); + } +} + +CARD32 +sisStipplePrepare (DrawablePtr pDrawable, GCPtr pGC) +{ + SetupSis(pGC->pScreen); + PixmapPtr pStip = pGC->stipple; + int stipHeight = pStip->drawable.height; + int xRot, yRot; + int rot, stipX, stipY; + FbStip *stip, *stipEnd, bits; + FbStride stipStride; + int stipBpp; + int stipXoff, stipYoff; /* XXX assumed to be zero */ + int y; + CARD32 cmd; + + xRot = pGC->patOrg.x + pDrawable->x; + yRot = pGC->patOrg.y + pDrawable->y; + modulus (- yRot, stipHeight, stipY); + modulus (- xRot, FB_UNIT, stipX); + rot = stipX; + + fbGetStipDrawable (&pStip->drawable, stip, stipStride, stipBpp, stipXoff, stipYoff); + for (y = 0; y < 8; y++) + { + bits = stip[stipY<<1]; + FbRotLeft(bits, rot); + SisInvertBits32(bits); + sis->u.general.mask[y] = (CARD8) bits; + stipY++; + if (stipY == stipHeight) + stipY = 0; + } + sis->u.general.pattern_fg = pGC->fgPixel; + + cmd = (SIS_CMD_BITBLT | + SIS_CMD_SRC_SCREEN | + SIS_CMD_PAT_MONO | + (sisPatRop[pGC->alu] << 8) | + SIS_CMD_INC_X | + SIS_CMD_INC_Y | + SIS_CMD_RECT_CLIP_DISABLE | + SIS_CMD_RECT_CLIP_DONT_MERGE); + if (pGC->fillStyle == FillOpaqueStippled) + { + sis->u.general.pattern_bg = pGC->bgPixel; + cmd |= SIS_CMD_OPAQUE; + } + else + cmd |= SIS_CMD_TRANSPARENT; + return cmd; +} + +CARD32 +sisTilePrepare (PixmapPtr pTile, int xRot, int yRot, CARD8 alu) +{ + SetupSis(pTile->drawable.pScreen); + int tileHeight = pTile->drawable.height; + int tileWidth = pTile->drawable.width; + FbBits *tile; + FbStride tileStride; + int tileBpp; + int tileXoff, tileYoff; /* XXX assumed to be zero */ + + fbGetDrawable (&pTile->drawable, tile, tileStride, tileBpp, tileXoff, tileYoff); + + /* + * Tile the pattern register + */ + fbTile ((FbBits *) sis->u.general.pattern, + (8 * tileBpp) >> FB_SHIFT, + 0, + + 8 * tileBpp, 8, + + tile, + tileStride, + tileWidth * tileBpp, + tileHeight, + GXcopy, FB_ALLONES, tileBpp, + xRot * tileBpp, + yRot); + + return (SIS_CMD_BITBLT | + SIS_CMD_SRC_SCREEN | + SIS_CMD_PAT_PATTERN | + (sisPatRop[alu] << 8) | + SIS_CMD_INC_X | + SIS_CMD_INC_Y | + SIS_CMD_RECT_CLIP_DISABLE | + SIS_CMD_RECT_CLIP_DONT_MERGE); +} + +void +sisFillBoxSolid (DrawablePtr pDrawable, int nBox, BoxPtr pBox, + unsigned long pixel, int alu) +{ + SetupSis(pDrawable->pScreen); + CARD32 cmd; + + _sisSetSolidRect(sis,pixel,alu,cmd); + + while (nBox--) + { + _sisRect(sis,pBox->x1,pBox->y1,pBox->x2-pBox->x1,pBox->y2-pBox->y1,cmd); + pBox++; + } + KdMarkSync (pDrawable->pScreen); +} + +void +sisFillBoxStipple (DrawablePtr pDrawable, GCPtr pGC, + int nBox, BoxPtr pBox) +{ + SetupSis(pDrawable->pScreen); + CARD32 cmd; + + cmd = sisStipplePrepare (pDrawable, pGC); + + while (nBox--) + { + _sisRect(sis,pBox->x1,pBox->y1,pBox->x2-pBox->x1,pBox->y2-pBox->y1,cmd); + pBox++; + } + KdMarkSync (pDrawable->pScreen); +} + +void +sisFillBoxTiled (DrawablePtr pDrawable, + int nBox, BoxPtr pBox, + PixmapPtr pTile, int xRot, int yRot, CARD8 alu) +{ + SetupSis (pDrawable->pScreen); + CARD32 cmd; + + cmd = sisTilePrepare (pTile, xRot, yRot, alu); + + while (nBox--) + { + _sisRect(sis,pBox->x1,pBox->y1,pBox->x2-pBox->x1,pBox->y2-pBox->y1,cmd); + pBox++; + } + KdMarkSync (pDrawable->pScreen); +} + +/* + sisDoBitBlt + ============= + Bit Blit for all window to window blits. +*/ + +void +sisCopyNtoN (DrawablePtr pSrcDrawable, + DrawablePtr pDstDrawable, + GCPtr pGC, + BoxPtr pbox, + int nbox, + int dx, + int dy, + Bool reverse, + Bool upsidedown, + Pixel bitplane, + void *closure) +{ + SetupSis(pDstDrawable->pScreen); + int srcX, srcY, dstX, dstY; + int w, h; + CARD32 flags; + CARD32 cmd; + CARD8 alu; + + if (pGC) + { + alu = pGC->alu; + if (sourceInvarient (pGC->alu)) + { + sisFillBoxSolid (pDstDrawable, nbox, pbox, 0, pGC->alu); + return; + } + } + else + alu = GXcopy; + + _sisSetBlt(sis,alu,cmd); + while (nbox--) + { + w = pbox->x2 - pbox->x1; + h = pbox->y2 - pbox->y1; + flags = 0; + if (reverse) + { + dstX = pbox->x2 - 1; + } + else + { + dstX = pbox->x1; + flags |= SIS_CMD_INC_X; + } + srcX = dstX + dx; + + if (upsidedown) + { + dstY = pbox->y2 - 1; + } + else + { + dstY = pbox->y1; + flags |= SIS_CMD_INC_Y; + } + srcY = dstY + dy; + + _sisBlt (sis, srcX, srcY, dstX, dstY, w, h, cmd|flags); + pbox++; + } + KdMarkSync (pDstDrawable->pScreen); +} + +RegionPtr +sisCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, + int srcx, int srcy, int width, int height, int dstx, int dsty) +{ + KdScreenPriv(pDstDrawable->pScreen); + FbBits depthMask; + + depthMask = FbFullMask (pDstDrawable->depth); + if ((pGC->planemask & depthMask) == depthMask && + pSrcDrawable->type == DRAWABLE_WINDOW && + pDstDrawable->type == DRAWABLE_WINDOW) + { + return fbDoCopy (pSrcDrawable, pDstDrawable, pGC, + srcx, srcy, width, height, + dstx, dsty, sisCopyNtoN, 0, 0); + } + return KdCheckCopyArea (pSrcDrawable, pDstDrawable, pGC, + srcx, srcy, width, height, dstx, dsty); +} + +typedef struct _sis1toNargs { + unsigned long copyPlaneFG, copyPlaneBG; +} sis1toNargs; + +void +_sisStipple (ScreenPtr pScreen, + FbStip *psrcBase, + FbStride widthSrc, + CARD8 alu, + int srcx, + int srcy, + int dstx, + int dsty, + int width, + int height) +{ + SetupSis(pScreen); + FbStip *psrcLine, *psrc; + FbStride widthRest; + FbStip bits, tmp, lastTmp; + int leftShift, rightShift; + int nl, nlMiddle; + int r; + SisExpand expand; + CARD32 *dst; + int hthis; + int hper; + int bwidth; + CARD32 cmd; + + sisExpandInit (pScreen, &expand); + + /* Compute blt address and parameters */ + psrc = psrcBase + srcy * widthSrc + (srcx >> 5); + nlMiddle = (width + 31) >> 5; + leftShift = srcx & 0x1f; + rightShift = 32 - leftShift; + widthRest = widthSrc - nlMiddle; + + cmd = (SIS_CMD_ENH_COLOR_EXPAND | + SIS_CMD_SRC_SCREEN | + SIS_CMD_PAT_FG | + (sisBltRop[alu] << 8) | + SIS_CMD_INC_X | + SIS_CMD_INC_Y | + SIS_CMD_OPAQUE | + SIS_CMD_RECT_CLIP_ENABLE); + + if (leftShift != 0) + widthRest--; + + sis->u.general.src_x = 0; + sis->u.general.src_y = 0; + sis->u.general.dst_x = dstx; + sis->u.general.rect_width = (width + 31) & ~31; + sis->u.general.clip_right = (dstx + width); + + bwidth = nlMiddle << 2; + hper = SIS_PATTERN_INC / bwidth; + if (hper == 0) + hper = 1; + + while (height) + { + hthis = hper; + if (hthis > height) + hthis = height; + dst = sisExpandAlloc (&expand, bwidth * hthis); + sis->u.general.src_base = expand.off; + sis->u.general.dst_y = dsty; + sis->u.general.rect_height = hthis; + + dsty += hthis; + height -= hthis; + + if (leftShift == 0) + { + while (hthis--) + { + nl = nlMiddle; + while (nl--) + { + tmp = *psrc++; + SisInvertBits32(tmp); + *dst++ = tmp; + } + psrc += widthRest; + } + } + else + { + while (hthis--) + { + bits = *psrc++; + nl = nlMiddle; + while (nl--) + { + tmp = FbStipLeft(bits, leftShift); + bits = *psrc++; + tmp |= FbStipRight(bits, rightShift); + SisInvertBits32(tmp); + *dst++ = tmp; + } + psrc += widthRest; + } + } + sis->u.general.command = cmd; + } + sis->u.general.clip_right = pScreenPriv->screen->width; +} + +void +sisCopy1toN (DrawablePtr pSrcDrawable, + DrawablePtr pDstDrawable, + GCPtr pGC, + BoxPtr pbox, + int nbox, + int dx, + int dy, + Bool reverse, + Bool upsidedown, + Pixel bitplane, + void *closure) +{ + SetupSis(pDstDrawable->pScreen); + + sis1toNargs *args = closure; + int dstx, dsty; + FbStip *psrcBase; + FbStride widthSrc; + int srcBpp; + int srcXoff, srcYoff; + + if (sourceInvarient (pGC->alu)) + { + sisFillBoxSolid (pDstDrawable, nbox, pbox, + pGC->bgPixel, pGC->alu); + return; + } + + fbGetStipDrawable (pSrcDrawable, psrcBase, widthSrc, srcBpp, srcXoff, srcYoff); + + sis->u.general.src_fg = args->copyPlaneFG; + sis->u.general.src_bg = args->copyPlaneBG; + + while (nbox--) + { + dstx = pbox->x1; + dsty = pbox->y1; + + _sisStipple (pDstDrawable->pScreen, + psrcBase, widthSrc, + pGC->alu, + dstx + dx - srcXoff, dsty + dy - srcYoff, + dstx, dsty, + pbox->x2 - dstx, pbox->y2 - dsty); + pbox++; + } + KdMarkSync (pDstDrawable->pScreen); +} + +RegionPtr +sisCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, + int srcx, int srcy, int width, int height, + int dstx, int dsty, unsigned long bitPlane) +{ + KdScreenPriv (pDstDrawable->pScreen); + RegionPtr ret; + sis1toNargs args; + FbBits depthMask; + + depthMask = FbFullMask (pDstDrawable->depth); + if ((pGC->planemask & depthMask) == depthMask && + pDstDrawable->type == DRAWABLE_WINDOW && + pSrcDrawable->depth == 1) + { + args.copyPlaneFG = pGC->fgPixel; + args.copyPlaneBG = pGC->bgPixel; + return fbDoCopy (pSrcDrawable, pDstDrawable, pGC, + srcx, srcy, width, height, + dstx, dsty, sisCopy1toN, bitPlane, &args); + } + return KdCheckCopyPlane(pSrcDrawable, pDstDrawable, pGC, + srcx, srcy, width, height, + dstx, dsty, bitPlane); +} + +void +sisFillSpans (DrawablePtr pDrawable, GCPtr pGC, int n, + DDXPointPtr ppt, int *pwidth, int fSorted) +{ + SetupSis(pDrawable->pScreen); + DDXPointPtr pptFree; + FbGCPrivPtr fbPriv = fbGetGCPrivate(pGC); + int *pwidthFree;/* copies of the pointers to free */ + CARD32 cmd; + int nTmp; + INT16 x, y; + int width; + + if (!sisFillOk (pGC)) + { + KdCheckFillSpans (pDrawable, pGC, n, ppt, pwidth, fSorted); + return; + } + nTmp = n * miFindMaxBand(fbGetCompositeClip(pGC)); + pwidthFree = (int *)ALLOCATE_LOCAL(nTmp * sizeof(int)); + pptFree = (DDXPointRec *)ALLOCATE_LOCAL(nTmp * sizeof(DDXPointRec)); + if(!pptFree || !pwidthFree) + { + if (pptFree) DEALLOCATE_LOCAL(pptFree); + if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); + return; + } + n = miClipSpans(fbGetCompositeClip(pGC), + ppt, pwidth, n, + pptFree, pwidthFree, fSorted); + pwidth = pwidthFree; + ppt = pptFree; + switch (pGC->fillStyle) { + case FillSolid: + _sisSetSolidRect(sis,pGC->fgPixel,pGC->alu,cmd); + break; + case FillTiled: + cmd = sisTilePrepare (pGC->tile.pixmap, + pGC->patOrg.x + pDrawable->x, + pGC->patOrg.y + pDrawable->y, + pGC->alu); + break; + default: + cmd = sisStipplePrepare (pDrawable, pGC); + break; + } + while (n--) + { + x = ppt->x; + y = ppt->y; + ppt++; + width = *pwidth++; + if (width) + { + _sisRect(sis,x,y,width,1,cmd); + } + } + KdMarkSync (pDrawable->pScreen); + DEALLOCATE_LOCAL(pptFree); + DEALLOCATE_LOCAL(pwidthFree); +} + +#define NUM_STACK_RECTS 1024 + +void +sisPolyFillRect (DrawablePtr pDrawable, GCPtr pGC, + int nrectFill, xRectangle *prectInit) +{ + SetupSis(pDrawable->pScreen); + xRectangle *prect; + RegionPtr prgnClip; + register BoxPtr pbox; + register BoxPtr pboxClipped; + BoxPtr pboxClippedBase; + BoxPtr pextent; + BoxRec stackRects[NUM_STACK_RECTS]; + FbGCPrivPtr fbPriv = fbGetGCPrivate (pGC); + int numRects; + int n; + int xorg, yorg; + int x, y; + + if (!sisFillOk (pGC)) + { + KdCheckPolyFillRect (pDrawable, pGC, nrectFill, prectInit); + return; + } + prgnClip = fbGetCompositeClip(pGC); + xorg = pDrawable->x; + yorg = pDrawable->y; + + if (xorg || yorg) + { + prect = prectInit; + n = nrectFill; + while(n--) + { + prect->x += xorg; + prect->y += yorg; + prect++; + } + } + + prect = prectInit; + + numRects = REGION_NUM_RECTS(prgnClip) * nrectFill; + if (numRects > NUM_STACK_RECTS) + { + pboxClippedBase = (BoxPtr)ALLOCATE_LOCAL(numRects * sizeof(BoxRec)); + if (!pboxClippedBase) + return; + } + else + pboxClippedBase = stackRects; + + pboxClipped = pboxClippedBase; + + if (REGION_NUM_RECTS(prgnClip) == 1) + { + int x1, y1, x2, y2, bx2, by2; + + pextent = REGION_RECTS(prgnClip); + x1 = pextent->x1; + y1 = pextent->y1; + x2 = pextent->x2; + y2 = pextent->y2; + while (nrectFill--) + { + if ((pboxClipped->x1 = prect->x) < x1) + pboxClipped->x1 = x1; + + if ((pboxClipped->y1 = prect->y) < y1) + pboxClipped->y1 = y1; + + bx2 = (int) prect->x + (int) prect->width; + if (bx2 > x2) + bx2 = x2; + pboxClipped->x2 = bx2; + + by2 = (int) prect->y + (int) prect->height; + if (by2 > y2) + by2 = y2; + pboxClipped->y2 = by2; + + prect++; + if ((pboxClipped->x1 < pboxClipped->x2) && + (pboxClipped->y1 < pboxClipped->y2)) + { + pboxClipped++; + } + } + } + else + { + int x1, y1, x2, y2, bx2, by2; + + pextent = REGION_EXTENTS(pGC->pScreen, prgnClip); + x1 = pextent->x1; + y1 = pextent->y1; + x2 = pextent->x2; + y2 = pextent->y2; + while (nrectFill--) + { + BoxRec box; + + if ((box.x1 = prect->x) < x1) + box.x1 = x1; + + if ((box.y1 = prect->y) < y1) + box.y1 = y1; + + bx2 = (int) prect->x + (int) prect->width; + if (bx2 > x2) + bx2 = x2; + box.x2 = bx2; + + by2 = (int) prect->y + (int) prect->height; + if (by2 > y2) + by2 = y2; + box.y2 = by2; + + prect++; + + if ((box.x1 >= box.x2) || (box.y1 >= box.y2)) + continue; + + n = REGION_NUM_RECTS (prgnClip); + pbox = REGION_RECTS(prgnClip); + + /* clip the rectangle to each box in the clip region + this is logically equivalent to calling Intersect() + */ + while(n--) + { + pboxClipped->x1 = max(box.x1, pbox->x1); + pboxClipped->y1 = max(box.y1, pbox->y1); + pboxClipped->x2 = min(box.x2, pbox->x2); + pboxClipped->y2 = min(box.y2, pbox->y2); + pbox++; + + /* see if clipping left anything */ + if(pboxClipped->x1 < pboxClipped->x2 && + pboxClipped->y1 < pboxClipped->y2) + { + pboxClipped++; + } + } + } + } + if (pboxClipped != pboxClippedBase) + { + switch (pGC->fillStyle) { + case FillSolid: + sisFillBoxSolid(pDrawable, + pboxClipped-pboxClippedBase, pboxClippedBase, + pGC->fgPixel, pGC->alu); + break; + case FillTiled: + sisFillBoxTiled(pDrawable, + pboxClipped-pboxClippedBase, pboxClippedBase, + pGC->tile.pixmap, + pGC->patOrg.x + pDrawable->x, + pGC->patOrg.y + pDrawable->y, + pGC->alu); + break; + case FillStippled: + case FillOpaqueStippled: + sisFillBoxStipple (pDrawable, pGC, + pboxClipped-pboxClippedBase, pboxClippedBase); + break; + } + } + if (pboxClippedBase != stackRects) + DEALLOCATE_LOCAL(pboxClippedBase); +} + +static const GCOps sisOps = { + sisFillSpans, + KdCheckSetSpans, + KdCheckPutImage, + sisCopyArea, + sisCopyPlane, + KdCheckPolyPoint, + KdCheckPolylines, + KdCheckPolySegment, + miPolyRectangle, + KdCheckPolyArc, + miFillPolygon, + sisPolyFillRect, + KdCheckPolyFillArc, + miPolyText8, + miPolyText16, + miImageText8, + miImageText16, + sisImageGlyphBlt, + sisPolyGlyphBlt, + KdCheckPushPixels, +}; + +void +sisValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable) +{ + FbGCPrivPtr fbPriv = fbGetGCPrivate(pGC); + + fbValidateGC (pGC, changes, pDrawable); + + if (pDrawable->type == DRAWABLE_WINDOW) + pGC->ops = (GCOps *) &sisOps; + else + pGC->ops = (GCOps *) &kdAsyncPixmapGCOps; +} + +GCFuncs sisGCFuncs = { + sisValidateGC, + miChangeGC, + miCopyGC, + miDestroyGC, + miChangeClip, + miDestroyClip, + miCopyClip +}; + +int +sisCreateGC (GCPtr pGC) +{ + if (!fbCreateGC (pGC)) + return FALSE; + + if (pGC->depth != 1) + pGC->funcs = &sisGCFuncs; + + pGC->ops = (GCOps *) &kdAsyncPixmapGCOps; + + return TRUE; +} + +void +sisCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + KdScreenPriv(pScreen); + RegionRec rgnDst; + int dx, dy; + WindowPtr pwinRoot; + + pwinRoot = WindowTable[pWin->drawable.pScreen->myNum]; + + dx = ptOldOrg.x - pWin->drawable.x; + dy = ptOldOrg.y - pWin->drawable.y; + REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy); + + REGION_INIT (pWin->drawable.pScreen, &rgnDst, NullBox, 0); + + REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst, &pWin->borderClip, prgnSrc); + + fbCopyRegion ((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot, + 0, + &rgnDst, dx, dy, sisCopyNtoN, 0, 0); + + REGION_UNINIT(pWin->drawable.pScreen, &rgnDst); +} + +void +sisPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) +{ + KdScreenPriv(pWin->drawable.pScreen); + PixmapPtr pTile; + + if (!REGION_NUM_RECTS(pRegion)) + return; + switch (what) { + case PW_BACKGROUND: + switch (pWin->backgroundState) { + case None: + return; + case ParentRelative: + do { + pWin = pWin->parent; + } while (pWin->backgroundState == ParentRelative); + (*pWin->drawable.pScreen->PaintWindowBackground)(pWin, pRegion, + what); + return; + case BackgroundPixmap: + pTile = pWin->background.pixmap; + if (sisPatternDimOk (pTile->drawable.width) && + sisPatternDimOk (pTile->drawable.height)) + { + sisFillBoxTiled ((DrawablePtr)pWin, + (int)REGION_NUM_RECTS(pRegion), + REGION_RECTS(pRegion), + pTile, + pWin->drawable.x, pWin->drawable.y, GXcopy); + return; + } + break; + case BackgroundPixel: + sisFillBoxSolid((DrawablePtr)pWin, + (int)REGION_NUM_RECTS(pRegion), + REGION_RECTS(pRegion), + pWin->background.pixel, GXcopy); + return; + } + break; + case PW_BORDER: + if (pWin->borderIsPixel) + { + sisFillBoxSolid((DrawablePtr)pWin, + (int)REGION_NUM_RECTS(pRegion), + REGION_RECTS(pRegion), + pWin->border.pixel, GXcopy); + return; + } + else + { + pTile = pWin->border.pixmap; + if (sisPatternDimOk (pTile->drawable.width) && + sisPatternDimOk (pTile->drawable.height)) + { + sisFillBoxTiled ((DrawablePtr)pWin, + (int)REGION_NUM_RECTS(pRegion), + REGION_RECTS(pRegion), + pTile, + pWin->drawable.x, pWin->drawable.y, GXcopy); + return; + } + } + break; + } + KdCheckPaintWindow (pWin, pRegion, what); +} + +Bool +sisDrawInit (ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + sisScreenInfo(pScreenPriv); + + /* + * Hook up asynchronous drawing + */ + KdScreenInitAsync (pScreen); + /* + * Replace various fb screen functions + */ + pScreen->CreateGC = sisCreateGC; + pScreen->CopyWindow = sisCopyWindow; + pScreen->PaintWindowBackground = sisPaintWindow; + pScreen->PaintWindowBorder = sisPaintWindow; + + return TRUE; +} + +void +sisDrawEnable (ScreenPtr pScreen) +{ + SetupSis(pScreen); + sisScreenInfo(pScreenPriv); + CARD32 cmd; + CARD32 base; + CARD16 stride; + CARD16 op; + + base = pScreenPriv->screen->fb[0].frameBuffer - sisc->frameBuffer; + stride = pScreenPriv->screen->fb[0].byteStride; +#if 0 + sis->u.general.dst_base = base; + sis->u.general.dst_pitch = stride; + sis->u.general.src_pitch = stride; + sis->u.general._pad0 = stride; + sis->u.general.dst_height = pScreenPriv->screen->height; + _sisClip (sis, 0, 0, + pScreenPriv->screen->width, pScreenPriv->screen->height); + _sisSetSolidRect(sis, pScreen->blackPixel, GXcopy, cmd); + _sisRect (sis, 0, 0, + pScreenPriv->screen->width, pScreenPriv->screen->height, + cmd); +#endif + base = (CARD32) (pScreenPriv->screen->fb[0].frameBuffer); + fprintf (stderr, "src 0x%x\n", sis->u.accel.src_addr); + sis->u.accel.src_addr = (base & 0x3fffff); + fprintf (stderr, "src 0x%x\n", sis->u.accel.src_addr); + sis->u.accel.dst_addr = (base & 0x3fffff); + sis->u.accel.pitch = (stride << 16) | stride; + sis->u.accel.dimension = ((pScreenPriv->screen->height-1) << 16 | + (pScreenPriv->screen->width - 1)); + sis->u.accel.fg = (sisBltRop[GXcopy] << 24) | 0xf800; + sis->u.accel.bg = (sisBltRop[GXcopy] << 24) | 0x00; + +#define sisLEFT2RIGHT 0x10 +#define sisRIGHT2LEFT 0x00 +#define sisTOP2BOTTOM 0x20 +#define sisBOTTOM2TOP 0x00 + +#define sisSRCSYSTEM 0x03 +#define sisSRCVIDEO 0x02 +#define sisSRCFG 0x01 +#define sisSRCBG 0x00 + +#define sisCMDBLT 0x0000 +#define sisCMDBLTMSK 0x0100 +#define sisCMDCOLEXP 0x0200 +#define sisCMDLINE 0x0300 + +#define sisCMDENHCOLEXP 0x2000 + +#define sisXINCREASE 0x10 +#define sisYINCREASE 0x20 +#define sisCLIPENABL 0x40 +#define sisCLIPINTRN 0x80 +#define sisCLIPEXTRN 0x00 + + +#define sisPATREG 0x08 +#define sisPATFG 0x04 +#define sisPATBG 0x00 + +#define sisLASTPIX 0x0800 +#define sisXMAJOR 0x0400 + + op = sisCMDBLT | sisLEFT2RIGHT | sisTOP2BOTTOM | sisSRCFG | sisPATFG; + + sis->u.accel.cmd = op; + + KdMarkSync (pScreen); +} + +void +sisDrawSync (ScreenPtr pScreen) +{ + SetupSis(pScreen); + + _sisWaitIdleEmpty (sis); +} + +void +sisDrawDisable (ScreenPtr pScreen) +{ +} + +void +sisDrawFini (ScreenPtr pScreen) +{ +} --- xorg-server-1.4.2.orig/hw/kdrive/fake/Makefile.in +++ xorg-server-1.4.2/hw/kdrive/fake/Makefile.in @@ -151,7 +151,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -285,10 +285,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/kdrive/igs/igscurs.c +++ xorg-server-1.4.2/hw/kdrive/igs/igscurs.c @@ -0,0 +1,345 @@ +/* + * 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_CONFIG_H +#include +#endif +#include "igs.h" +#include "cursorstr.h" + +#define SetupCursor(s) KdScreenPriv(s); \ + igsCardInfo(pScreenPriv); \ + igsScreenInfo(pScreenPriv); \ + IgsCursor *pCurPriv = &igss->cursor; \ + IgsVga *igsvga = &igsc->igsvga + +static void +_igsMoveCursor (ScreenPtr pScreen, int x, int y) +{ + SetupCursor(pScreen); + CARD8 xoff, yoff; + + x -= pCurPriv->xhot; + xoff = 0; + if (x < 0) + { + xoff = -x; + x = 0; + } + y -= pCurPriv->yhot; + yoff = 0; + if (y < 0) + { + yoff = -y; + y = 0; + } + + igsSet (igsvga, igs_sprite_x, x); + igsSet (igsvga, igs_sprite_preset_x, xoff); + igsSet (igsvga, igs_sprite_y, y); + igsSet (igsvga, igs_sprite_preset_y, yoff); +} + +static void +igsMoveCursor (ScreenPtr pScreen, int x, int y) +{ + SetupCursor (pScreen); + + if (!pCurPriv->has_cursor) + return; + + if (!pScreenPriv->enabled) + return; + + _igsMoveCursor (pScreen, x, y); + VgaFlush (&igsvga->card); +} + + +static void +igsSetCursorColors (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + CursorPtr pCursor = pCurPriv->pCursor; + + igsSetImm (igsvga, igs_cursor_write_index, 0); + igsSetImm (igsvga, igs_cursor_data, pCursor->backRed >> 8); + igsSetImm (igsvga, igs_cursor_data, pCursor->backGreen >> 8); + igsSetImm (igsvga, igs_cursor_data, pCursor->backBlue >> 8); + igsSetImm (igsvga, igs_cursor_write_index, 1); + igsSetImm (igsvga, igs_cursor_data, pCursor->foreRed >> 8); + igsSetImm (igsvga, igs_cursor_data, pCursor->foreGreen >> 8); + igsSetImm (igsvga, igs_cursor_data, pCursor->foreBlue >> 8); +} + +#if BITMAP_BIT_ORDER == MSBFirst +#define IgsAdjustCursor(v) { \ + v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \ + v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \ + v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \ + v = ((v & 0x00ff00ff) << 8) | ((v >> 8) & 0x00ff00ff); \ + v = ((v & 0x0000ffff) <<16) | ((v >>16) & 0x0000ffff); \ +} +#else +#define IgsAdjustCursor(v) +#endif + +#define ExplodeBits2(v) (((v) & 1) | (((v) & 2) << 1)) +#define ExplodeBits4(v) ((ExplodeBits2((v) >> 2) << 4) | \ + (ExplodeBits2((v) & 0x3))) +#define ExplodeBits8(v) ((ExplodeBits4((v) >> 4) << 8) | \ + (ExplodeBits4((v) & 0xf))) +#define ExplodeBits16(v) ((ExplodeBits8((v) >> 8) << 16) | \ + (ExplodeBits8((v) & 0xff))) +static void +igsLoadCursor (ScreenPtr pScreen, int x, int y) +{ + SetupCursor(pScreen); + CursorPtr pCursor = pCurPriv->pCursor; + CursorBitsPtr bits = pCursor->bits; + int w, h; + CARD32 *ram, *msk, *mskLine, *src, *srcLine; + int i, j; + int cursor_address; + int lwsrc; + unsigned char ramdac_control_; + CARD32 offset; + CARD32 b0, b1; + + pCurPriv->pCursor = pCursor; + pCurPriv->xhot = pCursor->bits->xhot; + pCurPriv->yhot = pCursor->bits->yhot; + + /* + * Stick new image into cursor memory + */ + ram = (CARD32 *) igss->cursor_base; + mskLine = (CARD32 *) bits->mask; + srcLine = (CARD32 *) bits->source; + + h = bits->height; + if (h > IGS_CURSOR_HEIGHT) + h = IGS_CURSOR_HEIGHT; + + lwsrc = BitmapBytePad(bits->width) / 4; /* words per line */ + + for (i = 0; i < IGS_CURSOR_HEIGHT; i++) { + msk = mskLine; + src = srcLine; + mskLine += lwsrc; + srcLine += lwsrc; + for (j = 0; j < IGS_CURSOR_WIDTH / 32; j++) { + + CARD32 m, s; + + if (i < h && j < lwsrc) + { + m = *msk++; + s = *src++; + IgsAdjustCursor(m); + IgsAdjustCursor(s); + } + else + { + m = 0; + s = 0; + } + s &= m; + m = ~m; + b0 = ExplodeBits16(s&0xffff) | (ExplodeBits16(m&0xffff)<<1); + b1 = ExplodeBits16(s>>16) | (ExplodeBits16(m>>16)<<1); + *ram++ = b0; + *ram++ = b1; + } + } + + /* Set new color */ + igsSetCursorColors (pScreen); + + /* Set address for cursor bits */ + offset = igss->cursor_offset; + offset >>= 10; + igsSet (igsvga, igs_sprite_addr, offset); + + /* Assume TV interpolation off */ + igsSet (igsvga, igs_hcshf, 3); + /* Enable the cursor */ + igsSet (igsvga, igs_sprite_visible, 1); + igsSet (igsvga, igs_sprite_64x64, 1); + /* Move to new position */ + _igsMoveCursor (pScreen, x, y); + + VgaFlush (&igsvga->card); +} + +static void +igsUnloadCursor (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + /* Disable cursor */ + igsSet (igsvga, igs_sprite_visible, 0); + VgaFlush (&igsvga->card); +} + +static Bool +igsRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) +{ + SetupCursor(pScreen); + + if (!pScreenPriv->enabled) + return TRUE; + + /* miRecolorCursor does this */ + if (pCurPriv->pCursor == pCursor) + { + if (pCursor) + { + int x, y; + + miPointerPosition (&x, &y); + igsLoadCursor (pScreen, x, y); + } + } + return TRUE; +} + +static Bool +igsUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) +{ + return TRUE; +} + +static void +igsSetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y) +{ + SetupCursor(pScreen); + + pCurPriv->pCursor = pCursor; + + if (!pScreenPriv->enabled) + return; + + if (pCursor) + igsLoadCursor (pScreen, x, y); + else + igsUnloadCursor (pScreen); +} + +miPointerSpriteFuncRec igsPointerSpriteFuncs = { + igsRealizeCursor, + igsUnrealizeCursor, + igsSetCursor, + igsMoveCursor, +}; + +static void +igsQueryBestSize (int class, + unsigned short *pwidth, unsigned short *pheight, + ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + switch (class) + { + case CursorShape: + if (*pwidth > pCurPriv->width) + *pwidth = pCurPriv->width; + if (*pheight > pCurPriv->height) + *pheight = pCurPriv->height; + if (*pwidth > pScreen->width) + *pwidth = pScreen->width; + if (*pheight > pScreen->height) + *pheight = pScreen->height; + break; + default: + fbQueryBestSize (class, pwidth, pheight, pScreen); + break; + } +} + +Bool +igsCursorInit (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + if (!igss->cursor_base) + { + pCurPriv->has_cursor = FALSE; + return FALSE; + } + + pCurPriv->width = IGS_CURSOR_WIDTH; + pCurPriv->height= IGS_CURSOR_HEIGHT; + pScreen->QueryBestSize = igsQueryBestSize; + miPointerInitialize (pScreen, + &igsPointerSpriteFuncs, + &kdPointerScreenFuncs, + FALSE); + pCurPriv->has_cursor = TRUE; + pCurPriv->pCursor = NULL; + return TRUE; +} + +void +igsCursorEnable (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + if (pCurPriv->has_cursor) + { + if (pCurPriv->pCursor) + { + int x, y; + + miPointerPosition (&x, &y); + igsLoadCursor (pScreen, x, y); + } + else + igsUnloadCursor (pScreen); + } +} + +void +igsCursorDisable (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + if (!pScreenPriv->enabled) + return; + + if (pCurPriv->has_cursor) + { + if (pCurPriv->pCursor) + { + igsUnloadCursor (pScreen); + } + } +} + +void +igsCursorFini (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + pCurPriv->pCursor = NULL; +} --- xorg-server-1.4.2.orig/hw/kdrive/igs/igsreg.h +++ xorg-server-1.4.2/hw/kdrive/igs/igsreg.h @@ -0,0 +1,155 @@ +/* + * 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. + */ + +#ifndef _IGSREG_H_ +#define _IGSREG_H_ + +#include "vga.h" + +#define IGS_SR 0 +#define IGS_NSR 5 +#define IGS_GR (IGS_SR+IGS_NSR) +#define IGS_NGR 0xC0 +#define IGS_GREX (IGS_GR+IGS_NGR) +#define IGS_GREXBASE 0x3c +#define IGS_NGREX 1 +#define IGS_AR (IGS_GREX+IGS_NGREX) +#define IGS_NAR 0x15 +#define IGS_CR (IGS_AR+IGS_NAR) +#define IGS_NCR 0x48 +#define IGS_DAC (IGS_CR+IGS_NCR) +#define IGS_NDAC 4 +#define IGS_DACEX (IGS_DAC+IGS_NDAC) +#define IGS_NDACEX 4 +#define IGS_MISC_OUT (IGS_DACEX + IGS_NDACEX) +#define IGS_INPUT_STATUS_1 (IGS_MISC_OUT+1) +#define IGS_NREG (IGS_INPUT_STATUS_1+1) + +extern VgaReg igs_h_total[]; +extern VgaReg igs_h_de_end[]; +extern VgaReg igs_h_bstart[]; +extern VgaReg igs_h_bend[]; +extern VgaReg igs_de_skew[]; +extern VgaReg igs_ena_vr_access[]; +extern VgaReg igs_h_rstart[]; +extern VgaReg igs_h_rend[]; +extern VgaReg igs_h_rdelay[]; +extern VgaReg igs_v_total[]; +extern VgaReg igs_v_rstart[]; +extern VgaReg igs_v_rend[]; +extern VgaReg igs_clear_v_int[]; +extern VgaReg igs_disable_v_int[]; +extern VgaReg igs_bandwidth[]; +extern VgaReg igs_crt_protect[]; +extern VgaReg igs_v_de_end[]; +extern VgaReg igs_offset[]; +extern VgaReg igs_v_bstart[]; +extern VgaReg igs_v_bend[]; +extern VgaReg igs_linecomp[]; +extern VgaReg igs_ivideo[]; +extern VgaReg igs_num_fetch[]; +extern VgaReg igs_wcrt0[]; +extern VgaReg igs_wcrt1[]; +extern VgaReg igs_rcrts1[]; +extern VgaReg igs_selwk[]; +extern VgaReg igs_dot_clock_8[]; +extern VgaReg igs_screen_off[]; +extern VgaReg igs_enable_write_plane[]; +extern VgaReg igs_mexhsyn[]; +extern VgaReg igs_mexvsyn[]; +extern VgaReg igs_pci_burst_write[]; +extern VgaReg igs_pci_burst_read[]; +extern VgaReg igs_iow_retry[]; +extern VgaReg igs_mw_retry[]; +extern VgaReg igs_mr_retry[]; +extern VgaReg igs_biga22en[]; +extern VgaReg igs_biga24en[]; +extern VgaReg igs_biga22force[]; +extern VgaReg igs_bigswap[]; +#define IGS_BIGSWAP_8 0x3f +#define IGS_BIGSWAP_16 0x2a +#define IGS_BIGSWAP_32 0x00 +extern VgaReg igs_sprite_x[]; +extern VgaReg igs_sprite_preset_x[]; +extern VgaReg igs_sprite_y[]; +extern VgaReg igs_sprite_preset_y[]; +extern VgaReg igs_sprite_visible[]; +extern VgaReg igs_sprite_64x64[]; +extern VgaReg igs_mgrext[]; +extern VgaReg igs_hcshf[]; +extern VgaReg igs_mbpfix[]; +extern VgaReg igs_overscan_red[]; +extern VgaReg igs_overscan_green[]; +extern VgaReg igs_overscan_blue[]; +extern VgaReg igs_memgopg[]; +extern VgaReg igs_memr2wpg[]; +extern VgaReg igs_crtff16[]; +extern VgaReg igs_fifomust[]; +extern VgaReg igs_fifogen[]; +extern VgaReg igs_mode_sel[]; +#define IGS_MODE_TEXT 0 +#define IGS_MODE_8 1 +#define IGS_MODE_565 2 +#define IGS_MODE_5551 6 +#define IGS_MODE_8888 3 +#define IGS_MODE_888 4 +#define IGS_MODE_332 9 +#define IGS_MODE_4444 10 +extern VgaReg igs_sprite_addr[]; +extern VgaReg igs_fastmpie[]; +extern VgaReg igs_vclk_m[]; +extern VgaReg igs_vclk_n[]; +extern VgaReg igs_vfsel[]; +extern VgaReg igs_vclk_p[]; +extern VgaReg igs_frqlat[]; +extern VgaReg igs_dac_mask[]; +extern VgaReg igs_dac_read_index[]; +extern VgaReg igs_dac_write_index[]; +extern VgaReg igs_dac_data[]; +extern VgaReg igs_rampwdn[]; +extern VgaReg igs_dac6_8[]; +extern VgaReg igs_ramdacbypass[]; +extern VgaReg igs_dacpwdn[]; +extern VgaReg igs_cursor_read_index[]; +extern VgaReg igs_cursor_write_index[]; +extern VgaReg igs_cursor_data[]; + +#define igsGet(sv,r) VgaGet(&(sv)->card, (r)) +#define igsGetImm(sv,r) VgaGetImm(&(sv)->card, (r)) +#define igsSet(sv,r,v) VgaSet(&(sv)->card, (r), (v)) +#define igsSetImm(sv,r,v) VgaSetImm(&(sv)->card, (r), (v)) + +typedef struct _igsVga { + VgaCard card; + VgaValue values[IGS_NREG]; +} IgsVga; + +void +igsRegInit (IgsVga *igsvga, VGAVOL8 *mmio); + +void +igsSave (IgsVga *igsvga); + +void +igsReset (IgsVga *igsvga); + +#endif /* _IGSREG_H_ */ --- xorg-server-1.4.2.orig/hw/kdrive/igs/igs.c +++ xorg-server-1.4.2/hw/kdrive/igs/igs.c @@ -0,0 +1,667 @@ +/* + * Copyright © 1999 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_CONFIG_H +#include +#endif +#include "igs.h" + +Bool +igsCardInit (KdCardInfo *card) +{ + int k; + char *pixels; + IgsCardInfo *igsc; + + igsc = (IgsCardInfo *) xalloc (sizeof (IgsCardInfo)); + if (!igsc) + return FALSE; + + memset (igsc, '\0', sizeof (IgsCardInfo)); + + igsc->frameBuffer = (CARD8 *) KdMapDevice (card->attr.address[0] + + IGS_FB, + IGS_MEM); + + igsc->vga = (VOL8 *) KdMapDevice (card->attr.address[0] + + IGS_VGA, + 64 * 1024); + + igsc->cop = (Cop5xxx *) KdMapDevice (card->attr.address[0] + + IGS_COP_OFFSET, + sizeof (Cop5xxx)); + + igsc->copData = (VOL32 *) KdMapDevice (card->attr.address[0] + + IGS_COP_DATA, + IGS_COP_DATA_LEN); + + igsRegInit (&igsc->igsvga, igsc->vga); + + card->driver = igsc; + + return TRUE; +} + +Bool +igsModeSupported (KdScreenInfo *screen, + const KdMonitorTiming *t) +{ + /* make sure the clock isn't too fast */ + if (t->clock > IGS_MAX_CLOCK) + return FALSE; + /* width must be a multiple of 16 */ + if (t->horizontal & 0xf) + return FALSE; + return TRUE; +} + +Bool +igsModeUsable (KdScreenInfo *screen) +{ + KdCardInfo *card = screen->card; + int screen_size; + int pixel_width; + int byte_width; + int fb = 0; + + screen_size = 0; + if (screen->fb[fb].depth >= 24) + { + screen->fb[fb].depth = 24; + if (screen->fb[fb].bitsPerPixel != 24) + screen->fb[fb].bitsPerPixel = 32; + } + else if (screen->fb[fb].depth >= 16) + { + screen->fb[fb].depth = 16; + screen->fb[fb].bitsPerPixel = 16; + } + else if (screen->fb[fb].depth >= 15) + { + screen->fb[fb].depth = 15; + screen->fb[fb].bitsPerPixel = 16; + } + else if (screen->fb[fb].depth >= 12) + { + screen->fb[fb].depth = 12; + screen->fb[fb].bitsPerPixel = 16; + } + else + { + screen->fb[fb].depth = 8; + screen->fb[fb].bitsPerPixel = 8; + } + + byte_width = screen->width * (screen->fb[fb].bitsPerPixel >> 3); + pixel_width = screen->width; + screen->fb[fb].pixelStride = pixel_width; + screen->fb[fb].byteStride = byte_width; + screen_size += byte_width * screen->height; + + return TRUE; +} + +Bool +igsScreenInit (KdScreenInfo *screen) +{ + IgsCardInfo *igsc = screen->card->driver; + int fb = 0; + IgsScreenInfo *igss; + int screen_size, memory; + int pattern_size; + int tile_size; + int stipple_size; + int poffset, boffset; + const KdMonitorTiming *t; + + if (!screen->width || !screen->height) + { + screen->width = 800; + screen->height = 600; + screen->rate = 72; + } + if (!screen->fb[0].depth) + screen->fb[0].depth = 8; + + t = KdFindMode (screen, igsModeSupported); + + screen->rate = t->rate; + screen->width = t->horizontal; + screen->height = t->vertical; + + if (!KdTuneMode (screen, igsModeUsable, igsModeSupported)) + { + return FALSE; + } + + igss = (IgsScreenInfo *) xalloc (sizeof (IgsScreenInfo)); + if (!igss) + return FALSE; + + memset (igss, '\0', sizeof (IgsScreenInfo)); + + screen_size = screen->fb[fb].byteStride * screen->height; + memory = IGS_MEM; + memory -= screen_size; + if (memory >= 1024) + { + igss->cursor_offset = memory - 1024; +#if BITMAP_BIT_ORDER == MSBFirst + igss->cursor_base = (CARD8 *) KdMapDevice (card->attr.address[0] + + igss->cursor_offset, + 1024); +#else + igss->cursor_base = igsc->frameBuffer + igss->cursor_offset; +#endif + memory -= 1024; + } + else + igss->cursor_base = 0; + + tile_size = IgsTileSize(screen->fb[fb].bitsPerPixel) * IGS_NUM_PATTERN; + stipple_size = IgsStippleSize(screen->fb[fb].bitsPerPixel) * IGS_NUM_PATTERN; + pattern_size = tile_size + stipple_size; + if (memory >= pattern_size) + { + boffset = screen_size; + poffset = boffset * 8 / screen->fb[fb].bitsPerPixel; + igss->tile.offset = poffset; + igss->tile.base = igsc->frameBuffer + boffset; + + boffset = screen_size + tile_size; + poffset = boffset * 8 / screen->fb[fb].bitsPerPixel; + igss->stipple.offset = poffset; + igss->stipple.base = igsc->frameBuffer + boffset; + + memory -= pattern_size; + } + else + { + igss->tile.base = 0; + igss->stipple.base = 0; + } + + switch (screen->fb[fb].depth) { + case 8: + screen->fb[fb].visuals = ((1 << StaticGray) | + (1 << GrayScale) | + (1 << StaticColor) | + (1 << PseudoColor) | + (1 << TrueColor) | + (1 << DirectColor)); + screen->fb[fb].blueMask = 0x00; + screen->fb[fb].greenMask = 0x00; + screen->fb[fb].redMask = 0x00; + break; + case 15: + screen->fb[fb].visuals = (1 << TrueColor); + screen->fb[fb].blueMask = 0x001f; + screen->fb[fb].greenMask = 0x03e0; + screen->fb[fb].redMask = 0x7c00; + break; + case 16: + screen->fb[fb].visuals = (1 << TrueColor); + screen->fb[fb].blueMask = 0x001f; + screen->fb[fb].greenMask = 0x07e0; + screen->fb[fb].redMask = 0xf800; + break; + case 24: + screen->fb[fb].visuals = (1 << TrueColor); + screen->fb[fb].blueMask = 0x0000ff; + screen->fb[fb].greenMask = 0x00ff00; + screen->fb[fb].redMask = 0xff0000; + break; + } + + screen->fb[fb].pixelStride = screen->width; + screen->fb[fb].byteStride = screen->width * (screen->fb[fb].bitsPerPixel >> 3); + screen->fb[fb].frameBuffer = igsc->frameBuffer; + if (!igsc->cop) + screen->dumb = TRUE; + screen->driver = igss; + return TRUE; +} + +Bool +igsInitScreen(ScreenPtr pScreen) +{ + return TRUE; +} + +void +igsPreserve (KdCardInfo *card) +{ + IgsCardInfo *igsc = card->driver; + IgsVga *igsvga = &igsc->igsvga; + + igsSave (igsvga); +} + +void +igsSetBlank (IgsVga *igsvga, Bool blank) +{ + igsSetImm(igsvga, igs_screen_off, blank ? 1 : 0); +} + +void +igsSetSync (IgsCardInfo *igsc, int hsync, int vsync) +{ + IgsVga *igsvga = &igsc->igsvga; + + igsSet (igsvga, igs_mexhsyn, hsync); + igsSet (igsvga, igs_mexvsyn, vsync); + VgaFlush (&igsvga->card); +} + + +/* + * Clock synthesis: + * + * scale = p ? (2 * p) : 1 + * f_out = f_ref * ((M + 1) / ((N + 1) * scale)) + * + * Constraints: + * + * 1. 115MHz <= f_ref * ((M + 1) / (N + 1)) <= 260 MHz + * 2. N >= 1 + * + * Vertical refresh rate = clock / ((hsize + hblank) * (vsize + vblank)) + * Horizontal refresh rate = clock / (hsize + hblank) + */ + +/* all in kHz */ + +void +igsGetClock (int target, int *Mp, int *Np, int *Pp, int maxM, int maxN, int maxP, int minVco) +{ + int M, N, P, bestM, bestN; + int f_vco, f_out; + int err, abserr, besterr; + + /* + * Compute correct P value to keep VCO in range + */ + for (P = 0; P <= maxP; P++) + { + f_vco = target * IGS_SCALE(P); + if (f_vco >= minVco) + break; + } + + /* M = f_out / f_ref * ((N + 1) * IGS_SCALE(P)); */ + besterr = target; + for (N = 1; N <= maxN; N++) + { + M = ((target * (N + 1) * IGS_SCALE(P) + (IGS_CLOCK_REF/2)) + IGS_CLOCK_REF/2) / IGS_CLOCK_REF - 1; + if (0 <= M && M <= maxM) + { + f_out = IGS_CLOCK(M,N,P); + err = target - f_out; + if (err < 0) + err = -err; + if (err < besterr) + { + besterr = err; + bestM = M; + bestN = N; + } + } + } + *Mp = bestM; + *Np = bestN; + *Pp = P; +} + +Bool +igsEnable (ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + KdCardInfo *card = pScreenPriv->card; + KdScreenInfo *screen = pScreenPriv->screen; + IgsCardInfo *igsc = card->driver; + IgsVga *igsvga = &igsc->igsvga; + const KdMonitorTiming *t; + int hactive, hblank, hfp, hbp; + int vactive, vblank, vfp, vbp; + int hsize; + int fb = 0; + int m, n, r; + int h_total; + int h_display_end; + int h_blank_start; + int h_blank_end; + int h_sync_start; + int h_sync_end; + int h_screen_off; + int v_total; + int v_retrace_start; + int v_retrace_end; + int v_display_end; + int v_blank_start; + int v_blank_end; + int offset; + int num_fetch; + int m_m, m_n, m_r; + + + igsSetBlank (igsvga, TRUE); + + t = KdFindMode (screen, igsModeSupported); + + igsGetClock (t->clock, &m, &n, &r, 2047, 255, 7, IGS_MIN_VCO); + + /* + * Set the chip so that 0x400000 is a big-endian frame buffer + * with the correct byte swapping enabled + */ + igsSet (igsvga, igs_biga22force, 0); + igsSet (igsvga, igs_biga22en, 1); + igsSet (igsvga, igs_biga24en, 1); + /* + * Enable 8-bit DACs + */ + igsSet (igsvga, igs_rampwdn, 0); + igsSet (igsvga, igs_dac6_8, 1); + igsSet (igsvga, igs_dacpwdn, 0); + /* + * Set overscan to black + */ + igsSet (igsvga, igs_overscan_red, 0x00); + igsSet (igsvga, igs_overscan_green, 0x00); + igsSet (igsvga, igs_overscan_blue, 0x00); + /* + * Enable PCI retries + */ + igsSet (igsvga, igs_iow_retry, 1); + igsSet (igsvga, igs_mw_retry, 1); + igsSet (igsvga, igs_mr_retry, 1); + igsSet (igsvga, igs_pci_burst_write, 1); + igsSet (igsvga, igs_pci_burst_read, 1); + /* + * Set FIFO + */ + igsSet (igsvga, igs_memgopg, 1); + igsSet (igsvga, igs_memr2wpg, 0); + igsSet (igsvga, igs_crtff16, 0); + igsSet (igsvga, igs_fifomust, 0xff); + igsSet (igsvga, igs_fifogen, 0xff); + /* + * Enable CRT reg access + */ + igsSetImm (igsvga, igs_ena_vr_access, 1); + igsSetImm (igsvga, igs_crt_protect, 0); + + hfp = t->hfp; + hbp = t->hbp; + hblank = t->hblank; + hactive = t->horizontal; + offset = screen->fb[0].byteStride; + + vfp = t->vfp; + vbp = t->vbp; + vblank = t->vblank; + vactive = t->vertical; + + /* + * Compute character lengths for horizontal timing values + */ + hactive = screen->width / 8; + hblank /= 8; + hfp /= 8; + hbp /= 8; + offset /= 8; + + switch (screen->fb[fb].bitsPerPixel) { + case 8: + igsSet (igsvga, igs_overscan_red, pScreen->blackPixel); + igsSet (igsvga, igs_overscan_green, pScreen->blackPixel); + igsSet (igsvga, igs_overscan_blue, pScreen->blackPixel); + igsSet (igsvga, igs_bigswap, IGS_BIGSWAP_8); + igsSet (igsvga, igs_mode_sel, IGS_MODE_8); + igsSet (igsvga, igs_ramdacbypass, 0); + break; + case 16: + igsSet (igsvga, igs_bigswap, IGS_BIGSWAP_16); + igsSet (igsvga, igs_ramdacbypass, 1); + switch (screen->fb[fb].depth) { + case 12: + igsSet (igsvga, igs_mode_sel, IGS_MODE_4444); + break; + case 15: + igsSet (igsvga, igs_mode_sel, IGS_MODE_5551); + break; + case 16: + igsSet (igsvga, igs_mode_sel, IGS_MODE_565); + break; + } + break; + case 24: + igsSet (igsvga, igs_ramdacbypass, 1); + igsSet (igsvga, igs_bigswap, IGS_BIGSWAP_8); + igsSet (igsvga, igs_mode_sel, IGS_MODE_888); + break; + case 32: + igsSet (igsvga, igs_ramdacbypass, 1); + igsSet (igsvga, igs_bigswap, IGS_BIGSWAP_32); + igsSet (igsvga, igs_mode_sel, IGS_MODE_8888); + break; + } + + /* + * Compute horizontal register values from timings + */ + h_total = hactive + hblank - 5; + h_display_end = hactive - 1; + + h_sync_start = hactive + hfp; + h_sync_end = hactive + hblank - hbp; + /* + * pad the blank values narrow a bit and use the border_select to + * eliminate the remaining border; don't know why, but it doesn't + * work in the documented fashion + */ + h_blank_start = hactive - 1; + h_blank_end = hactive + hblank - 1 - 1; + + num_fetch = (t->horizontal * screen->fb[fb].bitsPerPixel / 64) + 1; + + v_total = vactive + vblank - 2; + v_display_end = vactive - 1; + + v_blank_start = vactive - 1; + v_blank_end = v_blank_start + vblank - 1; + + v_retrace_start = vactive + vfp; + v_retrace_end = vactive + vblank - vbp; + +#if 0 +#define chk(a,b,c) fprintf (stderr, "%20.20s: BIOS %6d X %6d\n", a, igsGet(igsvga, b), c); + + chk("h_total", igs_h_total, h_total); + chk("h_display_end", igs_h_de_end, h_display_end); + chk("h_sync_start", igs_h_rstart, h_sync_start); + chk("h_sync_end", igs_h_rend, h_sync_end&0x1f); + chk("h_blank_start", igs_h_bstart, h_blank_start); + chk("h_blank_end", igs_h_bend, h_blank_end&0x3f); + chk("offset", igs_offset, offset); + chk("num_fetch", igs_num_fetch, num_fetch); + + chk("v_total", igs_v_total, v_total); + chk("v_display_end", igs_v_de_end, v_display_end); + chk("v_blank_start", igs_v_bstart, v_blank_start); + chk("v_blank_end", igs_v_bend, v_blank_end&0xf); + chk("v_retrace_start", igs_v_rstart, v_retrace_start); + chk("v_retrace_end", igs_v_rend, v_retrace_end&0xf); + chk("vclk_m", igs_vclk_m, m); + chk("vclk_n", igs_vclk_n, n); + chk("vclk_p", igs_vclk_p, r); + + fprintf (stderr, "%20.20s: BIOS %6d X %6d\n", "vclk", + IGS_CLOCK(igsGet(igsvga,igs_vclk_m), + igsGet(igsvga,igs_vclk_n), + igsGet(igsvga,igs_vclk_p)), + IGS_CLOCK(m,n,r)); +#endif + igsSet (igsvga, igs_h_total, h_total); + igsSet (igsvga, igs_h_de_end, h_display_end); + igsSet (igsvga, igs_h_rstart, h_sync_start); + igsSet (igsvga, igs_h_rend, h_sync_end); + igsSet (igsvga, igs_h_bstart, h_blank_start); + igsSet (igsvga, igs_h_bend, h_blank_end); + igsSet (igsvga, igs_offset, offset); + igsSet (igsvga, igs_num_fetch, num_fetch); + + igsSet (igsvga, igs_v_total, v_total); + igsSet (igsvga, igs_v_de_end, v_display_end); + igsSet (igsvga, igs_v_bstart, v_blank_start); + igsSet (igsvga, igs_v_bend, v_blank_end&0xf); + igsSet (igsvga, igs_v_rstart, v_retrace_start); + igsSet (igsvga, igs_v_rend, v_retrace_end&0xf); + + igsSet (igsvga, igs_vclk_m, m); + igsSet (igsvga, igs_vclk_n, n); + igsSet (igsvga, igs_vclk_p, r); + igsSet (igsvga, igs_vfsel, IGS_CLOCK(m, n, 0) >= 180000); + VgaFlush (&igsvga->card); + + igsSetImm (igsvga, igs_frqlat, 0); + igsSetImm (igsvga, igs_frqlat, 1); + igsSetImm (igsvga, igs_frqlat, 0); + + igsSetBlank (igsvga, FALSE); +#if 0 +#define dbg(a,b) fprintf(stderr, "%20.20s = 0x%x\n", a, igsGet(igsvga,b)) + +#include "reg.dbg" + + { + VGA16 reg; + char buf[128]; + + for (reg = 0; reg < IGS_NREG; reg++) + fprintf(stderr, "%20.20s = 0x%02x\n", igsRegName(buf, reg), + VgaFetch (&igsvga->card, reg)); + } +#endif + return TRUE; +} + +Bool +igsDPMS (ScreenPtr pScreen, int mode) +{ + KdScreenPriv(pScreen); + IgsCardInfo *igsc = pScreenPriv->card->driver; + IgsVga *igsvga = &igsc->igsvga; + + switch (mode) { + case KD_DPMS_NORMAL: + igsSetSync (igsc, 0, 0); + igsSetBlank (igsvga, FALSE); + break; + case KD_DPMS_STANDBY: + igsSetBlank (igsvga, TRUE); + igsSetSync (igsc, 1, 0); + break; + case KD_DPMS_SUSPEND: + igsSetBlank (igsvga, TRUE); + igsSetSync (igsc, 0, 1); + break; + case KD_DPMS_POWERDOWN: + igsSetBlank (igsvga, TRUE); + igsSetSync (igsc, 1, 1); + break; + } + return TRUE; +} + +void +igsDisable (ScreenPtr pScreen) +{ +} + +void +igsRestore (KdCardInfo *card) +{ + IgsCardInfo *igsc = card->driver; + IgsVga *igsvga = &igsc->igsvga; + + igsReset (igsvga); +} + +void +igsScreenFini (KdScreenInfo *screen) +{ + IgsScreenInfo *igss = (IgsScreenInfo *) screen->driver; + +#if BITMAP_BIT_ORDER == MSBFirst + if (igss->cursor_base) + KdUnmapDevice ((void *) igss->cursor_base, 1024); +#endif + xfree (igss); + screen->driver = 0; +} + +void +igsCardFini (KdCardInfo *card) +{ + IgsCardInfo *igsc = card->driver; + + if (igsc->copData) + KdUnmapDevice ((void *) igsc->copData, IGS_COP_DATA_LEN); + if (igsc->cop) + KdUnmapDevice ((void *) igsc->cop, sizeof (Cop5xxx)); + if (igsc->vga) + KdUnmapDevice ((void *) igsc->vga, 64 * 1024); + if (igsc->frameBuffer) + KdUnmapDevice (igsc->frameBuffer, IGS_MEM); + xfree (igsc); + card->driver = 0; +} + +KdCardFuncs igsFuncs = { + igsCardInit, /* cardinit */ + igsScreenInit, /* scrinit */ + igsInitScreen, + igsPreserve, /* preserve */ + igsEnable, /* enable */ + igsDPMS, /* dpms */ + igsDisable, /* disable */ + igsRestore, /* restore */ + igsScreenFini, /* scrfini */ + igsCardFini, /* cardfini */ + + igsCursorInit, /* initCursor */ + igsCursorEnable, /* enableCursor */ + igsCursorDisable, /* disableCursor */ + igsCursorFini, /* finiCursor */ + 0, /* recolorCursor */ + + igsDrawInit, /* initAccel */ + igsDrawEnable, /* enableAccel */ + igsDrawSync, /* drawSync */ + igsDrawDisable, /* disableAccel */ + igsDrawFini, /* finiAccel */ + + igsGetColors, /* getColors */ + igsPutColors, /* putColors */ +}; --- xorg-server-1.4.2.orig/hw/kdrive/igs/igsreg.c +++ xorg-server-1.4.2/hw/kdrive/igs/igsreg.c @@ -0,0 +1,969 @@ +/* + * 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_CONFIG_H +#include +#endif +#include "igsreg.h" +#include + +#define CR00 IGS_CR+0x00 +#define CR01 IGS_CR+0x01 +#define CR02 IGS_CR+0x02 +#define CR03 IGS_CR+0x03 +#define CR04 IGS_CR+0x04 +#define CR05 IGS_CR+0x05 +#define CR06 IGS_CR+0x06 +#define CR07 IGS_CR+0x07 +#define CR08 IGS_CR+0x08 +#define CR09 IGS_CR+0x09 +#define CR0A IGS_CR+0x0A +#define CR0B IGS_CR+0x0B +#define CR0C IGS_CR+0x0C +#define CR0D IGS_CR+0x0D +#define CR0E IGS_CR+0x0E +#define CR0F IGS_CR+0x0F +#define CR10 IGS_CR+0x10 +#define CR11 IGS_CR+0x11 +#define CR12 IGS_CR+0x12 +#define CR13 IGS_CR+0x13 +#define CR14 IGS_CR+0x14 +#define CR15 IGS_CR+0x15 +#define CR16 IGS_CR+0x16 +#define CR17 IGS_CR+0x17 +#define CR18 IGS_CR+0x18 +#define CR19 IGS_CR+0x19 +#define CR1A IGS_CR+0x1A +#define CR1B IGS_CR+0x1B +#define CR1C IGS_CR+0x1C +#define CR1D IGS_CR+0x1D +#define CR1E IGS_CR+0x1E +#define CR1F IGS_CR+0x1F +#define CR20 IGS_CR+0x20 +#define CR21 IGS_CR+0x21 +#define CR22 IGS_CR+0x22 +#define CR23 IGS_CR+0x23 +#define CR24 IGS_CR+0x24 +#define CR25 IGS_CR+0x25 +#define CR26 IGS_CR+0x26 +#define CR27 IGS_CR+0x27 +#define CR28 IGS_CR+0x28 +#define CR29 IGS_CR+0x29 +#define CR2A IGS_CR+0x2A +#define CR2B IGS_CR+0x2B +#define CR2C IGS_CR+0x2C +#define CR2D IGS_CR+0x2D +#define CR2E IGS_CR+0x2E +#define CR2F IGS_CR+0x2F +#define CR30 IGS_CR+0x30 +#define CR31 IGS_CR+0x31 +#define CR32 IGS_CR+0x32 +#define CR33 IGS_CR+0x33 +#define CR34 IGS_CR+0x34 +#define CR35 IGS_CR+0x35 +#define CR36 IGS_CR+0x36 +#define CR37 IGS_CR+0x37 +#define CR38 IGS_CR+0x38 +#define CR39 IGS_CR+0x39 +#define CR3A IGS_CR+0x3A +#define CR3B IGS_CR+0x3B +#define CR3C IGS_CR+0x3C +#define CR3D IGS_CR+0x3D +#define CR3E IGS_CR+0x3E +#define CR3F IGS_CR+0x3F +#define CR40 IGS_CR+0x40 +#define CR41 IGS_CR+0x41 +#define CR42 IGS_CR+0x42 +#define CR43 IGS_CR+0x43 +#define CR44 IGS_CR+0x44 +#define CR45 IGS_CR+0x45 +#define CR46 IGS_CR+0x46 +#define CR47 IGS_CR+0x47 +#define CR48 IGS_CR+0x48 + +#define CR_FIRST CR00 +#define CR_LAST CR48 + +#define SR00 IGS_SR+0x00 +#define SR01 IGS_SR+0x01 +#define SR02 IGS_SR+0x02 +#define SR03 IGS_SR+0x03 +#define SR04 IGS_SR+0x04 + +#define SR_FIRST SR00 +#define SR_LAST SR04 + +#define AR00 IGS_AR+0x00 +#define AR01 IGS_AR+0x01 +#define AR02 IGS_AR+0x02 +#define AR03 IGS_AR+0x03 +#define AR04 IGS_AR+0x04 +#define AR05 IGS_AR+0x05 +#define AR06 IGS_AR+0x06 +#define AR07 IGS_AR+0x07 +#define AR08 IGS_AR+0x08 +#define AR09 IGS_AR+0x09 +#define AR0A IGS_AR+0x0A +#define AR0B IGS_AR+0x0B +#define AR0C IGS_AR+0x0C +#define AR0D IGS_AR+0x0D +#define AR0E IGS_AR+0x0E +#define AR0F IGS_AR+0x0F +#define AR10 IGS_AR+0x10 +#define AR11 IGS_AR+0x11 +#define AR12 IGS_AR+0x12 +#define AR13 IGS_AR+0x13 +#define AR14 IGS_AR+0x14 + +#define AR_FIRST AR00 +#define AR_LAST AR14 + +#define GR00 IGS_GR+0x00 +#define GR01 IGS_GR+0x01 +#define GR02 IGS_GR+0x02 +#define GR03 IGS_GR+0x03 +#define GR04 IGS_GR+0x04 +#define GR05 IGS_GR+0x05 +#define GR06 IGS_GR+0x06 +#define GR07 IGS_GR+0x07 +#define GR08 IGS_GR+0x08 +#define GR09 IGS_GR+0x09 +#define GR0A IGS_GR+0x0A +#define GR0B IGS_GR+0x0B +#define GR0C IGS_GR+0x0C +#define GR0D IGS_GR+0x0D +#define GR0E IGS_GR+0x0E +#define GR0F IGS_GR+0x0F +#define GR10 IGS_GR+0x10 +#define GR11 IGS_GR+0x11 +#define GR12 IGS_GR+0x12 +#define GR13 IGS_GR+0x13 +#define GR14 IGS_GR+0x14 +#define GR15 IGS_GR+0x15 +#define GR16 IGS_GR+0x16 +#define GR17 IGS_GR+0x17 +#define GR18 IGS_GR+0x18 +#define GR19 IGS_GR+0x19 +#define GR1A IGS_GR+0x1A +#define GR1B IGS_GR+0x1B +#define GR1C IGS_GR+0x1C +#define GR1D IGS_GR+0x1D +#define GR1E IGS_GR+0x1E +#define GR1F IGS_GR+0x1F +#define GR20 IGS_GR+0x20 +#define GR21 IGS_GR+0x21 +#define GR22 IGS_GR+0x22 +#define GR23 IGS_GR+0x23 +#define GR24 IGS_GR+0x24 +#define GR25 IGS_GR+0x25 +#define GR26 IGS_GR+0x26 +#define GR27 IGS_GR+0x27 +#define GR28 IGS_GR+0x28 +#define GR29 IGS_GR+0x29 +#define GR2A IGS_GR+0x2A +#define GR2B IGS_GR+0x2B +#define GR2C IGS_GR+0x2C +#define GR2D IGS_GR+0x2D +#define GR2E IGS_GR+0x2E +#define GR2F IGS_GR+0x2F +#define GR30 IGS_GR+0x30 +#define GR31 IGS_GR+0x31 +#define GR32 IGS_GR+0x32 +#define GR33 IGS_GR+0x33 +#define GR34 IGS_GR+0x34 +#define GR35 IGS_GR+0x35 +#define GR36 IGS_GR+0x36 +#define GR37 IGS_GR+0x37 +#define GR38 IGS_GR+0x38 +#define GR39 IGS_GR+0x39 +#define GR3A IGS_GR+0x3A +#define GR3B IGS_GR+0x3B +#define GR3C IGS_GR+0x3C +#define GR3D IGS_GR+0x3D +#define GR3E IGS_GR+0x3E +#define GR3F IGS_GR+0x3F +#define GR40 IGS_GR+0x40 +#define GR41 IGS_GR+0x41 +#define GR42 IGS_GR+0x42 +#define GR43 IGS_GR+0x43 +#define GR44 IGS_GR+0x44 +#define GR45 IGS_GR+0x45 +#define GR46 IGS_GR+0x46 +#define GR47 IGS_GR+0x47 +#define GR48 IGS_GR+0x48 +#define GR49 IGS_GR+0x49 +#define GR4A IGS_GR+0x4A +#define GR4B IGS_GR+0x4B +#define GR4C IGS_GR+0x4C +#define GR4D IGS_GR+0x4D +#define GR4E IGS_GR+0x4E +#define GR4F IGS_GR+0x4F +#define GR50 IGS_GR+0x50 +#define GR51 IGS_GR+0x51 +#define GR52 IGS_GR+0x52 +#define GR53 IGS_GR+0x53 +#define GR54 IGS_GR+0x54 +#define GR55 IGS_GR+0x55 +#define GR56 IGS_GR+0x56 +#define GR57 IGS_GR+0x57 +#define GR58 IGS_GR+0x58 +#define GR59 IGS_GR+0x59 +#define GR5A IGS_GR+0x5A +#define GR5B IGS_GR+0x5B +#define GR5C IGS_GR+0x5C +#define GR5D IGS_GR+0x5D +#define GR5E IGS_GR+0x5E +#define GR5F IGS_GR+0x5F +#define GR60 IGS_GR+0x60 +#define GR61 IGS_GR+0x61 +#define GR62 IGS_GR+0x62 +#define GR63 IGS_GR+0x63 +#define GR64 IGS_GR+0x64 +#define GR65 IGS_GR+0x65 +#define GR66 IGS_GR+0x66 +#define GR67 IGS_GR+0x67 +#define GR68 IGS_GR+0x68 +#define GR69 IGS_GR+0x69 +#define GR6A IGS_GR+0x6A +#define GR6B IGS_GR+0x6B +#define GR6C IGS_GR+0x6C +#define GR6D IGS_GR+0x6D +#define GR6E IGS_GR+0x6E +#define GR6F IGS_GR+0x6F +#define GR70 IGS_GR+0x70 +#define GR71 IGS_GR+0x71 +#define GR72 IGS_GR+0x72 +#define GR73 IGS_GR+0x73 +#define GR74 IGS_GR+0x74 +#define GR75 IGS_GR+0x75 +#define GR76 IGS_GR+0x76 +#define GR77 IGS_GR+0x77 +#define GR78 IGS_GR+0x78 +#define GR79 IGS_GR+0x79 +#define GR7A IGS_GR+0x7A +#define GR7B IGS_GR+0x7B +#define GR7C IGS_GR+0x7C +#define GR7D IGS_GR+0x7D +#define GR7E IGS_GR+0x7E +#define GR7F IGS_GR+0x7F +#define GR80 IGS_GR+0x80 +#define GR81 IGS_GR+0x81 +#define GR82 IGS_GR+0x82 +#define GR83 IGS_GR+0x83 +#define GR84 IGS_GR+0x84 +#define GR85 IGS_GR+0x85 +#define GR86 IGS_GR+0x86 +#define GR87 IGS_GR+0x87 +#define GR88 IGS_GR+0x88 +#define GR89 IGS_GR+0x89 +#define GR8A IGS_GR+0x8A +#define GR8B IGS_GR+0x8B +#define GR8C IGS_GR+0x8C +#define GR8D IGS_GR+0x8D +#define GR8E IGS_GR+0x8E +#define GR8F IGS_GR+0x8F +#define GR90 IGS_GR+0x90 +#define GR91 IGS_GR+0x91 +#define GR92 IGS_GR+0x92 +#define GR93 IGS_GR+0x93 +#define GR94 IGS_GR+0x94 +#define GR95 IGS_GR+0x95 +#define GR96 IGS_GR+0x96 +#define GR97 IGS_GR+0x97 +#define GR98 IGS_GR+0x98 +#define GR99 IGS_GR+0x99 +#define GR9A IGS_GR+0x9A +#define GR9B IGS_GR+0x9B +#define GR9C IGS_GR+0x9C +#define GR9D IGS_GR+0x9D +#define GR9E IGS_GR+0x9E +#define GR9F IGS_GR+0x9F +#define GRA0 IGS_GR+0xA0 +#define GRA1 IGS_GR+0xA1 +#define GRA2 IGS_GR+0xA2 +#define GRA3 IGS_GR+0xA3 +#define GRA4 IGS_GR+0xA4 +#define GRA5 IGS_GR+0xA5 +#define GRA6 IGS_GR+0xA6 +#define GRA7 IGS_GR+0xA7 +#define GRA8 IGS_GR+0xA8 +#define GRA9 IGS_GR+0xA9 +#define GRAA IGS_GR+0xAA +#define GRAB IGS_GR+0xAB +#define GRAC IGS_GR+0xAC +#define GRAD IGS_GR+0xAD +#define GRAE IGS_GR+0xAE +#define GRAF IGS_GR+0xAF +#define GRB0 IGS_GR+0xB0 +#define GRB1 IGS_GR+0xB1 +#define GRB2 IGS_GR+0xB2 +#define GRB3 IGS_GR+0xB3 +#define GRB4 IGS_GR+0xB4 +#define GRB5 IGS_GR+0xB5 +#define GRB6 IGS_GR+0xB6 +#define GRB7 IGS_GR+0xB7 +#define GRB8 IGS_GR+0xB8 +#define GRB9 IGS_GR+0xB9 +#define GRBA IGS_GR+0xBA +#define GRBB IGS_GR+0xBB +#define GRBC IGS_GR+0xBC +#define GRBD IGS_GR+0xBD +#define GRBE IGS_GR+0xBE +#define GRBF IGS_GR+0xBF + +#define GR_FIRST GR00 +#define GR_LAST GRBF + +#define GREX3C IGS_GREX+(0x3c-IGS_GREXBASE) + +VgaReg igs_h_total[] = { + CR00, 0, 8, + VGA_REG_END +}; + +VgaReg igs_h_de_end[] = { + CR01, 0, 8, + VGA_REG_END +}; + +VgaReg igs_h_bstart[] = { + CR02, 0, 8, + VGA_REG_END +}; + +VgaReg igs_h_bend[] = { + CR03, 0, 5, + CR05, 7, 1, + VGA_REG_END +}; + +VgaReg igs_de_skew[] = { + CR03, 5, 2, + VGA_REG_END +}; + +VgaReg igs_ena_vr_access[] = { + CR03, 7, 1, + VGA_REG_END +}; + +VgaReg igs_h_rstart[] = { + CR04, 0, 8, + VGA_REG_END +}; + +VgaReg igs_h_rend[] = { + CR05, 0, 5, + VGA_REG_END +}; + +VgaReg igs_h_rdelay[] = { + CR05, 5, 2, + VGA_REG_END +}; + +VgaReg igs_v_total[] = { + CR06, 0, 8, + CR07, 0, 1, + CR07, 5, 1, + GR11, 0, 1, + VGA_REG_END +}; + +VgaReg igs_v_rstart[] = { + CR10, 0, 8, + CR07, 2, 1, + CR07, 7, 1, + GR11, 2, 1, + VGA_REG_END +}; + +VgaReg igs_v_rend[] = { + CR11, 0, 4, + VGA_REG_END +}; + +VgaReg igs_clear_v_int[] = { + CR11, 4, 1, + VGA_REG_END +}; + +VgaReg igs_disable_v_int[] = { + CR11, 5, 1, + VGA_REG_END +}; + +VgaReg igs_bandwidth[] = { + CR11, 6, 1, + VGA_REG_END +}; + +VgaReg igs_crt_protect[] = { + CR11, 7, 1, + VGA_REG_END +}; + +VgaReg igs_v_de_end[] = { + CR12, 0, 8, + CR07, 1, 1, + CR07, 6, 1, + GR11, 1, 1, + VGA_REG_END +}; + +VgaReg igs_offset[] = { + CR13, 0, 8, + GR15, 4, 2, + VGA_REG_END +}; + +VgaReg igs_v_bstart[] = { + CR15, 0, 8, + CR07, 3, 1, + CR09, 5, 1, + GR11, 3, 1, + VGA_REG_END +}; + +VgaReg igs_v_bend[] = { + CR16, 0, 7, + VGA_REG_END +}; + +VgaReg igs_linecomp[] = { + CR18, 0, 8, + CR07, 4, 1, + CR09, 6, 1, + GR11, 4, 1, + VGA_REG_END +}; + +VgaReg igs_ivideo[] = { + GR11, 5, 1, + VGA_REG_END +}; + +VgaReg igs_num_fetch[] = { + GR14, 0, 8, + GR15, 0, 2, + VGA_REG_END +}; + +VgaReg igs_wcrt0[] = { + CR1F, 0, 1, + VGA_REG_END +}; + +VgaReg igs_wcrt1[] = { + CR1F, 1, 1, + VGA_REG_END +}; + +VgaReg igs_rcrts1[] = { + CR1F, 4, 1, + VGA_REG_END +}; + +VgaReg igs_selwk[] = { + CR1F, 6, 1, + VGA_REG_END +}; + +VgaReg igs_dot_clock_8[] = { + SR01, 0, 1, + VGA_REG_END +}; + +VgaReg igs_screen_off[] = { + SR01, 5, 1, + VGA_REG_END +}; + +VgaReg igs_enable_write_plane[] = { + SR02, 0, 4, + VGA_REG_END +}; + +VgaReg igs_mexhsyn[] = { + GR16, 0, 2, + VGA_REG_END +}; + +VgaReg igs_mexvsyn[] = { + GR16, 2, 2, + VGA_REG_END +}; + +VgaReg igs_pci_burst_write[] = { + GR30, 5, 1, + VGA_REG_END +}; + +VgaReg igs_pci_burst_read[] = { + GR30, 7, 1, + VGA_REG_END +}; + +VgaReg igs_iow_retry[] = { + GREX3C, 0, 1, + VGA_REG_END +}; + +VgaReg igs_mw_retry[] = { + GREX3C, 1, 1, + VGA_REG_END +}; + +VgaReg igs_mr_retry[] = { + GREX3C, 2, 1, + VGA_REG_END +}; + + + +VgaReg igs_biga22en[] = { + GR3D, 4, 1, + VGA_REG_END +}; + +VgaReg igs_biga24en[] = { + GR3D, 5, 1, + VGA_REG_END +}; + +VgaReg igs_biga22force[] = { + GR3D, 6, 1, + VGA_REG_END +}; + +VgaReg igs_bigswap[] = { + GR3F, 0, 6, + VGA_REG_END +}; + +/* #define IGS_BIGSWAP_8 0x3f */ +/* #define IGS_BIGSWAP_16 0x2a */ +/* #define IGS_BIGSWAP_32 0x00 */ + +VgaReg igs_sprite_x[] = { + GR50, 0, 8, + GR51, 0, 3, + VGA_REG_END +}; + +VgaReg igs_sprite_preset_x[] = { + GR52, 0, 6, + VGA_REG_END +}; + +VgaReg igs_sprite_y[] = { + GR53, 0, 8, + GR54, 0, 3, + VGA_REG_END +}; + +VgaReg igs_sprite_preset_y[] = { + GR55, 0, 6, + VGA_REG_END +}; + +VgaReg igs_sprite_visible[] = { + GR56, 0, 1, + VGA_REG_END +}; + +VgaReg igs_sprite_64x64[] = { + GR56, 1, 1, + VGA_REG_END +}; + +VgaReg igs_mgrext[] = { + GR57, 0, 1, + VGA_REG_END +}; + +VgaReg igs_hcshf[] = { + GR57, 4, 2, + VGA_REG_END +}; + +VgaReg igs_mbpfix[] = { + GR57, 6, 2, + VGA_REG_END +}; + +VgaReg igs_overscan_red[] = { + GR58, 0, 8, + VGA_REG_END +}; + +VgaReg igs_overscan_green[] = { + GR59, 0, 8, + VGA_REG_END +}; + +VgaReg igs_overscan_blue[] = { + GR5A, 0, 8, + VGA_REG_END +}; + +VgaReg igs_memgopg[] = { + GR73, 2, 1, + VGA_REG_END +}; + +VgaReg igs_memr2wpg[] = { + GR73, 1, 1, + VGA_REG_END +}; + +VgaReg igs_crtff16[] = { + GR73, 3, 1, + VGA_REG_END +}; + +VgaReg igs_fifomust[] = { + GR74, 0, 5, + VGA_REG_END +}; + +VgaReg igs_fifogen[] = { + GR75, 0, 5, + VGA_REG_END +}; + +VgaReg igs_mode_sel[] = { + GR77, 0, 4, + VGA_REG_END +}; + +/* #define IGS_MODE_TEXT 0 */ +/* #define IGS_MODE_8 1 */ +/* #define IGS_MODE_565 2 */ +/* #define IGS_MODE_5551 6 */ +/* #define IGS_MODE_8888 3 */ +/* #define IGS_MODE_888 4 */ +/* #define IGS_MODE_332 9 */ +/* #define IGS_MODE_4444 10 */ + +VgaReg igs_sprite_addr[] = { + GR7E, 0, 8, + GR7F, 0, 4, + VGA_REG_END +}; + +VgaReg igs_fastmpie[] = { + GR9E, 0, 1, + VGA_REG_END +}; + +VgaReg igs_vclk_m[] = { + GRB0, 0, 8, + GRBA, 0, 3, + VGA_REG_END +}; + +VgaReg igs_vclk_n[] = { + GRB1, 0, 5, + GRBA, 3, 3, + VGA_REG_END +}; + +VgaReg igs_vfsel[] = { + GRB1, 5, 1, + VGA_REG_END +}; + +VgaReg igs_vclk_p[] = { + GRB1, 6, 2, + GRBA, 6, 1, + VGA_REG_END +}; + +VgaReg igs_frqlat[] = { + GRB9, 7, 1, + VGA_REG_END +}; + + +VgaReg igs_dac_mask[] = { + IGS_DAC + 0, 0, 8, + VGA_REG_END +}; + +VgaReg igs_dac_read_index[] = { + IGS_DAC + 1, 0, 8, + VGA_REG_END +}; + +VgaReg igs_dac_write_index[] = { + IGS_DAC + 2, 0, 8, + VGA_REG_END +}; + +VgaReg igs_dac_data[] = { + IGS_DAC + 3, 0, 8, + VGA_REG_END +}; + +VgaReg igs_rampwdn[] = { + IGS_DACEX + 0, 0, 1, + VGA_REG_END +}; + +VgaReg igs_dac6_8[] = { + IGS_DACEX + 0, 1, 1, + VGA_REG_END +}; + +VgaReg igs_ramdacbypass[] = { + IGS_DACEX + 0, 4, 1, + VGA_REG_END +}; + +VgaReg igs_dacpwdn[] = { + IGS_DACEX + 0, 6, 1, + VGA_REG_END +}; + +VgaReg igs_cursor_read_index[] = { + IGS_DACEX + 1, 0, 8, + VGA_REG_END +}; + +VgaReg igs_cursor_write_index[] = { + IGS_DACEX + 2, 0, 8, + VGA_REG_END +}; + +VgaReg igs_cursor_data[] = { + IGS_DACEX + 3, 0, 8, + VGA_REG_END +}; + +VGA8 +_igsInb (VgaCard *card, VGA16 port) +{ + VGAVOL8 *reg; + + if (card->closure) + return VgaReadMemb ((VGA32) card->closure + port); + else + return VgaInb (port); +} + +void +_igsOutb (VgaCard *card, VGA8 value, VGA16 port) +{ + if (card->closure) + VgaWriteMemb (value, (VGA32) card->closure + port); + else + VgaOutb (value, port); +} + +void +_igsRegMap (VgaCard *card, VGA16 reg, VgaMap *map, VGABOOL write) +{ + if (reg < IGS_SR + IGS_NSR) + { + map->access = VgaAccessIndIo; + map->port = 0x3c4; + map->addr = 0; + map->value = 1; + map->index = reg - IGS_SR; + } + else if (reg < IGS_GR + IGS_NGR) + { + map->access = VgaAccessIndIo; + map->port = 0x3ce; + map->addr = 0; + map->value = 1; + map->index = reg - IGS_GR; + } + else if (reg < IGS_GREX + IGS_NGREX) + { + VGA8 gr33; + + map->access = VgaAccessDone; + _igsOutb (card, 0x33, 0x3ce); + gr33 = _igsInb (card, 0x3cf); + _igsOutb (card, gr33 | 0x40, 0x3cf); + _igsOutb (card, IGS_GREXBASE + reg - IGS_GREX, 0x3ce); + if (write) + _igsOutb (card, map->value, 0x3cf); + else + map->value = _igsInb (card, 0x3cf); + _igsOutb (card, 0x33, 0x3ce); + _igsOutb (card, gr33, 0x3cf); + return; + } + else if (reg < IGS_AR + IGS_NAR) + { + reg -= IGS_AR; + map->access = VgaAccessDone; + /* reset AFF to index */ + (void) _igsInb (card, 0x3da); + if (reg >= 16) + reg |= 0x20; + _igsOutb (card, reg, 0x3c0); + if (write) + _igsOutb (card, map->value, 0x3c0); + else + map->value = _igsInb (card, 0x3c1); + if (!(reg & 0x20)) + { + /* enable video display again */ + (void) _igsInb (card, 0x3da); + _igsOutb (card, 0x20, 0x3c0); + } + return; + } + else if (reg < IGS_CR + IGS_NCR) + { + map->access = VgaAccessIndIo; + map->port = 0x3d4; + map->addr = 0; + map->value = 1; + map->index = reg - IGS_CR; + } + else if (reg < IGS_DAC + IGS_NDAC) + { + map->access = VgaAccessIo; + map->port = 0x3c6 + reg - IGS_DAC; + } + else if (reg < IGS_DACEX + IGS_NDACEX) + { + VGA8 gr56; + reg = 0x3c6 + reg - IGS_DACEX; + map->access = VgaAccessDone; + _igsOutb (card, 0x56, 0x3ce); + gr56 = _igsInb (card, 0x3cf); + _igsOutb (card, gr56 | 4, 0x3cf); + if (write) + _igsOutb (card, map->value, reg); + else + map->value = _igsInb (card, reg); + _igsOutb (card, gr56, 0x3cf); + return; + } + else switch (reg) { + case IGS_MISC_OUT: + map->access = VgaAccessIo; + if (write) + map->port = 0x3c2; + else + map->port = 0x3cc; + break; + case IGS_INPUT_STATUS_1: + map->access = VgaAccessIo; + map->port = 0x3da; + break; + } + if (card->closure) + { + map->port = map->port + (VGA32) card->closure; + if (map->access == VgaAccessIo) + map->access = VgaAccessMem; + if (map->access == VgaAccessIndIo) + map->access = VgaAccessIndMem; + } +} + +VgaSave igsSaves[] = { + CR00, CR18, + SR01, SR02, + GR11, GRBA, + IGS_MISC_OUT, IGS_MISC_OUT, + VGA_SAVE_END +}; + +void +igsRegInit (IgsVga *igsvga, VGAVOL8 *mmio) +{ + igsvga->card.map = _igsRegMap; + igsvga->card.closure = (void *) mmio; + igsvga->card.max = IGS_NREG; + igsvga->card.values = igsvga->values; + igsvga->card.saves = igsSaves; +} + +void +igsSave (IgsVga *igsvga) +{ + igsSetImm (igsvga, igs_wcrt0, 1); + igsSetImm (igsvga, igs_wcrt1, 1); + igsSetImm (igsvga, igs_rcrts1, 1); + igsSetImm (igsvga, igs_selwk, 1); + VgaPreserve (&igsvga->card); +} + +void +igsReset (IgsVga *igsvga) +{ + VgaRestore (&igsvga->card); + igsSetImm (igsvga, igs_frqlat, 0); + igsSetImm (igsvga, igs_frqlat, 1); + igsSetImm (igsvga, igs_frqlat, 0); + VgaFinish (&igsvga->card); +} + +char * +igsRegName(char *buf, VGA16 reg) +{ + if (reg < IGS_SR + IGS_NSR) + { + sprintf (buf, " SR%02X", reg - IGS_SR); + } + else if (reg < IGS_GR + IGS_NGR) + { + sprintf (buf, " GR%02X", reg - IGS_GR); + } + else if (reg < IGS_GREX + IGS_NGREX) + { + sprintf (buf, " GRX%02X", reg - IGS_GREX + IGS_GREXBASE); + } + else if (reg < IGS_AR + IGS_NAR) + { + sprintf (buf, " AR%02X", reg - IGS_AR); + } + else if (reg < IGS_CR + IGS_NCR) + { + sprintf (buf, " CR%02X", reg - IGS_CR); + } + else if (reg < IGS_DAC + IGS_NDAC) + { + sprintf (buf, " DAC%02X", reg - IGS_DAC); + } + else if (reg < IGS_DACEX + IGS_NDACEX) + { + sprintf (buf, "DACX%02X", reg - IGS_DACEX); + } + else switch (reg) { + case IGS_MISC_OUT: + sprintf (buf, "MISC_O"); + break; + case IGS_INPUT_STATUS_1: + sprintf (buf, "IN_S_1"); + break; + } + return buf; +} --- xorg-server-1.4.2.orig/hw/kdrive/igs/igscmap.c +++ xorg-server-1.4.2/hw/kdrive/igs/igscmap.c @@ -0,0 +1,62 @@ +/* + * 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_CONFIG_H +#include +#endif +#include "igs.h" + +#define IGS_DAC_SHIFT 8 +void +igsGetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs) +{ + KdScreenPriv(pScreen); + igsCardInfo(pScreenPriv); + IgsVga *igsvga = &igsc->igsvga; + + while (ndef--) + { + igsSetImm (igsvga, igs_dac_read_index, pdefs->pixel); + pdefs->red = igsGetImm (igsvga, igs_dac_data) << IGS_DAC_SHIFT; + pdefs->green = igsGetImm (igsvga, igs_dac_data) << IGS_DAC_SHIFT; + pdefs->blue = igsGetImm (igsvga, igs_dac_data) << IGS_DAC_SHIFT; + pdefs++; + } +} + +void +igsPutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs) +{ + KdScreenPriv(pScreen); + igsCardInfo(pScreenPriv); + IgsVga *igsvga = &igsc->igsvga; + + while (ndef--) + { + igsSetImm (igsvga, igs_dac_write_index, pdefs->pixel); + igsSetImm (igsvga, igs_dac_data, pdefs->red >> IGS_DAC_SHIFT); + igsSetImm (igsvga, igs_dac_data, pdefs->green >> IGS_DAC_SHIFT); + igsSetImm (igsvga, igs_dac_data, pdefs->blue >> IGS_DAC_SHIFT); + pdefs++; + } +} + --- xorg-server-1.4.2.orig/hw/kdrive/igs/igsdraw.c +++ xorg-server-1.4.2/hw/kdrive/igs/igsdraw.c @@ -0,0 +1,1533 @@ +/* + * 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_CONFIG_H +#include +#endif +#include "igs.h" +#include "igsdraw.h" + +#include "Xmd.h" +#include "gcstruct.h" +#include "scrnintstr.h" +#include "pixmapstr.h" +#include "regionstr.h" +#include "mistruct.h" +#include "fontstruct.h" +#include "dixfontstr.h" +#include "fb.h" +#include "migc.h" +#include "miline.h" + +CARD8 igsPatRop[16] = { + /* GXclear */ 0x00, /* 0 */ + /* GXand */ 0xa0, /* src AND dst */ + /* GXandReverse */ 0x50, /* src AND NOT dst */ + /* GXcopy */ 0xf0, /* src */ + /* GXandInverted*/ 0x0a, /* NOT src AND dst */ + /* GXnoop */ 0xaa, /* dst */ + /* GXxor */ 0x5a, /* src XOR dst */ + /* GXor */ 0xfa, /* src OR dst */ + /* GXnor */ 0x05, /* NOT src AND NOT dst */ + /* GXequiv */ 0xa5, /* NOT src XOR dst */ + /* GXinvert */ 0x55, /* NOT dst */ + /* GXorReverse */ 0xf5, /* src OR NOT dst */ + /* GXcopyInverted*/ 0x0f, /* NOT src */ + /* GXorInverted */ 0xaf, /* NOT src OR dst */ + /* GXnand */ 0x5f, /* NOT src OR NOT dst */ + /* GXset */ 0xff, /* 1 */ +}; + +/* + * Handle pixel transfers + */ + +#define BURST +#ifdef BURST +#define PixTransDeclare VOL32 *pix_trans_base = igsc->copData,\ + *pix_trans = pix_trans_base +#define PixTransStart(n) if (pix_trans + (n) > pix_trans_base + 16384) pix_trans = pix_trans_base +#define PixTransStore(t) *pix_trans++ = (t) +#else +#define PixTransDeclare VOL32 *pix_trans = igsc->copData +#define PixTransStart(n) +#define PixTransStore(t) *pix_trans = (t) +#endif + +static IgsPattern * +igsSetPattern (ScreenPtr pScreen, + PixmapPtr pPixmap, + CARD8 fillStyle, + INT32 xrot, + INT32 yrot) +{ + KdScreenPriv(pScreen); + igsCardInfo(pScreenPriv); + igsScreenInfo(pScreenPriv); + int i; + IgsPatternCache *c; + IgsPattern *p; + + if (fillStyle == FillTiled) + c = &igss->tile; + else + c = &igss->stipple; + for (i = 0; i < IGS_NUM_PATTERN; i++) + { + p = &c->pattern[i]; + if (p->serial_number == pPixmap->drawable.serialNumber && + p->xrot == xrot && + p->yrot == yrot) + { + return p; + } + } + p = &c->pattern[c->next]; + if (++c->next == IGS_NUM_PATTERN) + c->next = 0; + p->serial_number = pPixmap->drawable.serialNumber; + p->xrot = xrot; + p->yrot = yrot; + + if (fillStyle != FillTiled) + { + FbStip *pix; + FbStride pixStride; + int pixBpp; + int pixXoff, pixYoff; + CARD8 tmp[8]; + CARD32 *pat; + int stipX, stipY; + int y; + FbStip bits; + + fbGetStipDrawable (&pPixmap->drawable, pix, pixStride, pixBpp, pixXoff, pixYoff); + + modulus (-yrot - pixYoff, pPixmap->drawable.height, stipY); + modulus (-xrot - pixXoff, FB_UNIT, stipX); + + pat = (CARD32 *) p->base; + + for (y = 0; y < 8; y++) + { + bits = pix[stipY * pixStride]; + FbRotLeft (bits, stipX); + tmp[y] = (CARD8) bits; + stipY++; + if (stipY == pPixmap->drawable.height) + stipY = 0; + } + for (i = 0; i < 2; i++) + { + bits = (tmp[i*4+0] | + (tmp[i*4+1] << 8) | + (tmp[i*4+2] << 16) | + (tmp[i*4+3] << 24)); + IgsAdjustBits32 (bits); + *pat++ = bits; + } + } + else + { + FbBits *pix; + FbStride pixStride; + int pixBpp; + FbBits *pat; + FbStride patStride; + int patBpp; + int patXoff, patYoff; + + fbGetDrawable (&pPixmap->drawable, pix, pixStride, pixBpp, patXoff, patYoff); + + pat = (FbBits *) p->base; + patBpp = pixBpp; + patStride = (patBpp * IGS_PATTERN_WIDTH) / (8 * sizeof (FbBits)); + + fbTile (pat, patStride, 0, + patBpp * IGS_PATTERN_WIDTH, IGS_PATTERN_HEIGHT, + + pix, pixStride, + pPixmap->drawable.width * pixBpp, + pPixmap->drawable.height, + GXcopy, FB_ALLONES, pixBpp, + (xrot - patXoff) * pixBpp, yrot - patYoff); + } + return p; +} + +void +igsFillBoxSolid (DrawablePtr pDrawable, int nBox, BoxPtr pBox, + unsigned long pixel, int alu, unsigned long planemask) +{ + SetupIgs(pDrawable->pScreen); + CARD32 cmd; + + _igsSetSolidRect(cop,alu,planemask,pixel,cmd); + while (nBox--) + { + _igsRect(cop,pBox->x1,pBox->y1,pBox->x2-pBox->x1,pBox->y2-pBox->y1,cmd); + pBox++; + } + KdMarkSync (pDrawable->pScreen); +} + +void +igsFillBoxTiled (DrawablePtr pDrawable, int nBox, BoxPtr pBox, + PixmapPtr pPixmap, int xrot, int yrot, int alu) +{ + SetupIgs(pDrawable->pScreen); + CARD32 cmd; + IgsPattern *p = igsSetPattern (pDrawable->pScreen, + pPixmap, + FillTiled, + xrot, yrot); + + _igsSetTiledRect(cop,alu,planemask,p->offset,cmd); + while (nBox--) + { + _igsPatRect(cop,pBox->x1,pBox->y1,pBox->x2-pBox->x1,pBox->y2-pBox->y1,cmd); + pBox++; + } + KdMarkSync (pDrawable->pScreen); +} + +void +igsFillBoxStippled (DrawablePtr pDrawable, GCPtr pGC, + int nBox, BoxPtr pBox) +{ + SetupIgs(pDrawable->pScreen); + CARD32 cmd; + int xrot = pGC->patOrg.x + pDrawable->x; + int yrot = pGC->patOrg.y + pDrawable->y; + IgsPattern *p = igsSetPattern (pDrawable->pScreen, + pGC->stipple, + pGC->fillStyle, + xrot, yrot); + if (pGC->fillStyle == FillStippled) + { + _igsSetStippledRect (cop,pGC->alu,planemask,pGC->fgPixel,p->offset,cmd); + } + else + { + _igsSetOpaqueStippledRect (cop,pGC->alu,planemask, + pGC->fgPixel,pGC->bgPixel,p->offset,cmd); + } + while (nBox--) + { + _igsPatRect(cop,pBox->x1,pBox->y1,pBox->x2-pBox->x1,pBox->y2-pBox->y1,cmd); + pBox++; + } + KdMarkSync (pDrawable->pScreen); +} + + +void +igsStipple (ScreenPtr pScreen, + CARD32 cmd, + FbStip *psrcBase, + FbStride widthSrc, + int srcx, + int srcy, + int dstx, + int dsty, + int width, + int height) +{ + SetupIgs(pScreen); + FbStip *psrcLine, *psrc; + FbStride widthRest; + FbStip bits, tmp, lastTmp; + int leftShift, rightShift; + int nl, nlMiddle; + int r; + PixTransDeclare; + + /* Compute blt address and parameters */ + psrc = psrcBase + srcy * widthSrc + (srcx >> 5); + nlMiddle = (width + 31) >> 5; + leftShift = srcx & 0x1f; + rightShift = 32 - leftShift; + widthRest = widthSrc - nlMiddle; + + _igsPlaneBlt(cop,dstx,dsty,width,height,cmd); + + if (leftShift == 0) + { + while (height--) + { + nl = nlMiddle; + PixTransStart(nl); + while (nl--) + { + tmp = *psrc++; + IgsAdjustBits32 (tmp); + PixTransStore (tmp); + } + psrc += widthRest; + } + } + else + { + widthRest--; + while (height--) + { + bits = *psrc++; + nl = nlMiddle; + PixTransStart(nl); + while (nl--) + { + tmp = FbStipLeft(bits, leftShift); + bits = *psrc++; + tmp |= FbStipRight(bits, rightShift); + IgsAdjustBits32(tmp); + PixTransStore (tmp); + } + psrc += widthRest; + } + } +} + +void +igsCopyNtoN (DrawablePtr pSrcDrawable, + DrawablePtr pDstDrawable, + GCPtr pGC, + BoxPtr pbox, + int nbox, + int dx, + int dy, + Bool reverse, + Bool upsidedown, + Pixel bitplane, + void *closure) +{ + SetupIgs(pDstDrawable->pScreen); + int srcX, srcY, dstX, dstY; + int w, h; + CARD32 flags; + CARD32 cmd; + CARD8 alu; + + if (pGC) + { + alu = pGC->alu; + if (sourceInvarient (pGC->alu)) + { + igsFillBoxSolid (pDstDrawable, nbox, pbox, 0, pGC->alu, pGC->planemask); + return; + } + } + else + alu = GXcopy; + + _igsSetBlt(cop,alu,pGC->planemask,reverse,upsidedown,cmd); + while (nbox--) + { + w = pbox->x2 - pbox->x1; + h = pbox->y2 - pbox->y1; + if (reverse) + dstX = pbox->x2 - 1; + else + dstX = pbox->x1; + srcX = dstX + dx; + + if (upsidedown) + dstY = pbox->y2 - 1; + else + dstY = pbox->y1; + + srcY = dstY + dy; + + _igsBlt (cop, srcX, srcY, dstX, dstY, w, h, cmd); + pbox++; + } + KdMarkSync (pDstDrawable->pScreen); +} + +RegionPtr +igsCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, + int srcx, int srcy, int width, int height, int dstx, int dsty) +{ + KdScreenPriv(pDstDrawable->pScreen); + FbBits depthMask; + + depthMask = FbFullMask (pDstDrawable->depth); + if ((pGC->planemask & depthMask) == depthMask && + pSrcDrawable->type == DRAWABLE_WINDOW && + pDstDrawable->type == DRAWABLE_WINDOW) + { + return fbDoCopy (pSrcDrawable, pDstDrawable, pGC, + srcx, srcy, width, height, + dstx, dsty, igsCopyNtoN, 0, 0); + } + return KdCheckCopyArea (pSrcDrawable, pDstDrawable, pGC, + srcx, srcy, width, height, dstx, dsty); +} + +typedef struct _igs1toNargs { + unsigned long copyPlaneFG, copyPlaneBG; + Bool opaque; +} igs1toNargs; + +void +igsCopy1toN (DrawablePtr pSrcDrawable, + DrawablePtr pDstDrawable, + GCPtr pGC, + BoxPtr pbox, + int nbox, + int dx, + int dy, + Bool reverse, + Bool upsidedown, + Pixel bitplane, + void *closure) +{ + SetupIgs(pDstDrawable->pScreen); + + igs1toNargs *args = closure; + int dstx, dsty; + FbStip *psrcBase; + FbStride widthSrc; + int srcBpp; + int srcXoff, srcYoff; + CARD32 cmd; + + if (args->opaque && sourceInvarient (pGC->alu)) + { + igsFillBoxSolid (pDstDrawable, nbox, pbox, + pGC->bgPixel, pGC->alu, pGC->planemask); + return; + } + + fbGetStipDrawable (pSrcDrawable, psrcBase, widthSrc, srcBpp, srcXoff, srcYoff); + + if (args->opaque) + { + _igsSetOpaquePlaneBlt (cop, pGC->alu, pGC->planemask, args->copyPlaneFG, + args->copyPlaneBG, cmd); + } + else + { + _igsSetTransparentPlaneBlt (cop, pGC->alu, pGC->planemask, + args->copyPlaneFG, cmd); + } + + while (nbox--) + { + dstx = pbox->x1; + dsty = pbox->y1; + + igsStipple (pDstDrawable->pScreen, cmd, + psrcBase, widthSrc, + dstx + dx - srcXoff, dsty + dy - srcYoff, + dstx, dsty, + pbox->x2 - dstx, pbox->y2 - dsty); + pbox++; + } + KdMarkSync (pDstDrawable->pScreen); +} + +RegionPtr +igsCopyPlane (DrawablePtr pSrcDrawable, + DrawablePtr pDstDrawable, + GCPtr pGC, + int srcx, + int srcy, + int width, + int height, + int dstx, + int dsty, + unsigned long bitPlane) +{ + RegionPtr ret; + igs1toNargs args; + FbBits depthMask; + + depthMask = FbFullMask (pDstDrawable->depth); + if ((pGC->planemask & depthMask) == depthMask && + pDstDrawable->type == DRAWABLE_WINDOW && + pSrcDrawable->depth == 1) + { + args.copyPlaneFG = pGC->fgPixel; + args.copyPlaneBG = pGC->bgPixel; + args.opaque = TRUE; + return fbDoCopy (pSrcDrawable, pDstDrawable, pGC, + srcx, srcy, width, height, + dstx, dsty, igsCopy1toN, bitPlane, &args); + } + return KdCheckCopyPlane(pSrcDrawable, pDstDrawable, pGC, + srcx, srcy, width, height, + dstx, dsty, bitPlane); +} + +#if 0 +/* would you believe this is slower than fb? */ +void +igsPushPixels (GCPtr pGC, + PixmapPtr pBitmap, + DrawablePtr pDrawable, + int w, + int h, + int x, + int y) +{ + igs1toNargs args; + FbBits depthMask; + + depthMask = FbFullMask (pDstDrawable->depth); + if ((pGC->planemask & depthMask) == depthMask && + pDrawable->type == DRAWABLE_WINDOW && + pGC->fillStyle == FillSolid) + { + args.opaque = FALSE; + args.copyPlaneFG = pGC->fgPixel; + (void) fbDoCopy ((DrawablePtr) pBitmap, pDrawable, pGC, + 0, 0, w, h, x, y, igsCopy1toN, 1, &args); + } + else + { + KdCheckPushPixels (pGC, pBitmap, pDrawable, w, h, x, y); + } +} +#else +#define igsPushPixels KdCheckPushPixels +#endif + +BOOL +igsFillOk (GCPtr pGC) +{ + FbBits depthMask; + + depthMask = FbFullMask(pGC->depth); + if ((pGC->planemask & depthMask) != depthMask) + return FALSE; + switch (pGC->fillStyle) { + case FillSolid: + return TRUE; + case FillTiled: + return (igsPatternDimOk (pGC->tile.pixmap->drawable.width) && + igsPatternDimOk (pGC->tile.pixmap->drawable.height)); + case FillStippled: + case FillOpaqueStippled: + return (igsPatternDimOk (pGC->stipple->drawable.width) && + igsPatternDimOk (pGC->stipple->drawable.height)); + } + return FALSE; +} + +void +igsFillSpans (DrawablePtr pDrawable, GCPtr pGC, int n, + DDXPointPtr ppt, int *pwidth, int fSorted) +{ + SetupIgs(pDrawable->pScreen); + DDXPointPtr pptFree; + FbGCPrivPtr fbPriv = fbGetGCPrivate(pGC); + int *pwidthFree;/* copies of the pointers to free */ + CARD32 cmd; + int nTmp; + INT16 x, y; + int width; + IgsPattern *p; + + if (!igsFillOk (pGC)) + { + KdCheckFillSpans (pDrawable, pGC, n, ppt, pwidth, fSorted); + return; + } + nTmp = n * miFindMaxBand(fbGetCompositeClip(pGC)); + pwidthFree = (int *)ALLOCATE_LOCAL(nTmp * sizeof(int)); + pptFree = (DDXPointRec *)ALLOCATE_LOCAL(nTmp * sizeof(DDXPointRec)); + if(!pptFree || !pwidthFree) + { + if (pptFree) DEALLOCATE_LOCAL(pptFree); + if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); + return; + } + n = miClipSpans(fbGetCompositeClip(pGC), + ppt, pwidth, n, + pptFree, pwidthFree, fSorted); + pwidth = pwidthFree; + ppt = pptFree; + switch (pGC->fillStyle) { + case FillSolid: + _igsSetSolidRect(cop,pGC->alu,pGC->planemask,pGC->fgPixel,cmd); + break; + case FillTiled: + p = igsSetPattern (pDrawable->pScreen, + pGC->tile.pixmap, + FillTiled, + pGC->patOrg.x + pDrawable->x, + pGC->patOrg.y + pDrawable->y); + _igsSetTiledRect (cop,pGC->alu,pGC->planemask,p->offset,cmd); + break; + default: + p = igsSetPattern (pDrawable->pScreen, + pGC->stipple, + pGC->fillStyle, + pGC->patOrg.x + pDrawable->x, + pGC->patOrg.y + pDrawable->y); + if (pGC->fillStyle == FillStippled) + { + _igsSetStippledRect (cop,pGC->alu,pGC->planemask, + pGC->fgPixel,p->offset,cmd); + } + else + { + _igsSetOpaqueStippledRect (cop,pGC->alu,pGC->planemask, + pGC->fgPixel,pGC->bgPixel,p->offset,cmd); + } + break; + } + while (n--) + { + x = ppt->x; + y = ppt->y; + ppt++; + width = *pwidth++; + if (width) + { + _igsPatRect(cop,x,y,width,1,cmd); + } + } + DEALLOCATE_LOCAL(pptFree); + DEALLOCATE_LOCAL(pwidthFree); + KdMarkSync (pDrawable->pScreen); +} + +#define NUM_STACK_RECTS 1024 + +void +igsPolyFillRect (DrawablePtr pDrawable, GCPtr pGC, + int nrectFill, xRectangle *prectInit) +{ + SetupIgs(pDrawable->pScreen); + xRectangle *prect; + RegionPtr prgnClip; + register BoxPtr pbox; + register BoxPtr pboxClipped; + BoxPtr pboxClippedBase; + BoxPtr pextent; + BoxRec stackRects[NUM_STACK_RECTS]; + FbGCPrivPtr fbPriv = fbGetGCPrivate (pGC); + int numRects; + int n; + int xorg, yorg; + int x, y; + + if (!igsFillOk (pGC)) + { + KdCheckPolyFillRect (pDrawable, pGC, nrectFill, prectInit); + return; + } + prgnClip = fbGetCompositeClip (pGC); + xorg = pDrawable->x; + yorg = pDrawable->y; + + if (xorg || yorg) + { + prect = prectInit; + n = nrectFill; + while(n--) + { + prect->x += xorg; + prect->y += yorg; + prect++; + } + } + + prect = prectInit; + + numRects = REGION_NUM_RECTS(prgnClip) * nrectFill; + if (numRects > NUM_STACK_RECTS) + { + pboxClippedBase = (BoxPtr)xalloc(numRects * sizeof(BoxRec)); + if (!pboxClippedBase) + return; + } + else + pboxClippedBase = stackRects; + + pboxClipped = pboxClippedBase; + + if (REGION_NUM_RECTS(prgnClip) == 1) + { + int x1, y1, x2, y2, bx2, by2; + + pextent = REGION_RECTS(prgnClip); + x1 = pextent->x1; + y1 = pextent->y1; + x2 = pextent->x2; + y2 = pextent->y2; + while (nrectFill--) + { + if ((pboxClipped->x1 = prect->x) < x1) + pboxClipped->x1 = x1; + + if ((pboxClipped->y1 = prect->y) < y1) + pboxClipped->y1 = y1; + + bx2 = (int) prect->x + (int) prect->width; + if (bx2 > x2) + bx2 = x2; + pboxClipped->x2 = bx2; + + by2 = (int) prect->y + (int) prect->height; + if (by2 > y2) + by2 = y2; + pboxClipped->y2 = by2; + + prect++; + if ((pboxClipped->x1 < pboxClipped->x2) && + (pboxClipped->y1 < pboxClipped->y2)) + { + pboxClipped++; + } + } + } + else + { + int x1, y1, x2, y2, bx2, by2; + + pextent = REGION_EXTENTS(pGC->pScreen, prgnClip); + x1 = pextent->x1; + y1 = pextent->y1; + x2 = pextent->x2; + y2 = pextent->y2; + while (nrectFill--) + { + BoxRec box; + + if ((box.x1 = prect->x) < x1) + box.x1 = x1; + + if ((box.y1 = prect->y) < y1) + box.y1 = y1; + + bx2 = (int) prect->x + (int) prect->width; + if (bx2 > x2) + bx2 = x2; + box.x2 = bx2; + + by2 = (int) prect->y + (int) prect->height; + if (by2 > y2) + by2 = y2; + box.y2 = by2; + + prect++; + + if ((box.x1 >= box.x2) || (box.y1 >= box.y2)) + continue; + + n = REGION_NUM_RECTS (prgnClip); + pbox = REGION_RECTS(prgnClip); + + /* clip the rectangle to each box in the clip region + this is logically equivalent to calling Intersect() + */ + while(n--) + { + pboxClipped->x1 = max(box.x1, pbox->x1); + pboxClipped->y1 = max(box.y1, pbox->y1); + pboxClipped->x2 = min(box.x2, pbox->x2); + pboxClipped->y2 = min(box.y2, pbox->y2); + pbox++; + + /* see if clipping left anything */ + if(pboxClipped->x1 < pboxClipped->x2 && + pboxClipped->y1 < pboxClipped->y2) + { + pboxClipped++; + } + } + } + } + if (pboxClipped != pboxClippedBase) + { + switch (pGC->fillStyle) { + case FillSolid: + igsFillBoxSolid(pDrawable, + pboxClipped-pboxClippedBase, pboxClippedBase, + pGC->fgPixel, pGC->alu, pGC->planemask); + break; + case FillTiled: + igsFillBoxTiled(pDrawable, + pboxClipped-pboxClippedBase, pboxClippedBase, + pGC->tile.pixmap, + pGC->patOrg.x + pDrawable->x, + pGC->patOrg.y + pDrawable->y, + pGC->alu); + break; + case FillStippled: + case FillOpaqueStippled: + igsFillBoxStippled (pDrawable, pGC, + pboxClipped-pboxClippedBase, pboxClippedBase); + break; + } + } + if (pboxClippedBase != stackRects) + xfree(pboxClippedBase); +} + +int +igsTextInRegion (GCPtr pGC, + int x, + int y, + unsigned int nglyph, + CharInfoPtr *ppci) +{ + int w; + FontPtr pfont = pGC->font; + BoxRec bbox; + + if (FONTCONSTMETRICS(pfont)) + w = FONTMAXBOUNDS(pfont,characterWidth) * nglyph; + else + { + w = 0; + while (nglyph--) + w += (*ppci++)->metrics.characterWidth; + } + if (w < 0) + { + bbox.x1 = x + w; + bbox.x2 = x; + } + else + { + bbox.x1 = x; + bbox.x2 = x + w; + } + w = FONTMINBOUNDS(pfont,leftSideBearing); + if (w < 0) + bbox.x1 += w; + w = FONTMAXBOUNDS(pfont, rightSideBearing) - FONTMINBOUNDS(pfont, characterWidth); + if (w > 0) + bbox.x2 += w; + bbox.y1 = y - FONTMAXBOUNDS(pfont,ascent); + bbox.y2 = y + FONTMAXBOUNDS(pfont,descent); + + return RECT_IN_REGION(pGC->pScreen, fbGetCompositeClip(pGC), &bbox); +} + +void +igsGlyphBltClipped (DrawablePtr pDrawable, + GCPtr pGC, + int x, + int y, + unsigned int nglyph, + CharInfoPtr *ppciInit, + Bool image) +{ + SetupIgs(pDrawable->pScreen); + CARD32 cmd; + int h; + int w; + int xBack, yBack; + int hBack, wBack; + int lw; + FontPtr pfont = pGC->font; + CharInfoPtr pci; + unsigned long *bits; + BoxPtr extents; + BoxRec bbox; + CARD32 b; + CharInfoPtr *ppci; + FbGCPrivPtr fbPriv = fbGetGCPrivate(pGC); + RegionPtr pClip = fbGetCompositeClip(pGC); + BoxPtr pBox; + int nbox; + int x1, y1, x2, y2; + unsigned char alu; + Bool set; + PixTransDeclare; + + if (image) + { + xBack = x; + yBack = y - FONTASCENT(pGC->font); + wBack = 0; + hBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font); + if (hBack) + { + h = nglyph; + ppci = ppciInit; + while (h--) + wBack += (*ppci++)->metrics.characterWidth; + } + if (wBack < 0) + { + xBack = xBack + wBack; + wBack = -wBack; + } + if (hBack < 0) + { + yBack = yBack + hBack; + hBack = -hBack; + } + alu = GXcopy; + if (wBack) + { + _igsSetSolidRect (cop, GXcopy, pGC->planemask, pGC->bgPixel, cmd); + for (nbox = REGION_NUM_RECTS (pClip), + pBox = REGION_RECTS (pClip); + nbox--; + pBox++) + { + x1 = xBack; + x2 = xBack + wBack; + y1 = yBack; + y2 = yBack + hBack; + if (x1 < pBox->x1) x1 = pBox->x1; + if (x2 > pBox->x2) x2 = pBox->x2; + if (y1 < pBox->y1) y1 = pBox->y1; + if (y2 > pBox->y2) y2 = pBox->y2; + if (x1 < x2 && y1 < y2) + { + _igsRect (cop, x1, y1, x2 - x1, y2 - y1, cmd); + } + } + KdMarkSync (pDrawable->pScreen); + } + } + else + { + wBack = 0; + alu = pGC->alu; + } + + ppci = ppciInit; + set = FALSE; + while (nglyph--) + { + pci = *ppci++; + h = pci->metrics.ascent + pci->metrics.descent; + w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing; + x1 = x + pci->metrics.leftSideBearing; + y1 = y - pci->metrics.ascent; + bbox.x1 = x1; + bbox.y1 = y1; + bbox.x2 = x1 + w; + bbox.y2 = y1 + h; + switch (RECT_IN_REGION(pGC->pScreen, pClip, &bbox)) + { + case rgnIN: + lw = h * ((w + 31) >> 5); + if (lw) + { + if (!set) + { + _igsSetTransparentPlaneBlt (cop, alu, pGC->planemask, pGC->fgPixel, cmd); + set = TRUE; + } + _igsPlaneBlt(cop, + x + pci->metrics.leftSideBearing, + y - pci->metrics.ascent, + w, h, cmd); + bits = (unsigned long *) pci->bits; + PixTransStart (lw); + while (lw--) + { + b = *bits++; + IgsAdjustBits32 (b); + PixTransStore(b); + } + KdMarkSync (pDrawable->pScreen); + } + break; + case rgnPART: + set = FALSE; + KdCheckSync (pDrawable->pScreen); + fbPutXYImage (pDrawable, + pClip, + fbPriv->fg, + fbPriv->bg, + fbPriv->pm, + alu, + FALSE, + x1, y1, + w, h, + (FbStip *) pci->bits, + (w + 31) >> 5, + 0); + break; + case rgnOUT: + break; + } + x += pci->metrics.characterWidth; + } +} + +void +igsGlyphBlt (DrawablePtr pDrawable, + GCPtr pGC, + int x, + int y, + unsigned int nglyph, + CharInfoPtr *ppciInit, + Bool image) +{ + SetupIgs(pDrawable->pScreen); + CARD32 cmd; + int h; + int w; + int xBack, yBack; + int hBack, wBack; + int lw; + FontPtr pfont = pGC->font; + CharInfoPtr pci; + unsigned long *bits; + BoxPtr extents; + BoxRec bbox; + CARD32 b; + CharInfoPtr *ppci; + unsigned char alu; + PixTransDeclare; + + /* + * Paint background for image text + */ + if (image) + { + xBack = x; + yBack = y - FONTASCENT(pGC->font); + wBack = 0; + hBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font); + if (hBack) + { + h = nglyph; + ppci = ppciInit; + while (h--) + wBack += (*ppci++)->metrics.characterWidth; + } + if (wBack < 0) + { + xBack = xBack + wBack; + wBack = -wBack; + } + if (hBack < 0) + { + yBack = yBack + hBack; + hBack = -hBack; + } + alu = GXcopy; + if (wBack) + { + _igsSetSolidRect (cop, GXcopy, pGC->planemask, pGC->bgPixel, cmd); + _igsRect (cop, xBack, yBack, wBack, hBack, cmd); + } + } + else + { + wBack = 0; + alu = pGC->alu; + } + + _igsSetTransparentPlaneBlt (cop, alu, pGC->planemask, pGC->fgPixel, cmd); + ppci = ppciInit; + while (nglyph--) + { + pci = *ppci++; + h = pci->metrics.ascent + pci->metrics.descent; + w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing; + lw = h * ((w + 31) >> 5); + if (lw) + { + _igsPlaneBlt(cop, + x + pci->metrics.leftSideBearing, + y - pci->metrics.ascent, + w, h, cmd); + bits = (unsigned long *) pci->bits; + PixTransStart(lw); + while (lw--) + { + b = *bits++; + IgsAdjustBits32 (b); + PixTransStore(b); + } + } + x += pci->metrics.characterWidth; + } + KdMarkSync (pDrawable->pScreen); +} + +void +igsTEGlyphBlt (DrawablePtr pDrawable, + GCPtr pGC, + int xInit, + int yInit, + unsigned int nglyph, + CharInfoPtr *ppci, + Bool image) +{ + SetupIgs(pDrawable->pScreen); + CARD32 cmd; + int x, y; + int h, lw, lwTmp; + int w; + FontPtr pfont = pGC->font; + unsigned long *char1, *char2, *char3, *char4; + int widthGlyphs, widthGlyph; + BoxRec bbox; + CARD32 tmp; + PixTransDeclare; + + widthGlyph = FONTMAXBOUNDS(pfont,characterWidth); + if (!widthGlyph) + return; + + h = FONTASCENT(pfont) + FONTDESCENT(pfont); + if (!h) + return; + + x = xInit + FONTMAXBOUNDS(pfont,leftSideBearing); + y = yInit - FONTASCENT(pfont); + + if (image) + { + _igsSetOpaquePlaneBlt (cop, GXcopy, pGC->planemask, pGC->fgPixel, pGC->bgPixel, cmd); + } + else + { + _igsSetTransparentPlaneBlt (cop, pGC->alu, pGC->planemask, pGC->fgPixel, cmd); + } + +#if BITMAP_BIT_ORDER == LSBFirst +#define SHIFT << +#else +#define SHIFT >> +#endif + +#define LoopIt(count, w, loadup, fetch) \ + while (nglyph >= count) \ + { \ + nglyph -= count; \ + _igsPlaneBlt (cop, x, y, w, h, cmd); \ + x += w; \ + loadup \ + lwTmp = h; \ + PixTransStart(h); \ + while (lwTmp--) { \ + tmp = fetch; \ + IgsAdjustBits32(tmp); \ + PixTransStore(tmp); \ + } \ + } + + if (widthGlyph <= 8) + { + widthGlyphs = widthGlyph << 2; + LoopIt(4, widthGlyphs, + char1 = (unsigned long *) (*ppci++)->bits; + char2 = (unsigned long *) (*ppci++)->bits; + char3 = (unsigned long *) (*ppci++)->bits; + char4 = (unsigned long *) (*ppci++)->bits;, + (*char1++ | ((*char2++ | ((*char3++ | (*char4++ + SHIFT widthGlyph)) + SHIFT widthGlyph)) + SHIFT widthGlyph))) + } + else if (widthGlyph <= 10) + { + widthGlyphs = (widthGlyph << 1) + widthGlyph; + LoopIt(3, widthGlyphs, + char1 = (unsigned long *) (*ppci++)->bits; + char2 = (unsigned long *) (*ppci++)->bits; + char3 = (unsigned long *) (*ppci++)->bits;, + (*char1++ | ((*char2++ | (*char3++ SHIFT widthGlyph)) SHIFT widthGlyph))) + } + else if (widthGlyph <= 16) + { + widthGlyphs = widthGlyph << 1; + LoopIt(2, widthGlyphs, + char1 = (unsigned long *) (*ppci++)->bits; + char2 = (unsigned long *) (*ppci++)->bits;, + (*char1++ | (*char2++ SHIFT widthGlyph))) + } + lw = h * ((widthGlyph + 31) >> 5); + while (nglyph--) + { + _igsPlaneBlt (cop, x, y, widthGlyph, h, cmd); + x += widthGlyph; + char1 = (unsigned long *) (*ppci++)->bits; + lwTmp = lw; + PixTransStart(lw); + while (lwTmp--) + { + tmp = *char1++; + IgsAdjustBits32(tmp); + PixTransStore(tmp); + } + } + KdMarkSync (pDrawable->pScreen); +} + +/* + * Blt glyphs using image transfer window + */ + +void +igsPolyGlyphBlt (DrawablePtr pDrawable, + GCPtr pGC, + int x, + int y, + unsigned int nglyph, + CharInfoPtr *ppci, + pointer pglyphBase) +{ + if (pGC->fillStyle != FillSolid || + fbGetGCPrivate(pGC)->pm != FB_ALLONES) + { + KdCheckPolyGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); + return; + } + x += pDrawable->x; + y += pDrawable->y; + + switch (igsTextInRegion (pGC, x, y, nglyph, ppci)) { + case rgnIN: + if (TERMINALFONT(pGC->font)) + igsTEGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, FALSE); + else + igsGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, FALSE); + break; + case rgnPART: + igsGlyphBltClipped (pDrawable, pGC, x, y, nglyph, ppci, FALSE); + break; + case rgnOUT: + break; + } +} + +void +igsImageGlyphBlt (DrawablePtr pDrawable, + GCPtr pGC, + int x, int y, + unsigned int nglyph, + CharInfoPtr *ppci, + pointer pglyphBase) +{ + if (fbGetGCPrivate(pGC)->pm != FB_ALLONES) + { + KdCheckImageGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); + return; + } + x += pDrawable->x; + y += pDrawable->y; + + switch (igsTextInRegion (pGC, x, y, nglyph, ppci)) { + case rgnIN: + if (TERMINALFONT(pGC->font)) + igsTEGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, TRUE); + else + igsGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, TRUE); + break; + case rgnPART: + igsGlyphBltClipped (pDrawable, pGC, x, y, nglyph, ppci, TRUE); + break; + case rgnOUT: + break; + } +} + +static void +igsInvalidatePattern (IgsPatternCache *c, + PixmapPtr pPixmap) +{ + int i; + + if (c->base) + { + for (i = 0; i < IGS_NUM_PATTERN; i++) + { + if (c->pattern[i].serial_number == pPixmap->drawable.serialNumber) + c->pattern[i].serial_number = ~0; + } + } +} + +static void +igsInitPattern (IgsPatternCache *c, int bsize, int psize) +{ + int i; + int boffset; + int poffset; + + for (i = 0; i < IGS_NUM_PATTERN; i++) + { + boffset = i * bsize; + poffset = i * psize; + c->pattern[i].xrot = -1; + c->pattern[i].yrot = -1; + c->pattern[i].serial_number = ~0; + c->pattern[i].offset = c->offset + poffset; + c->pattern[i].base = c->base + boffset; + } + c->next = 0; +} + +static const GCOps igsOps = { + igsFillSpans, + KdCheckSetSpans, + KdCheckPutImage, + igsCopyArea, + igsCopyPlane, + KdCheckPolyPoint, + KdCheckPolylines, + KdCheckPolySegment, + miPolyRectangle, + KdCheckPolyArc, + miFillPolygon, + igsPolyFillRect, + KdCheckPolyFillArc, + miPolyText8, + miPolyText16, + miImageText8, + miImageText16, + igsImageGlyphBlt, + igsPolyGlyphBlt, + igsPushPixels, +}; + +void +igsValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable) +{ + FbGCPrivPtr fbPriv = fbGetGCPrivate(pGC); + + fbValidateGC (pGC, changes, pDrawable); + + if (pDrawable->type == DRAWABLE_WINDOW) + pGC->ops = (GCOps *) &igsOps; + else + pGC->ops = (GCOps *) &fbGCOps; +} + +GCFuncs igsGCFuncs = { + igsValidateGC, + miChangeGC, + miCopyGC, + miDestroyGC, + miChangeClip, + miDestroyClip, + miCopyClip +}; + +int +igsCreateGC (GCPtr pGC) +{ + if (!fbCreateGC (pGC)) + return FALSE; + + if (pGC->depth != 1) + pGC->funcs = &igsGCFuncs; + + return TRUE; +} + +void +igsCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + KdScreenPriv(pScreen); + RegionRec rgnDst; + int dx, dy; + WindowPtr pwinRoot; + + pwinRoot = WindowTable[pWin->drawable.pScreen->myNum]; + + dx = ptOldOrg.x - pWin->drawable.x; + dy = ptOldOrg.y - pWin->drawable.y; + REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy); + + REGION_INIT (pWin->drawable.pScreen, &rgnDst, NullBox, 0); + + REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst, &pWin->borderClip, prgnSrc); + + fbCopyRegion ((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot, + 0, + &rgnDst, dx, dy, igsCopyNtoN, 0, 0); + + REGION_UNINIT(pWin->drawable.pScreen, &rgnDst); +} + +void +igsPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) +{ + KdScreenPriv(pWin->drawable.pScreen); + PixmapPtr pTile; + + if (!REGION_NUM_RECTS(pRegion)) + return; + switch (what) { + case PW_BACKGROUND: + switch (pWin->backgroundState) { + case None: + return; + case ParentRelative: + do { + pWin = pWin->parent; + } while (pWin->backgroundState == ParentRelative); + (*pWin->drawable.pScreen->PaintWindowBackground)(pWin, pRegion, + what); + return; + case BackgroundPixmap: + pTile = pWin->background.pixmap; + if (igsPatternDimOk (pTile->drawable.width) && + igsPatternDimOk (pTile->drawable.height)) + { + igsFillBoxTiled ((DrawablePtr)pWin, + (int)REGION_NUM_RECTS(pRegion), + REGION_RECTS(pRegion), + pTile, + pWin->drawable.x, pWin->drawable.y, GXcopy); + return; + } + break; + case BackgroundPixel: + igsFillBoxSolid((DrawablePtr)pWin, + (int)REGION_NUM_RECTS(pRegion), + REGION_RECTS(pRegion), + pWin->background.pixel, GXcopy, ~0); + return; + } + break; + case PW_BORDER: + if (pWin->borderIsPixel) + { + igsFillBoxSolid((DrawablePtr)pWin, + (int)REGION_NUM_RECTS(pRegion), + REGION_RECTS(pRegion), + pWin->border.pixel, GXcopy, ~0); + return; + } + else + { + pTile = pWin->border.pixmap; + if (igsPatternDimOk (pTile->drawable.width) && + igsPatternDimOk (pTile->drawable.height)) + { + igsFillBoxTiled ((DrawablePtr)pWin, + (int)REGION_NUM_RECTS(pRegion), + REGION_RECTS(pRegion), + pTile, + pWin->drawable.x, pWin->drawable.y, GXcopy); + return; + } + } + break; + } + KdCheckPaintWindow (pWin, pRegion, what); +} + +Bool +igsDrawInit (ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + igsCardInfo(pScreenPriv); + igsScreenInfo(pScreenPriv); + int i; + int pattern_size; + int boffset, poffset; + + KdScreenInitAsync (pScreen); + + /* + * Replace various fb screen functions + */ + pScreen->CreateGC = igsCreateGC; + pScreen->CopyWindow = igsCopyWindow; + pScreen->PaintWindowBackground = igsPaintWindow; + pScreen->PaintWindowBorder = igsPaintWindow; + + /* + * Initialize patterns + */ + if (igss->tile.base) + { + pattern_size = IgsTileSize(pScreenPriv->screen->fb[0].bitsPerPixel); + igsInitPattern (&igss->tile, + pattern_size, + pattern_size * 8 / pScreenPriv->screen->fb[0].bitsPerPixel); + pattern_size = IgsStippleSize(pScreenPriv->screen->fb[0].bitsPerPixel); + igsInitPattern (&igss->stipple, + pattern_size, + pattern_size * 8 / pScreenPriv->screen->fb[0].bitsPerPixel); + } + return TRUE; +} + +void +igsDrawEnable (ScreenPtr pScreen) +{ + SetupIgs(pScreen); + CARD32 cmd; + CARD32 base; + CARD16 stride; + CARD32 format; + + stride = pScreenPriv->screen->fb[0].pixelStride; + _igsWaitIdleEmpty(cop); + _igsReset(cop); + switch (pScreenPriv->screen->fb[0].bitsPerPixel) { + case 8: + format = IGS_FORMAT_8BPP; + break; + case 16: + format = IGS_FORMAT_16BPP; + break; + case 24: + format = IGS_FORMAT_24BPP; + break; + case 32: + format = IGS_FORMAT_32BPP; + break; + } + cop->format = format; + cop->dst_stride = stride - 1; + cop->src1_stride = stride - 1; + cop->src2_stride = stride - 1; + cop->src1_start = 0; + cop->src2_start = 0; + cop->extension |= IGS_BLOCK_COP_REG | IGS_BURST_ENABLE; + + _igsSetSolidRect(cop, GXcopy, ~0, pScreen->blackPixel, cmd); + _igsRect (cop, 0, 0, + pScreenPriv->screen->width, pScreenPriv->screen->height, + cmd); + _igsWaitIdleEmpty (cop); +} + +void +igsDrawDisable (ScreenPtr pScreen) +{ +} + +void +igsDrawFini (ScreenPtr pScreen) +{ +} + +void +igsDrawSync (ScreenPtr pScreen) +{ + SetupIgs(pScreen); + + _igsWaitIdleEmpty(cop); +} --- xorg-server-1.4.2.orig/hw/kdrive/igs/igs.h +++ xorg-server-1.4.2/hw/kdrive/igs/igs.h @@ -0,0 +1,327 @@ +/* + * Copyright © 1999 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 _IGS_H_ +#define _IGS_H_ + +#include "kdrive.h" +#include "igsreg.h" + +extern KdCardFuncs igsFuncs; + +/* + * FB 0x00000000 + * VGA 0x00800000 + * Blt window 0x008a0000 + * Coprocessor 0x008bf000 + */ + +#if BITMAP_BIT_ORDER == MSBFirst +#define IGS_FB 0x00400000 +#else +#define IGS_FB 0x00000000 +#endif +#define IGS_VGA 0x00800000 +#define IGS_COP_DATA 0x008a0000 +#define IGS_COP_DATA_LEN 0x00010000 +#define IGS_COP_OFFSET 0x008bf000 +/* give audio 1/2 meg at end */ +#if 1 +#define IGS_MEM ((4096-512)*1024) +#else +#define IGS_MEM ((4096)*1024) +#endif + +#define IGS_CLOCK_REF 24576 /* KHz */ + +#define IGS_SCALE(p) ((p) ? (2 * (p)) : 1) + +#define IGS_CLOCK(m,n,p) ((IGS_CLOCK_REF * ((m) + 1)) / (((n) + 1) * IGS_SCALE(p))) + +#define IGS_MAX_CLOCK 260000 + +#define IGS_MIN_VCO 115000 + +typedef volatile CARD8 VOL8; +typedef volatile CARD16 VOL16; +typedef volatile CARD32 VOL32; + +typedef struct _Cop5xxx { + VOL8 pad000[0x10]; /* 0x000 */ + + VOL32 control; /* 0x010 */ +#define IGS_CONTROL_HBLTW_RDYZ 0x0100 +#define IGS_CONTROL_MALLWBEPTZ 0x0200 +#define IGS_CONTROL_CMDFF 0x0400 +#define IGS_CONTROL_SOP 0x0800 +#define IGS_CONTROL_OPS 0x1000 +#define IGS_CONTROL_TER 0x2000 +#define IGS_CONTROL_HBACKZ 0x4000 +#define IGS_CONTROL_BUSY 0x8000 + + VOL8 pad014[0x04]; /* 0x014 */ + + VOL32 src1_stride; /* 0x018 */ + + VOL32 format; /* 0x01c */ + +#define IGS_FORMAT_8BPP 0 +#define IGS_FORMAT_16BPP 1 +#define IGS_FORMAT_24BPP 2 +#define IGS_FORMAT_32BPP 3 + + VOL32 bres_error; /* 0x020 */ + VOL32 bres_k1; /* 0x024 */ + VOL32 bres_k2; /* 0x028 */ + VOL8 pad02c[0x1c]; /* 0x02c */ + + VOL32 mix; /* 0x048 */ +#define IGS_MIX_FG 0x00ff +#define IGS_MIX_BG 0xff00 +#define IGS_MAKE_MIX(fg,bg) ((fg) | ((bg) << 8)) + +#define IGS_MIX_ZERO 0x0 +#define IGS_MIX_SRC_AND_DST 0x1 +#define IGS_MIX_SRC_AND_NOT_DST 0x2 +#define IGS_MIX_SRC 0x3 +#define IGS_MIX_NOT_SRC_AND_DST 0x4 +#define IGS_MIX_DST 0x5 +#define IGS_MIX_SRC_XOR_DST 0x6 +#define IGS_MIX_SRC_OR_DST 0x7 +#define IGS_MIX_NOT_SRC_AND_NOT_DST 0x8 +#define IGS_MIX_SRC_XOR_NOT_DST 0x9 +#define IGS_MIX_NOT_DST 0xa +#define IGS_MIX_SRC_OR_NOT_DST 0xb +#define IGS_MIX_NOT_SRC 0xc +#define IGS_MIX_NOT_SRC_OR_DST 0xd +#define IGS_MIX_NOT_SRC_OR_NOT_DST 0xe +#define IGS_MIX_ONE 0xf + + VOL32 colorComp; /* 0x04c */ + VOL32 planemask; /* 0x050 */ + + VOL8 pad054[0x4]; /* 0x054 */ + + VOL32 fg; /* 0x058 */ + VOL32 bg; /* 0x05c */ + VOL32 dim; /* 0x060 */ +#define IGS_MAKE_DIM(w,h) ((w) | ((h) << 16)) + VOL8 pad5[0x0c]; /* 0x064 */ + + VOL32 src1_base_address; /* 0x070 */ + VOL8 pad074[0x04]; /* 0x074 */ + + VOL32 rotate; /* 0x078 */ +#define IGS_MAKE_ROTATE(x,y) ((x) | ((y) << 16)) + VOL32 operation; /* 0x07c */ + +/* OCT[2:0] */ +#define IGS_DRAW_X_MAJOR 0x00000000 +#define IGS_DRAW_Y_MAJOR 0x00000001 +#define IGS_DRAW_T_B 0x00000000 +#define IGS_DRAW_B_T 0x00000002 +#define IGS_DRAW_L_R 0x00000000 +#define IGS_DRAW_R_L 0x00000004 + +/* Draw_Mode[1:0] */ +#define IGS_DRAW_ALL 0x00000000 +#define IGS_DRAW_NOT_FIRST 0x00000010 +#define IGS_DRAW_NOT_LAST 0x00000020 +#define IGS_DRAW_NOT_FIRST_LAST 0x00000030 + +/* TRPS[1:0] */ +#define IGS_TRANS_SRC1 0x00000000 +#define IGS_TRANS_SRC2 0x00000100 +#define IGS_TRANS_DST 0x00000200 +/* TRPS2 Transparent Invert */ +#define IGS_TRANS_INVERT 0x00000400 +/* TRPS3, Transparent Enable */ +#define IGS_TRANS_ENABLE 0x00000800 + +/* PPS[3:0], Pattern Pixel Select */ +#define IGS_PIXEL_TEXT_OPAQUE 0x00001000 +#define IGS_PIXEL_STIP_OPAQUE 0x00002000 +#define IGS_PIXEL_LINE_OPAQUE 0x00003000 +#define IGS_PIXEL_TEXT_TRANS 0x00005000 +#define IGS_PIXEL_STIP_TRANS 0x00006000 +#define IGS_PIXEL_LINE_TRANS 0x00007000 +#define IGS_PIXEL_FG 0x00008000 +#define IGS_PIXEL_TILE 0x00009000 +#define IGS_PIXEL_TILE_OPAQUE 0x0000d000 + +/* HostBltEnable[1:0] */ +#define IGS_HBLT_DISABLE 0x00000000 +#define IGS_HBLT_READ 0x00010000 +#define IGS_HBLT_WRITE_1 0x00020000 +#define IGS_HBLT_WRITE_2 0x00030000 + +/* Src2MapSelect[2:0], Src2 map select mode */ +#define IGS_SRC2_NORMAL 0x00000000 +#define IGS_SRC2_MONO_OPAQUE 0x00100000 +#define IGS_SRC2_FG 0x00200000 +#define IGS_SRC2_MONO_TRANS 0x00500000 + +/* StepFunction[3:0], Step function select */ +#define IGS_STEP_DRAW_AND_STEP 0x04000000 +#define IGS_STEP_LINE_DRAW 0x05000000 +#define IGS_STEP_PXBLT 0x08000000 +#define IGS_STEP_INVERT_PXBLT 0x09000000 +#define IGS_STEP_TERNARY_PXBLT 0x0b000000 + +/* FGS */ +#define IGS_FGS_FG 0x00000000 +#define IGS_FGS_SRC 0x20000000 + +/* BGS */ +#define IGS_BGS_BG 0x00000000 +#define IGS_BGS_SRC 0x80000000 + VOL8 pad080[0x90]; /* 0x080 */ + + VOL32 debug_control; /* 0x110 */ + VOL8 pad114[0x04]; /* 0x114 */ + + VOL32 src2_stride; /* 0x118 */ + VOL8 pad11c[0x14]; /* 0x11c */ + + VOL32 extension; /* 0x130 */ + +#define IGS_BURST_ENABLE 0x01 +#define IGS_STYLE_LINE 0x02 +#define IGS_ADDITIONAL_WAIT 0x04 +#define IGS_BLOCK_COP_REG 0x08 +#define IGS_TURBO_MONO 0x10 +#define IGS_SELECT_SAMPLE 0x40 +#define IGS_MDSBL_RD_B_WR 0x80 +#define IGS_WRMRSTZ 0x100 +#define IGS_TEST_MTST 0x200 + + VOL32 style_line; /* 0x134 */ +#define IGS_MAKE_STILE_LINE(roll_over,inc,pattern,accumulator) \ + ((roll_over) | \ + ((style_line_inc) << 8) | \ + ((style_line_patern) << 16) | \ + ((style_line_accumullator) << 24)) + VOL32 style_line_pattern_index; /* 0x138 */ + + VOL32 mono_burst_total; /* 0x13c */ + VOL8 pad140[0x10]; /* 0x140 */ + + VOL32 pat_x_rotate; /* 0x150 */ + VOL8 pad154[0x1c]; /* 0x154 */ + + VOL32 src1_start; /* 0x170 */ + VOL32 src2_start; /* 0x174 */ + VOL32 dst_start; /* 0x178 */ + VOL8 pad17c[0x9c]; /* 0x17c */ + + VOL32 dst_stride; /* 0x218 */ +} Cop5xxx; + +typedef struct _igsCardInfo { + Cop5xxx *cop; + VOL8 *vga; + VOL32 *copData; + CARD8 *frameBuffer; + IgsVga igsvga; +} IgsCardInfo; + +#define getIgsCardInfo(kd) ((IgsCardInfo *) ((kd)->card->driver)) +#define igsCardInfo(kd) IgsCardInfo *igsc = getIgsCardInfo(kd) + +typedef struct _igsCursor { + int width, height; + int xhot, yhot; + Bool has_cursor; + CursorPtr pCursor; + Pixel source, mask; +} IgsCursor; + +#define IGS_CURSOR_WIDTH 64 +#define IGS_CURSOR_HEIGHT 64 + +typedef struct _igsPattern { + INT32 xrot, yrot; + CARD32 serial_number; + CARD8 *base; + CARD32 offset; +} IgsPattern; + +#define IGS_NUM_PATTERN 8 +#define IGS_PATTERN_WIDTH 8 +#define IGS_PATTERN_HEIGHT 8 + +typedef struct _igsPatternCache { + CARD8 *base; + CARD32 offset; + IgsPattern pattern[IGS_NUM_PATTERN]; + int next; +} IgsPatternCache; + +typedef struct _igsScreenInfo { + CARD8 *cursor_base; + CARD32 cursor_offset; + IgsCursor cursor; + IgsPatternCache tile; + IgsPatternCache stipple; +} IgsScreenInfo; + +#define IgsTileSize(bpp) (IGS_PATTERN_WIDTH*(bpp)/8*IGS_PATTERN_HEIGHT) +#define IgsStippleSize(bpp) (IGS_PATTERN_WIDTH/8*IGS_PATTERN_HEIGHT) + +#define getIgsScreenInfo(kd) ((IgsScreenInfo *) ((kd)->screen->driver)) +#define igsScreenInfo(kd) IgsScreenInfo *igss = getIgsScreenInfo(kd) + +Bool +igsDrawInit (ScreenPtr pScreen); + +void +igsDrawEnable (ScreenPtr pScreen); + +void +igsDrawDisable (ScreenPtr pScreen); + +void +igsDrawSync (ScreenPtr pScreen); + +void +igsDrawFini (ScreenPtr pScreen); + +void +igsGetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs); + +void +igsPutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs); + +Bool +igsCursorInit (ScreenPtr pScreen); + +void +igsCursorEnable (ScreenPtr pScreen); + +void +igsCursorDisable (ScreenPtr pScreen); + +void +igsCursorFini (ScreenPtr pScreen); + +#endif /* _IGS_H_ */ --- xorg-server-1.4.2.orig/hw/kdrive/igs/igsstub.c +++ xorg-server-1.4.2/hw/kdrive/igs/igsstub.c @@ -0,0 +1,71 @@ +/* + * 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_CONFIG_H +#include +#endif +#include "igs.h" + +void +InitCard (char *name) +{ + KdCardAttr attr; + CARD32 count; + + count = 0; +#ifdef EMBED + attr.address[0] = 0x10000000; /* Adomo Wing video base address */ + attr.io = 0; + attr.naddr = 1; +#else + while (LinuxFindPci (0x10ea, 0x5000, count, &attr)) +#endif + { + KdCardInfoAdd (&igsFuncs, &attr, 0); + count++; + } +} + +void +InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) +{ + KdInitOutput (pScreenInfo, argc, argv); +} + +void +InitInput (int argc, char **argv) +{ + KdOsAddInputDrivers (); + KdInitInput (); +} + +void +ddxUseMsg (void) +{ + KdUseMsg (); +} + +int +ddxProcessArgument (int argc, char **argv, int i) +{ + return KdProcessArgument (argc, argv, i); +} --- xorg-server-1.4.2.orig/hw/kdrive/igs/igsdraw.h +++ xorg-server-1.4.2/hw/kdrive/igs/igsdraw.h @@ -0,0 +1,258 @@ +/* + * 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. + */ + +#ifndef _IGSDRAW_H_ +#define _IGSDRAW_H_ + +extern CARD8 igsPatRop[]; + +#define SetupIgs(s) KdScreenPriv(s); \ + igsCardInfo(pScreenPriv); \ + Cop5xxx *cop = igsc->cop; \ + int cop_stride = pScreenPriv->screen->fb[0].pixelStride + +#define _igsWaitLoop(cop,mask,value) { \ + int __loop = 1000000; \ + while (((cop)->control & (mask)) != (value)) { \ + if (--__loop <= 0) { \ + FatalError("Warning: igsWaitLoop 0x%x 0x%x failed\n", mask, value); \ + } \ + } \ +} + +#define _igsWaitDone(cop) _igsWaitLoop(cop, \ + (IGS_CONTROL_BUSY| \ + IGS_CONTROL_MALLWBEPTZ), \ + 0) + +#if 1 +#define _igsWaitFull(cop) _igsWaitLoop(cop, \ + IGS_CONTROL_CMDFF, \ + 0) +#else +#define _igsWaitFull(cop) _igsWaitDone(cop) +#endif + +#define _igsWaitIdleEmpty(cop) _igsWaitDone(cop) +#define _igsWaitHostBltAck(cop) _igsWaitLoop(cop, \ + (IGS_CONTROL_HBACKZ| \ + IGS_CONTROL_CMDFF), \ + 0) + +#define _igsReset(cop) ((cop)->control = 0) + +#define IgsInvertBits32(v) { \ + v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \ + v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \ + v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \ +} + +#define IgsInvertBits16(v) { \ + v = ((v & 0x5555) << 1) | ((v >> 1) & 0x5555); \ + v = ((v & 0x3333) << 2) | ((v >> 2) & 0x3333); \ + v = ((v & 0x0f0f) << 4) | ((v >> 4) & 0x0f0f); \ +} + +#define IgsInvertBits8(v) { \ + v = ((v & 0x55) << 1) | ((v >> 1) & 0x55); \ + v = ((v & 0x33) << 2) | ((v >> 2) & 0x33); \ + v = ((v & 0x0f) << 4) | ((v >> 4) & 0x0f); \ +} + +#define IgsByteSwap32(x) ((x) = (((x) >> 24) | \ + (((x) >> 8) & 0xff00) | \ + (((x) << 8) & 0xff0000) | \ + ((x) << 24))) + +#define IgsByteSwap16(x) ((x) = ((x) << 8) | ((x) >> 8)) + +#define igsPatternDimOk(d) ((d) <= IGS_PATTERN_WIDTH && (((d) & ((d) - 1)) == 0)) + +#if BITMAP_BIT_ORDER == LSBFirst +#define IgsAdjustBits32(b) IgsInvertBits32(b) +#define IgsAdjustBits16(x) IgsInvertBits16(x) +#else +#define IgsAdjustBits32(x) IgsByteSwap32(x) +#define IgsAdjustBits16(x) IgsByteSwap16(x) +#endif + +#define _igsSetSolidRect(cop,alu,pm,pix,cmd) {\ + _igsWaitFull(cop); \ + (cop)->mix = IGS_MAKE_MIX(alu,alu); \ + (cop)->fg = (pix); \ + (cmd) = (IGS_DRAW_T_B | \ + IGS_DRAW_L_R | \ + IGS_DRAW_ALL | \ + IGS_PIXEL_FG | \ + IGS_HBLT_DISABLE | \ + IGS_SRC2_NORMAL | \ + IGS_STEP_PXBLT | \ + IGS_FGS_FG | \ + IGS_BGS_BG); \ +} + +#define _igsSetTiledRect(cop,alu,pm,base,cmd) {\ + _igsWaitFull(cop); \ + (cop)->mix = IGS_MAKE_MIX(alu,alu); \ + (cop)->src1_stride = IGS_PATTERN_WIDTH - 1; \ + (cop)->src1_start = (base); \ + (cmd) = (IGS_DRAW_T_B | \ + IGS_DRAW_L_R | \ + IGS_DRAW_ALL | \ + IGS_PIXEL_TILE | \ + IGS_HBLT_DISABLE | \ + IGS_SRC2_NORMAL | \ + IGS_STEP_PXBLT | \ + IGS_FGS_SRC | \ + IGS_BGS_BG); \ +} + +#define _igsSetStippledRect(cop,alu,pm,pix,base,cmd) {\ + _igsWaitFull(cop); \ + (cop)->mix = IGS_MAKE_MIX(alu,alu); \ + (cop)->src1_start = (base); \ + (cop)->fg = (pix); \ + (cmd) = (IGS_DRAW_T_B | \ + IGS_DRAW_L_R | \ + IGS_DRAW_ALL | \ + IGS_PIXEL_STIP_TRANS | \ + IGS_HBLT_DISABLE | \ + IGS_SRC2_NORMAL | \ + IGS_STEP_PXBLT | \ + IGS_FGS_FG | \ + IGS_BGS_BG); \ +} + +#define _igsSetOpaqueStippledRect(cop,alu,pm,_fg,_bg,base,cmd) {\ + _igsWaitFull(cop); \ + (cop)->mix = IGS_MAKE_MIX(alu,alu); \ + (cop)->src1_start = (base); \ + (cop)->fg = (_fg); \ + (cop)->bg = (_bg); \ + (cmd) = (IGS_DRAW_T_B | \ + IGS_DRAW_L_R | \ + IGS_DRAW_ALL | \ + IGS_PIXEL_STIP_OPAQUE | \ + IGS_HBLT_DISABLE | \ + IGS_SRC2_NORMAL | \ + IGS_STEP_PXBLT | \ + IGS_FGS_FG | \ + IGS_BGS_BG); \ +} + +#define _igsRect(cop,x,y,w,h,cmd) { \ + _igsWaitFull(cop); \ + (cop)->dst_start = (x) + (y) * (cop_stride); \ + (cop)->dim = IGS_MAKE_DIM(w-1,h-1); \ + (cop)->operation = (cmd); \ +} + +#define _igsPatRect(cop,x,y,w,h,cmd) { \ + _igsWaitFull(cop); \ + (cop)->dst_start = (x) + (y) * (cop_stride); \ + (cop)->rotate = IGS_MAKE_ROTATE(x&7,y&7); \ + (cop)->dim = IGS_MAKE_DIM(w-1,h-1); \ + (cop)->operation = (cmd); \ +} + +#define _igsSetBlt(cop,alu,pm,backwards,upsidedown,cmd) { \ + _igsWaitFull(cop); \ + (cop)->mix = IGS_MAKE_MIX(alu,alu); \ + (cop)->src1_stride = cop_stride - 1; \ + (cmd) = (IGS_DRAW_ALL | \ + IGS_PIXEL_FG | \ + IGS_HBLT_DISABLE | \ + IGS_SRC2_NORMAL | \ + IGS_STEP_PXBLT | \ + IGS_FGS_SRC | \ + IGS_BGS_BG); \ + if (backwards) (cmd) |= IGS_DRAW_R_L; \ + if (upsidedown) (cmd) |= IGS_DRAW_B_T; \ +} + +#if 0 +#define _igsPreparePlaneBlt(cop) { \ + _igsReset(cop); \ + (cop)->dst_stride = cop_stride - 1; \ + (cop)->src1_stride = cop_stride - 1; \ + (cop)->src2_stride = cop_stride - 1; \ + (cop)->format = IGS_FORMAT_16BPP; \ + (cop)->src1_start = 0; \ + (cop)->src2_start = 0; \ +} +#else +#define _igsPreparePlaneBlt(cop) +#endif + +#define _igsSetTransparentPlaneBlt(cop,alu,pm,fg_pix,cmd) { \ + _igsWaitIdleEmpty(cop); \ + _igsPreparePlaneBlt(cop); \ + (cop)->mix = IGS_MAKE_MIX(igsPatRop[alu],igsPatRop[alu]); \ + (cop)->fg = (fg_pix); \ + (cmd) = (IGS_DRAW_T_B | \ + IGS_DRAW_L_R | \ + IGS_DRAW_ALL | \ + IGS_PIXEL_FG | \ + IGS_HBLT_WRITE_2 | \ + IGS_SRC2_MONO_TRANS | \ + IGS_STEP_TERNARY_PXBLT | \ + IGS_FGS_FG | \ + IGS_BGS_BG); \ +} + +#define _igsSetOpaquePlaneBlt(cop,alu,pm,fg_pix,bg_pix,cmd) { \ + _igsWaitIdleEmpty(cop); \ + _igsPreparePlaneBlt(cop); \ + (cop)->mix = IGS_MAKE_MIX(igsPatRop[alu],igsPatRop[alu]); \ + (cop)->fg = (fg_pix); \ + (cop)->bg = (bg_pix); \ + (cmd) = (IGS_DRAW_T_B | \ + IGS_DRAW_L_R | \ + IGS_DRAW_ALL | \ + IGS_PIXEL_FG | \ + IGS_HBLT_WRITE_2 | \ + IGS_SRC2_MONO_OPAQUE | \ + IGS_STEP_TERNARY_PXBLT | \ + IGS_FGS_FG | \ + IGS_BGS_BG); \ +} + +#define _igsPlaneBlt(cop,x,y,w,h,cmd) { \ +/* _igsWaitFull(cop); */ \ + (cop)->dst_start = (x) + (y) * (cop_stride); \ + (cop)->dim = IGS_MAKE_DIM((w)-1,(h)-1); \ + (cop)->operation = (cmd); \ +/* _igsWaitHostBltAck(cop); */ \ +} + +#define _igsBlt(cop,sx,sy,dx,dy,w,h,cmd) { \ + _igsWaitFull(cop); \ + (cop)->dst_start = (dx) + (dy) * cop_stride; \ + (cop)->src1_start = (sx) + (sy) * cop_stride; \ + (cop)->src1_stride = cop_stride - 1; \ + (cop)->dim = IGS_MAKE_DIM(w-1,h-1); \ + (cop)->operation = (cmd); \ +} + +#define sourceInvarient(alu) (((alu) & 3) == (((alu) >> 2) & 3)) + +#endif --- xorg-server-1.4.2.orig/hw/kdrive/pm2/Makefile.in +++ xorg-server-1.4.2/hw/kdrive/pm2/Makefile.in @@ -151,7 +151,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -285,10 +285,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/kdrive/savage/s3draw.c +++ xorg-server-1.4.2/hw/kdrive/savage/s3draw.c @@ -0,0 +1,3241 @@ +/* + * Copyright 1999 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_CONFIG_H +#include +#endif +#include "s3.h" +#include "s3draw.h" + +#include "Xmd.h" +#include "gcstruct.h" +#include "scrnintstr.h" +#include "pixmapstr.h" +#include "regionstr.h" +#include "mistruct.h" +#include "fontstruct.h" +#include "dixfontstr.h" +#include "fb.h" +#include "migc.h" +#include "miline.h" + +/* + * Map X rops to S3 rops + */ + +short s3alu[16] = { + MIX_0, + MIX_AND, + MIX_SRC_AND_NOT_DST, + MIX_SRC, + MIX_NOT_SRC_AND_DST, + MIX_DST, + MIX_XOR, + MIX_OR, + MIX_NOR, + MIX_XNOR, + MIX_NOT_DST, + MIX_SRC_OR_NOT_DST, + MIX_NOT_SRC, + MIX_NOT_SRC_OR_DST, + MIX_NAND, + MIX_1 +}; + +/* + * Handle pixel transfers + */ + +#define BURST +#ifdef BURST +#define PixTransDeclare VOL32 *pix_trans_base = (VOL32 *) (s3c->registers),\ + *pix_trans = pix_trans_base +#define PixTransStart(n) if (pix_trans + (n) > pix_trans_base + 8192) pix_trans = pix_trans_base +#define PixTransStore(t) *pix_trans++ = (t) +#else +#define PixTransDeclare VOL32 *pix_trans = &s3->pix_trans +#define PixTransStart(n) +#define PixTransStore(t) *pix_trans = (t) +#endif + +int s3GCPrivateIndex; +int s3WindowPrivateIndex; +int s3Generation; + +/* + s3DoBitBlt + ============= + Bit Blit for all window to window blits. +*/ + +#define sourceInvarient(alu) (((alu) & 3) == (((alu) >> 2) & 3)) + +void +s3CopyNtoN (DrawablePtr pSrcDrawable, + DrawablePtr pDstDrawable, + GCPtr pGC, + BoxPtr pbox, + int nbox, + int dx, + int dy, + Bool reverse, + Bool upsidedown, + Pixel bitplane, + void *closure) +{ + SetupS3(pDstDrawable->pScreen); + int srcX, srcY, dstX, dstY; + int w, h; + int flags; + + if (sourceInvarient (pGC->alu)) + { + s3FillBoxSolid (pDstDrawable, nbox, pbox, 0, pGC->alu, pGC->planemask); + return; + } + + s3SetGlobalBitmap (pDstDrawable->pScreen, s3GCMap (pGC)); + _s3SetBlt(s3,pGC->alu,pGC->planemask); + DRAW_DEBUG ((DEBUG_RENDER, "s3CopyNtoN alu %d planemask 0x%x", + pGC->alu, pGC->planemask)); + while (nbox--) + { + w = pbox->x2 - pbox->x1; + h = pbox->y2 - pbox->y1; + flags = 0; + if (reverse) + { + dstX = pbox->x2 - 1; + } + else + { + dstX = pbox->x1; + flags |= INC_X; + } + srcX = dstX + dx; + + if (upsidedown) + { + dstY = pbox->y2 - 1; + } + else + { + dstY = pbox->y1; + flags |= INC_Y; + } + srcY = dstY + dy; + + _s3Blt (s3, srcX, srcY, dstX, dstY, w, h, flags); + pbox++; + } + MarkSyncS3 (pSrcDrawable->pScreen); +} + +RegionPtr +s3CopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, + int srcx, int srcy, int width, int height, int dstx, int dsty) +{ + SetupS3(pDstDrawable->pScreen); + + if (pSrcDrawable->type == DRAWABLE_WINDOW && + pDstDrawable->type == DRAWABLE_WINDOW) + { + return fbDoCopy (pSrcDrawable, pDstDrawable, pGC, + srcx, srcy, width, height, + dstx, dsty, s3CopyNtoN, 0, 0); + } + return KdCheckCopyArea (pSrcDrawable, pDstDrawable, pGC, + srcx, srcy, width, height, dstx, dsty); +} + +typedef struct _s31toNargs { + unsigned long copyPlaneFG, copyPlaneBG; + Bool opaque; +} s31toNargs; + +void +_s3Stipple (S3CardInfo *s3c, + FbStip *psrcBase, + FbStride widthSrc, + int srcx, + int srcy, + int dstx, + int dsty, + int width, + int height) +{ + S3Ptr s3 = s3c->s3; + FbStip *psrcLine, *psrc; + FbStride widthRest; + FbStip bits, tmp, lastTmp; + int leftShift, rightShift; + int nl, nlMiddle; + int r; + PixTransDeclare; + + /* Compute blt address and parameters */ + psrc = psrcBase + srcy * widthSrc + (srcx >> 5); + nlMiddle = (width + 31) >> 5; + leftShift = srcx & 0x1f; + rightShift = 32 - leftShift; + widthRest = widthSrc - nlMiddle; + + _s3PlaneBlt(s3,dstx,dsty,width,height); + + if (leftShift == 0) + { + while (height--) + { + nl = nlMiddle; + PixTransStart(nl); + while (nl--) + { + tmp = *psrc++; + S3AdjustBits32 (tmp); + PixTransStore (tmp); + } + psrc += widthRest; + } + } + else + { + widthRest--; + while (height--) + { + bits = *psrc++; + nl = nlMiddle; + PixTransStart(nl); + while (nl--) + { + tmp = FbStipLeft(bits, leftShift); + bits = *psrc++; + tmp |= FbStipRight(bits, rightShift); + S3AdjustBits32(tmp); + PixTransStore (tmp); + } + psrc += widthRest; + } + } +} + +void +s3Copy1toN (DrawablePtr pSrcDrawable, + DrawablePtr pDstDrawable, + GCPtr pGC, + BoxPtr pbox, + int nbox, + int dx, + int dy, + Bool reverse, + Bool upsidedown, + Pixel bitplane, + void *closure) +{ + SetupS3(pDstDrawable->pScreen); + + s31toNargs *args = closure; + int dstx, dsty; + FbStip *psrcBase; + FbStride widthSrc; + int srcBpp; + int srcXoff, srcYoff; + + if (args->opaque && sourceInvarient (pGC->alu)) + { + s3FillBoxSolid (pDstDrawable, nbox, pbox, + pGC->bgPixel, pGC->alu, pGC->planemask); + return; + } + + s3SetGlobalBitmap (pDstDrawable->pScreen, s3GCMap (pGC)); + fbGetStipDrawable (pSrcDrawable, psrcBase, widthSrc, srcBpp, srcXoff, srcYoff); + + if (args->opaque) + { + _s3SetOpaquePlaneBlt(s3,pGC->alu,pGC->planemask,args->copyPlaneFG, + args->copyPlaneBG); + } + else + { + _s3SetTransparentPlaneBlt (s3, pGC->alu, + pGC->planemask, args->copyPlaneFG); + } + + while (nbox--) + { + dstx = pbox->x1; + dsty = pbox->y1; + + _s3Stipple (s3c, + psrcBase, widthSrc, + dstx + dx - srcXoff, dsty + dy - srcYoff, + dstx, dsty, + pbox->x2 - dstx, pbox->y2 - dsty); + pbox++; + } + MarkSyncS3 (pDstDrawable->pScreen); +} + +RegionPtr +s3CopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, + int srcx, int srcy, int width, int height, + int dstx, int dsty, unsigned long bitPlane) +{ + SetupS3 (pDstDrawable->pScreen); + RegionPtr ret; + s31toNargs args; + + if (pDstDrawable->type == DRAWABLE_WINDOW && + pSrcDrawable->depth == 1) + { + args.copyPlaneFG = pGC->fgPixel; + args.copyPlaneBG = pGC->bgPixel; + args.opaque = TRUE; + return fbDoCopy (pSrcDrawable, pDstDrawable, pGC, + srcx, srcy, width, height, + dstx, dsty, s3Copy1toN, bitPlane, &args); + } + return KdCheckCopyPlane(pSrcDrawable, pDstDrawable, pGC, + srcx, srcy, width, height, + dstx, dsty, bitPlane); +} + +void +s3PushPixels (GCPtr pGC, PixmapPtr pBitmap, + DrawablePtr pDrawable, + int w, int h, int x, int y) +{ + SetupS3 (pDrawable->pScreen); + s31toNargs args; + + if (pDrawable->type == DRAWABLE_WINDOW && pGC->fillStyle == FillSolid) + { + args.opaque = FALSE; + args.copyPlaneFG = pGC->fgPixel; + (void) fbDoCopy ((DrawablePtr) pBitmap, pDrawable, pGC, + 0, 0, w, h, x, y, s3Copy1toN, 1, &args); + } + else + { + KdCheckPushPixels (pGC, pBitmap, pDrawable, w, h, x, y); + } +} + +void +s3FillBoxSolid (DrawablePtr pDrawable, int nBox, BoxPtr pBox, + unsigned long pixel, int alu, unsigned long planemask) +{ + SetupS3(pDrawable->pScreen); + register int r; + + s3SetGlobalBitmap (pDrawable->pScreen, s3DrawMap (pDrawable)); + _s3SetSolidFill(s3,pixel,alu,planemask); + + while (nBox--) { + _s3SolidRect(s3,pBox->x1,pBox->y1,pBox->x2-pBox->x1,pBox->y2-pBox->y1); + pBox++; + } + MarkSyncS3 (pDrawable->pScreen); +} + +void +_s3SetPattern (ScreenPtr pScreen, int ma, + int alu, unsigned long planemask, s3PatternPtr pPattern) +{ + SetupS3(pScreen); + S3PatternCache *cache; + + _s3LoadPattern (pScreen, ma, pPattern); + cache = pPattern->cache; + + switch (pPattern->fillStyle) { + case FillTiled: + _s3SetTile(s3,alu,planemask); + break; + case FillStippled: + _s3SetStipple(s3,alu,planemask,pPattern->fore); + break; + case FillOpaqueStippled: + _s3SetOpaqueStipple(s3,alu,planemask,pPattern->fore,pPattern->back); + break; + } +} + +void +s3FillBoxPattern (DrawablePtr pDrawable, int nBox, BoxPtr pBox, + int alu, unsigned long planemask, s3PatternPtr pPattern) +{ + SetupS3(pDrawable->pScreen); + S3PatternCache *cache; + int patx, paty; + + s3SetGlobalBitmap (pDrawable->pScreen, s3DrawMap (pDrawable)); + _s3SetPattern (pDrawable->pScreen, s3DrawMap(pDrawable), alu, planemask, pPattern); + cache = pPattern->cache; + while (nBox--) + { + _s3PatRect(s3,cache->x, cache->y, + pBox->x1, pBox->y1, + pBox->x2-pBox->x1, pBox->y2-pBox->y1); + pBox++; + } + MarkSyncS3 (pDrawable->pScreen); +} + +void +s3FillBoxLargeStipple (DrawablePtr pDrawable, GCPtr pGC, + int nBox, BoxPtr pBox) +{ + SetupS3(pDrawable->pScreen); + DrawablePtr pStipple = &pGC->stipple->drawable; + int xRot = pGC->patOrg.x + pDrawable->x; + int yRot = pGC->patOrg.y + pDrawable->y; + FbStip *stip; + FbStride stipStride; + int stipBpp; + int stipXoff, stipYoff; + int stipWidth, stipHeight; + int dstX, dstY, width, height; + + stipWidth = pStipple->width; + stipHeight = pStipple->height; + fbGetStipDrawable (pStipple, stip, stipStride, stipBpp, stipXoff, stipYoff); + + s3SetGlobalBitmap (pDrawable->pScreen, s3DrawMap (pDrawable)); + if (pGC->fillStyle == FillOpaqueStippled) + { + _s3SetOpaquePlaneBlt(s3,pGC->alu,pGC->planemask, + pGC->fgPixel, pGC->bgPixel); + + } + else + { + _s3SetTransparentPlaneBlt(s3,pGC->alu,pGC->planemask, pGC->fgPixel); + } + + while (nBox--) + { + int stipX, stipY, sx; + int widthTmp; + int h, w; + int x, y; + + dstX = pBox->x1; + dstY = pBox->y1; + width = pBox->x2 - pBox->x1; + height = pBox->y2 - pBox->y1; + pBox++; + modulus (dstY - yRot - stipYoff, stipHeight, stipY); + modulus (dstX - xRot - stipXoff, stipWidth, stipX); + y = dstY; + while (height) + { + h = stipHeight - stipY; + if (h > height) + h = height; + height -= h; + widthTmp = width; + x = dstX; + sx = stipX; + while (widthTmp) + { + w = (stipWidth - sx); + if (w > widthTmp) + w = widthTmp; + widthTmp -= w; + _s3Stipple (s3c, + stip, + stipStride, + sx, stipY, + x, y, + w, h); + x += w; + sx = 0; + } + y += h; + stipY = 0; + } + } + MarkSyncS3 (pDrawable->pScreen); +} + +#define NUM_STACK_RECTS 1024 + +void +s3PolyFillRect (DrawablePtr pDrawable, GCPtr pGC, + int nrectFill, xRectangle *prectInit) +{ + s3GCPrivate(pGC); + xRectangle *prect; + RegionPtr prgnClip; + register BoxPtr pbox; + register BoxPtr pboxClipped; + BoxPtr pboxClippedBase; + BoxPtr pextent; + BoxRec stackRects[NUM_STACK_RECTS]; + int numRects; + int n; + int xorg, yorg; + int x, y; + + prgnClip = fbGetCompositeClip(pGC); + xorg = pDrawable->x; + yorg = pDrawable->y; + + if (xorg || yorg) + { + prect = prectInit; + n = nrectFill; + while(n--) + { + prect->x += xorg; + prect->y += yorg; + prect++; + } + } + + prect = prectInit; + + numRects = REGION_NUM_RECTS(prgnClip) * nrectFill; + if (numRects > NUM_STACK_RECTS) + { + pboxClippedBase = (BoxPtr)ALLOCATE_LOCAL(numRects * sizeof(BoxRec)); + if (!pboxClippedBase) + return; + } + else + pboxClippedBase = stackRects; + + pboxClipped = pboxClippedBase; + + if (REGION_NUM_RECTS(prgnClip) == 1) + { + int x1, y1, x2, y2, bx2, by2; + + pextent = REGION_RECTS(prgnClip); + x1 = pextent->x1; + y1 = pextent->y1; + x2 = pextent->x2; + y2 = pextent->y2; + while (nrectFill--) + { + if ((pboxClipped->x1 = prect->x) < x1) + pboxClipped->x1 = x1; + + if ((pboxClipped->y1 = prect->y) < y1) + pboxClipped->y1 = y1; + + bx2 = (int) prect->x + (int) prect->width; + if (bx2 > x2) + bx2 = x2; + pboxClipped->x2 = bx2; + + by2 = (int) prect->y + (int) prect->height; + if (by2 > y2) + by2 = y2; + pboxClipped->y2 = by2; + + prect++; + if ((pboxClipped->x1 < pboxClipped->x2) && + (pboxClipped->y1 < pboxClipped->y2)) + { + pboxClipped++; + } + } + } + else + { + int x1, y1, x2, y2, bx2, by2; + + pextent = REGION_EXTENTS(pGC->pScreen, prgnClip); + x1 = pextent->x1; + y1 = pextent->y1; + x2 = pextent->x2; + y2 = pextent->y2; + while (nrectFill--) + { + BoxRec box; + + if ((box.x1 = prect->x) < x1) + box.x1 = x1; + + if ((box.y1 = prect->y) < y1) + box.y1 = y1; + + bx2 = (int) prect->x + (int) prect->width; + if (bx2 > x2) + bx2 = x2; + box.x2 = bx2; + + by2 = (int) prect->y + (int) prect->height; + if (by2 > y2) + by2 = y2; + box.y2 = by2; + + prect++; + + if ((box.x1 >= box.x2) || (box.y1 >= box.y2)) + continue; + + n = REGION_NUM_RECTS (prgnClip); + pbox = REGION_RECTS(prgnClip); + + /* clip the rectangle to each box in the clip region + this is logically equivalent to calling Intersect() + */ + while(n--) + { + pboxClipped->x1 = max(box.x1, pbox->x1); + pboxClipped->y1 = max(box.y1, pbox->y1); + pboxClipped->x2 = min(box.x2, pbox->x2); + pboxClipped->y2 = min(box.y2, pbox->y2); + pbox++; + + /* see if clipping left anything */ + if(pboxClipped->x1 < pboxClipped->x2 && + pboxClipped->y1 < pboxClipped->y2) + { + pboxClipped++; + } + } + } + } + if (pboxClipped != pboxClippedBase) + { + if (pGC->fillStyle == FillSolid) + s3FillBoxSolid(pDrawable, + pboxClipped-pboxClippedBase, pboxClippedBase, + pGC->fgPixel, pGC->alu, pGC->planemask); + else if (s3Priv->pPattern) + s3FillBoxPattern (pDrawable, + pboxClipped-pboxClippedBase, pboxClippedBase, + pGC->alu, pGC->planemask, + s3Priv->pPattern); + else + s3FillBoxLargeStipple (pDrawable, pGC, + pboxClipped-pboxClippedBase, + pboxClippedBase); + } + if (pboxClippedBase != stackRects) + DEALLOCATE_LOCAL(pboxClippedBase); +} + +void +_s3FillSpanLargeStipple (DrawablePtr pDrawable, GCPtr pGC, + int n, DDXPointPtr ppt, int *pwidth) +{ + SetupS3 (pDrawable->pScreen); + DrawablePtr pStipple = &pGC->stipple->drawable; + int xRot = pGC->patOrg.x + pDrawable->x; + int yRot = pGC->patOrg.y + pDrawable->y; + FbStip *stip; + FbStride stipStride; + int stipBpp; + int stipXoff, stipYoff; + int stipWidth, stipHeight; + int dstX, dstY, width, height; + + s3SetGlobalBitmap (pDrawable->pScreen, s3GCMap (pGC)); + stipWidth = pStipple->width; + stipHeight = pStipple->height; + fbGetStipDrawable (pStipple, stip, stipStride, stipBpp, stipXoff, stipYoff); + if (pGC->fillStyle == FillOpaqueStippled) + { + _s3SetOpaquePlaneBlt(s3,pGC->alu,pGC->planemask, + pGC->fgPixel, pGC->bgPixel); + + } + else + { + _s3SetTransparentPlaneBlt(s3,pGC->alu,pGC->planemask, pGC->fgPixel); + } + while (n--) + { + int stipX, stipY, sx; + int w; + int x, y; + + dstX = ppt->x; + dstY = ppt->y; + ppt++; + width = *pwidth++; + modulus (dstY - yRot - stipYoff, stipHeight, stipY); + modulus (dstX - xRot - stipXoff, stipWidth, stipX); + y = dstY; + x = dstX; + sx = stipX; + while (width) + { + w = (stipWidth - sx); + if (w > width) + w = width; + width -= w; + _s3Stipple (s3c, + stip, + stipStride, + sx, stipY, + x, y, + w, 1); + x += w; + sx = 0; + } + } +} + +void +s3FillSpans (DrawablePtr pDrawable, GCPtr pGC, int n, + DDXPointPtr ppt, int *pwidth, int fSorted) +{ + s3GCPrivate(pGC); + SetupS3(pDrawable->pScreen); + int x, y, x1, y1, x2, y2; + int width; + /* next three parameters are post-clip */ + int nTmp; + int *pwidthFree;/* copies of the pointers to free */ + DDXPointPtr pptFree; + BoxPtr extents; + S3PatternCache *cache; + RegionPtr pClip = fbGetCompositeClip (pGC); + + s3SetGlobalBitmap (pDrawable->pScreen, s3GCMap (pGC)); + if (REGION_NUM_RECTS(pClip) == 1 && + (pGC->fillStyle == FillSolid || s3Priv->pPattern)) + { + extents = REGION_RECTS(pClip); + x1 = extents->x1; + x2 = extents->x2; + y1 = extents->y1; + y2 = extents->y2; + if (pGC->fillStyle == FillSolid) + { + _s3SetSolidFill(s3,pGC->fgPixel,pGC->alu,pGC->planemask); + cache = 0; + } + else + { + _s3SetPattern (pDrawable->pScreen, s3GCMap(pGC), pGC->alu, pGC->planemask, + s3Priv->pPattern); + cache = s3Priv->pPattern->cache; + } + while (n--) + { + y = ppt->y; + if (y1 <= y && y < y2) + { + x = ppt->x; + width = *pwidth; + if (x < x1) + { + width -= (x1 - x); + x = x1; + } + if (x2 < x + width) + width = x2 - x; + if (width > 0) + { + if (cache) + { + _s3PatRect(s3, cache->x, cache->y, x, y, width, 1); + } + else + { + _s3SolidRect(s3,x,y,width,1); + } + } + } + ppt++; + pwidth++; + } + } + else + { + nTmp = n * miFindMaxBand(pClip); + pwidthFree = (int *)ALLOCATE_LOCAL(nTmp * sizeof(int)); + pptFree = (DDXPointRec *)ALLOCATE_LOCAL(nTmp * sizeof(DDXPointRec)); + if(!pptFree || !pwidthFree) + { + if (pptFree) DEALLOCATE_LOCAL(pptFree); + if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); + return; + } + n = miClipSpans(fbGetCompositeClip(pGC), + ppt, pwidth, n, + pptFree, pwidthFree, fSorted); + pwidth = pwidthFree; + ppt = pptFree; + if (pGC->fillStyle == FillSolid) + { + _s3SetSolidFill(s3,pGC->fgPixel,pGC->alu,pGC->planemask); + while (n--) + { + x = ppt->x; + y = ppt->y; + ppt++; + width = *pwidth++; + if (width) + { + _s3SolidRect(s3,x,y,width,1); + } + } + } + else if (s3Priv->pPattern) + { + _s3SetPattern (pDrawable->pScreen, s3GCMap(pGC), pGC->alu, pGC->planemask, + s3Priv->pPattern); + cache = s3Priv->pPattern->cache; + while (n--) + { + x = ppt->x; + y = ppt->y; + ppt++; + width = *pwidth++; + if (width) + { + _s3PatRect(s3, cache->x, cache->y, x, y, width, 1); + } + } + } + else + { + _s3FillSpanLargeStipple (pDrawable, pGC, n, ppt, pwidth); + } + DEALLOCATE_LOCAL(pptFree); + DEALLOCATE_LOCAL(pwidthFree); + } + MarkSyncS3 (pDrawable->pScreen); +} + +#include "mifillarc.h" + +#define FILLSPAN(s3,y,__x1,__x2) {\ + DRAW_DEBUG ((DEBUG_ARCS, "FILLSPAN %d: %d->%d", y, __x1, __x2)); \ + if ((__x2) >= (__x1)) {\ + _s3SolidRect(s3,(__x1),(y),(__x2)-(__x1)+1,1); \ + } \ +} + +#define FILLSLICESPANS(flip,__y) \ + if (!flip) \ + { \ + FILLSPAN(s3,__y,xl,xr) \ + } \ + else \ + { \ + xc = xorg - x; \ + FILLSPAN(s3, __y, xc, xr) \ + xc += slw - 1; \ + FILLSPAN(s3, __y, xl, xc) \ + } + +static void +_s3FillEllipse (DrawablePtr pDraw, S3Ptr s3, xArc *arc) +{ + KdScreenPriv(pDraw->pScreen); + int x, y, e; + int yk, xk, ym, xm, dx, dy, xorg, yorg; + int y_top, y_bot; + miFillArcRec info; + register int xpos; + int slw; + + s3SetGlobalBitmap (pDraw->pScreen, s3DrawMap (pDraw)); + miFillArcSetup(arc, &info); + MIFILLARCSETUP(); + y_top = pDraw->y + yorg - y; + y_bot = pDraw->y + yorg + y + dy; + xorg += pDraw->x; + while (y) + { + y_top++; + y_bot--; + MIFILLARCSTEP(slw); + if (!slw) + continue; + xpos = xorg - x; + _s3SolidRect (s3,xpos,y_top,slw,1); + if (miFillArcLower(slw)) + _s3SolidRect (s3,xpos,y_bot,slw,1); + } +} + + +static void +_s3FillArcSlice (DrawablePtr pDraw, GCPtr pGC, S3Ptr s3, xArc *arc) +{ + KdScreenPriv(pDraw->pScreen); + int yk, xk, ym, xm, dx, dy, xorg, yorg, slw; + register int x, y, e; + miFillArcRec info; + miArcSliceRec slice; + int xl, xr, xc; + int y_top, y_bot; + + s3SetGlobalBitmap (pDraw->pScreen, s3DrawMap (pDraw)); + DRAW_DEBUG ((DEBUG_ARCS, "slice %dx%d+%d+%d %d->%d", + arc->width, arc->height, arc->x, arc->y, + arc->angle1, arc->angle2)); + miFillArcSetup(arc, &info); + miFillArcSliceSetup(arc, &slice, pGC); + DRAW_DEBUG ((DEBUG_ARCS, "edge1.x %d edge2.x %d", + slice.edge1.x, slice.edge2.x)); + MIFILLARCSETUP(); + DRAW_DEBUG ((DEBUG_ARCS, "xorg %d yorg %d", + xorg, yorg)); + xorg += pDraw->x; + yorg += pDraw->y; + y_top = yorg - y; + y_bot = yorg + y + dy; + slice.edge1.x += pDraw->x; + slice.edge2.x += pDraw->x; + DRAW_DEBUG ((DEBUG_ARCS, "xorg %d y_top %d y_bot %d", + xorg, y_top, y_bot)); + while (y > 0) + { + y_top++; + y_bot--; + MIFILLARCSTEP(slw); + MIARCSLICESTEP(slice.edge1); + MIARCSLICESTEP(slice.edge2); + if (miFillSliceUpper(slice)) + { + MIARCSLICEUPPER(xl, xr, slice, slw); + FILLSLICESPANS(slice.flip_top, y_top); + } + if (miFillSliceLower(slice)) + { + MIARCSLICELOWER(xl, xr, slice, slw); + FILLSLICESPANS(slice.flip_bot, y_bot); + } + } +} + +void +s3PolyFillArcSolid (DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs) +{ + SetupS3(pDraw->pScreen); + xArc *arc; + int i; + int x, y; + BoxRec box; + RegionPtr pClip = fbGetCompositeClip(pGC); + BOOL set; + + set = FALSE; + for (; --narcs >= 0; parcs++) + { + if (miFillArcEmpty(parcs)) + continue; + if (miCanFillArc(parcs)) + { + box.x1 = parcs->x + pDraw->x; + box.y1 = parcs->y + pDraw->y; + box.x2 = box.x1 + (int)parcs->width + 1; + box.y2 = box.y1 + (int)parcs->height + 1; + switch (RECT_IN_REGION(pDraw->pScreen, pClip, &box)) + { + case rgnIN: + if (!set) + { + _s3SetSolidFill (s3, pGC->fgPixel, pGC->alu, pGC->planemask); + set = TRUE; + } + if ((parcs->angle2 >= FULLCIRCLE) || + (parcs->angle2 <= -FULLCIRCLE)) + { + DRAW_DEBUG ((DEBUG_ARCS, "Full circle ellipse %dx%d", + parcs->width, parcs->height)); + _s3FillEllipse (pDraw, s3, parcs); + } + else + { + DRAW_DEBUG ((DEBUG_ARCS, "Partial ellipse %dx%d", + parcs->width, parcs->height)); + _s3FillArcSlice (pDraw, pGC, s3, parcs); + } + /* fall through ... */ + case rgnOUT: + continue; + case rgnPART: + break; + } + } + if (set) + { + MarkSyncS3 (pDraw->pScreen); + set = FALSE; + } + KdCheckPolyFillArc(pDraw, pGC, 1, parcs); + } + if (set) + { + MarkSyncS3 (pDraw->pScreen); + set = FALSE; + } +} + +void +s3FillPoly (DrawablePtr pDrawable, GCPtr pGC, int shape, + int mode, int countInit, DDXPointPtr ptsIn) +{ + SetupS3(pDrawable->pScreen); + int nwidth; + int maxy; + int origin; + int count; + register int vertex1, vertex2; + int c; + RegionPtr pClip = fbGetCompositeClip(pGC); + BoxPtr extents; + int clip; + int y, sy; + int *vertex1p, *vertex2p; + int *endp; + int x1, x2, sx; + int dx1, dx2; + int dy1, dy2; + int e1, e2; + int step1, step2; + int sign1, sign2; + int h; + int l, r; + int nmiddle; + + if (mode == CoordModePrevious || REGION_NUM_RECTS(pClip) != 1) + { + KdCheckFillPolygon (pDrawable, pGC, shape, mode, countInit, ptsIn); + return; + } + + s3SetGlobalBitmap (pDrawable->pScreen, s3GCMap (pGC)); + sy = pDrawable->y; + sx = pDrawable->x; + origin = *((int *) &pDrawable->x); + origin -= (origin & 0x8000) << 1; + extents = &pClip->extents; + vertex1 = *((int *) &extents->x1) - origin; + vertex2 = *((int *) &extents->x2) - origin - 0x00010001; + clip = 0; + + y = 32767; + maxy = 0; + vertex2p = (int *) ptsIn; + endp = vertex2p + countInit; + if (shape == Convex) + { + count = countInit; + while (count--) + { + c = *vertex2p; + clip |= (c - vertex1) | (vertex2 - c); + c = intToY(c); + DRAW_DEBUG ((DEBUG_POLYGON, "Y coordinate %d", c)); + if (c < y) + { + y = c; + vertex1p = vertex2p; + } + vertex2p++; + if (c > maxy) + maxy = c; + } + } + else + { + int yFlip = 0; + dx1 = 1; + x2 = -1; + x1 = -1; + count = countInit; + while (count--) + { + c = *vertex2p; + clip |= (c - vertex1) | (vertex2 - c); + c = intToY(c); + DRAW_DEBUG ((DEBUG_POLYGON, "Y coordinate %d", c)); + if (c < y) + { + y = c; + vertex1p = vertex2p; + } + vertex2p++; + if (c > maxy) + maxy = c; + if (c == x1) + continue; + if (dx1 > 0) + { + if (x2 < 0) + x2 = c; + else + dx2 = dx1 = (c - x1) >> 31; + } + else + if ((c - x1) >> 31 != dx1) + { + dx1 = ~dx1; + yFlip++; + } + x1 = c; + } + x1 = (x2 - c) >> 31; + if (x1 != dx1) + yFlip++; + if (x1 != dx2) + yFlip++; + if (yFlip != 2) + clip = 0x8000; + } + if (y == maxy) + return; + + if (clip & 0x80008000) + { + KdCheckFillPolygon (pDrawable, pGC, shape, mode, countInit, ptsIn); + return; + } + _s3SetSolidFill(s3,pGC->fgPixel,pGC->alu,pGC->planemask); + + vertex2p = vertex1p; + vertex2 = vertex1 = *vertex2p++; + if (vertex2p == endp) + vertex2p = (int *) ptsIn; +#define Setup(c,x,vertex,dx,dy,e,sign,step) {\ + x = intToX(vertex); \ + if (dy = intToY(c) - y) { \ + dx = intToX(c) - x; \ + step = 0; \ + if (dx >= 0) \ + { \ + e = 0; \ + sign = 1; \ + if (dx >= dy) {\ + step = dx / dy; \ + dx = dx % dy; \ + } \ + } \ + else \ + { \ + e = 1 - dy; \ + sign = -1; \ + dx = -dx; \ + if (dx >= dy) { \ + step = - (dx / dy); \ + dx = dx % dy; \ + } \ + } \ + } \ + x += sx; \ + vertex = c; \ +} + +#define Step(x,dx,dy,e,sign,step) {\ + x += step; \ + if ((e += dx) > 0) \ + { \ + x += sign; \ + e -= dy; \ + } \ +} + sy += y; + DRAW_DEBUG ((DEBUG_POLYGON, "Starting polygon at %d", sy)); + for (;;) + { + DRAW_DEBUG ((DEBUG_POLYGON, "vertex1 0x%x vertex2 0x%x y %d vy1 %d vy2 %d", + vertex1, vertex2, + y, intToY(vertex1), intToY (vertex2))); + if (y == intToY(vertex1)) + { + DRAW_DEBUG ((DEBUG_POLYGON, "Find next -- vertext")); + do + { + if (vertex1p == (int *) ptsIn) + vertex1p = endp; + c = *--vertex1p; + Setup (c,x1,vertex1,dx1,dy1,e1,sign1,step1); + DRAW_DEBUG ((DEBUG_POLYGON, "-- vertex 0x%x y %d", + vertex1, intToY(vertex1))); + } while (y >= intToY(vertex1)); + h = dy1; + } + else + { + Step(x1,dx1,dy1,e1,sign1,step1) + h = intToY(vertex1) - y; + } + if (y == intToY(vertex2)) + { + DRAW_DEBUG ((DEBUG_POLYGON, "Find next ++ vertext")); + do + { + c = *vertex2p++; + if (vertex2p == endp) + vertex2p = (int *) ptsIn; + Setup (c,x2,vertex2,dx2,dy2,e2,sign2,step2) + DRAW_DEBUG ((DEBUG_POLYGON, "++ vertex 0x%x y %d", + vertex1, intToY(vertex1))); + } while (y >= intToY(vertex2)); + if (dy2 < h) + h = dy2; + } + else + { + Step(x2,dx2,dy2,e2,sign2,step2) + if ((c = (intToY(vertex2) - y)) < h) + h = c; + } + DRAW_DEBUG ((DEBUG_POLYGON, "This band %d", h)); + /* fill spans for this segment */ + for (;;) + { + nmiddle = x2 - x1; + DRAW_DEBUG ((DEBUG_POLYGON, "This span %d->%d", x1, x2)); + if (nmiddle) + { + l = x1; + if (nmiddle < 0) + { + nmiddle = -nmiddle; + l = x2; + } + _s3SolidRect(s3,l,sy,nmiddle,1); + } + y++; + sy++; + if (!--h) + break; + Step(x1,dx1,dy1,e1,sign1,step1) + Step(x2,dx2,dy2,e2,sign2,step2) + } + if (y == maxy) + break; + } + MarkSyncS3 (pDrawable->pScreen); +} + +void +s3PolyGlyphBltClipped (DrawablePtr pDrawable, + GCPtr pGC, + int x, int y, + unsigned int nglyph, + CharInfoPtr *ppciInit, + pointer pglyphBase) +{ + SetupS3(pDrawable->pScreen); + int h; + int w; + int xBack, yBack; + int hBack, wBack; + int lw; + FontPtr pfont = pGC->font; + CharInfoPtr pci; + unsigned long *bits; + BoxPtr extents; + BoxRec bbox; + CARD32 b; + CharInfoPtr *ppci; + FbGCPrivPtr fbPriv = fbGetGCPrivate(pGC); + RegionPtr pClip = fbGetCompositeClip(pGC); + BoxPtr pBox; + int nbox; + int x1, y1, x2, y2; + unsigned char alu; + Bool set; + PixTransDeclare; + + s3SetGlobalBitmap (pDrawable->pScreen, s3GCMap (pGC)); + x += pDrawable->x; + y += pDrawable->y; + + if (pglyphBase == (pointer) 1) + { + xBack = x; + yBack = y - FONTASCENT(pGC->font); + wBack = 0; + hBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font); + if (hBack) + { + h = nglyph; + ppci = ppciInit; + while (h--) + wBack += (*ppci++)->metrics.characterWidth; + } + if (wBack < 0) + { + xBack = xBack + wBack; + wBack = -wBack; + } + if (hBack < 0) + { + yBack = yBack + hBack; + hBack = -hBack; + } + alu = GXcopy; + } + else + { + wBack = 0; + alu = pGC->alu; + } + + if (wBack) + { + _s3SetSolidFill (s3, pGC->bgPixel, GXcopy, pGC->planemask); + for (nbox = REGION_NUM_RECTS (pClip), + pBox = REGION_RECTS (pClip); + nbox--; + pBox++) + { + x1 = xBack; + x2 = xBack + wBack; + y1 = yBack; + y2 = yBack + hBack; + if (x1 < pBox->x1) x1 = pBox->x1; + if (x2 > pBox->x2) x2 = pBox->x2; + if (y1 < pBox->y1) y1 = pBox->y1; + if (y2 > pBox->y2) y2 = pBox->y2; + if (x1 < x2 && y1 < y2) + { + _s3SolidRect (s3, x1, y1, x2 - x1, y2 - y1); + } + } + MarkSyncS3 (pDrawable->pScreen); + } + ppci = ppciInit; + set = FALSE; + while (nglyph--) + { + pci = *ppci++; + h = pci->metrics.ascent + pci->metrics.descent; + w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing; + x1 = x + pci->metrics.leftSideBearing; + y1 = y - pci->metrics.ascent; + bbox.x1 = x1; + bbox.y1 = y1; + bbox.x2 = x1 + w; + bbox.y2 = y1 + h; + switch (RECT_IN_REGION(pGC->pScreen, pClip, &bbox)) + { + case rgnIN: +#if 1 + lw = h * ((w + 31) >> 5); + if (lw) + { + if (!set) + { + _s3SetTransparentPlaneBlt (s3, alu, pGC->planemask, pGC->fgPixel); + set = TRUE; + } + _s3PlaneBlt(s3, + x + pci->metrics.leftSideBearing, + y - pci->metrics.ascent, + w, h); + bits = (unsigned long *) pci->bits; + PixTransStart (lw); + while (lw--) + { + b = *bits++; + S3AdjustBits32 (b); + PixTransStore(b); + } + MarkSyncS3 (pDrawable->pScreen); + } + break; +#endif + case rgnPART: + set = FALSE; + CheckSyncS3 (pDrawable->pScreen); + fbPutXYImage (pDrawable, + pClip, + fbPriv->fg, + fbPriv->bg, + fbPriv->pm, + alu, + FALSE, + x1, y1, + w, h, + (FbStip *) pci->bits, + (w + 31) >> 5, + 0); + break; + case rgnOUT: + break; + } + x += pci->metrics.characterWidth; + } +} + +/* + * Blt glyphs using S3 image transfer register, this does both + * poly glyph blt and image glyph blt (when pglyphBase == 1) + */ + +void +s3PolyGlyphBlt (DrawablePtr pDrawable, + GCPtr pGC, + int x, int y, + unsigned int nglyph, + CharInfoPtr *ppciInit, + pointer pglyphBase) +{ + SetupS3(pDrawable->pScreen); + int h; + int w; + int xBack, yBack; + int hBack, wBack; + int lw; + FontPtr pfont = pGC->font; + CharInfoPtr pci; + unsigned long *bits; + BoxPtr extents; + BoxRec bbox; + CARD32 b; + CharInfoPtr *ppci; + unsigned char alu; + PixTransDeclare; + + s3SetGlobalBitmap (pDrawable->pScreen, s3GCMap (pGC)); + x += pDrawable->x; + y += pDrawable->y; + + /* compute an approximate (but covering) bounding box */ + ppci = ppciInit; + w = 0; + h = nglyph; + while (h--) + w += (*ppci++)->metrics.characterWidth; + if (w < 0) + { + bbox.x1 = x + w; + bbox.x2 = x; + } + else + { + bbox.x1 = x; + bbox.x2 = x + w; + } + w = FONTMINBOUNDS(pfont,leftSideBearing); + if (w < 0) + bbox.x1 += w; + w = FONTMAXBOUNDS(pfont, rightSideBearing) - FONTMINBOUNDS(pfont, characterWidth); + if (w > 0) + bbox.x2 += w; + bbox.y1 = y - FONTMAXBOUNDS(pfont,ascent); + bbox.y2 = y + FONTMAXBOUNDS(pfont,descent); + + DRAW_DEBUG ((DEBUG_TEXT, "PolyGlyphBlt %d box is %d %d", nglyph, + bbox.x1, bbox.x2)); + switch (RECT_IN_REGION(pGC->pScreen, fbGetCompositeClip(pGC), &bbox)) + { + case rgnIN: + break; + case rgnPART: + s3PolyGlyphBltClipped(pDrawable, pGC, x - pDrawable->x, + y - pDrawable->y, + nglyph, ppciInit, pglyphBase); + case rgnOUT: + return; + } + + if (pglyphBase == (pointer) 1) + { + xBack = x; + yBack = y - FONTASCENT(pGC->font); + wBack = 0; + hBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font); + if (hBack) + { + h = nglyph; + ppci = ppciInit; + while (h--) + wBack += (*ppci++)->metrics.characterWidth; + } + if (wBack < 0) + { + xBack = xBack + wBack; + wBack = -wBack; + } + if (hBack < 0) + { + yBack = yBack + hBack; + hBack = -hBack; + } + alu = GXcopy; + } + else + { + wBack = 0; + alu = pGC->alu; + } + + if (wBack) + { + _s3SetSolidFill (s3, pGC->bgPixel, GXcopy, pGC->planemask); + _s3SolidRect (s3, xBack, yBack, wBack, hBack); + } + _s3SetTransparentPlaneBlt (s3, alu, pGC->planemask, pGC->fgPixel); + ppci = ppciInit; + while (nglyph--) + { + pci = *ppci++; + h = pci->metrics.ascent + pci->metrics.descent; + w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing; + lw = h * ((w + 31) >> 5); + if (lw) + { + _s3PlaneBlt(s3, + x + pci->metrics.leftSideBearing, + y - pci->metrics.ascent, + w, h); + bits = (unsigned long *) pci->bits; + PixTransStart(lw); + while (lw--) + { + b = *bits++; + S3AdjustBits32 (b); + PixTransStore(b); + } + } + x += pci->metrics.characterWidth; + } + MarkSyncS3 (pDrawable->pScreen); +} + +void +s3ImageGlyphBlt (DrawablePtr pDrawable, + GCPtr pGC, + int x, int y, + unsigned int nglyph, + CharInfoPtr *ppci, + pointer pglyphBase) +{ + s3PolyGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, (pointer) 1); +} + +/* + * Blt TE fonts using S3 image transfer. Differs from + * above in that it doesn't need to fill a solid rect for + * the background and it can draw multiple characters at a time + */ + +void +s3ImageTEGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, + int xInit, int yInit, + unsigned int nglyph, + CharInfoPtr *ppci, + pointer pglyphBase) +{ + SetupS3(pDrawable->pScreen); + int x, y; + int h, lw, lwTmp; + int w; + FontPtr pfont = pGC->font; + unsigned long *char1, *char2, *char3, *char4; + int widthGlyphs, widthGlyph; + BoxRec bbox; + CARD32 tmp; + PixTransDeclare; + + s3SetGlobalBitmap (pDrawable->pScreen, s3GCMap (pGC)); + widthGlyph = FONTMAXBOUNDS(pfont,characterWidth); + if (!widthGlyph) + return; + + h = FONTASCENT(pfont) + FONTDESCENT(pfont); + if (!h) + return; + + DRAW_DEBUG ((DEBUG_TEXT, "ImageTEGlyphBlt chars are %d %d", + widthGlyph, h)); + + x = xInit + FONTMAXBOUNDS(pfont,leftSideBearing) + pDrawable->x; + y = yInit - FONTASCENT(pfont) + pDrawable->y; + + bbox.x1 = x; + bbox.x2 = x + (widthGlyph * nglyph); + bbox.y1 = y; + bbox.y2 = y + h; + + switch (RECT_IN_REGION(pGC->pScreen, fbGetCompositeClip(pGC), &bbox)) + { + case rgnIN: + break; + case rgnPART: + if (pglyphBase == (pointer) 1) + pglyphBase = 0; + else + pglyphBase = (pointer) 1; + s3PolyGlyphBltClipped(pDrawable, pGC, + xInit, + yInit, + nglyph, ppci, + pglyphBase); + case rgnOUT: + return; + } + + if (pglyphBase == (pointer) 1) + { + _s3SetTransparentPlaneBlt (s3, pGC->alu, pGC->planemask, pGC->fgPixel); + } + else + { + _s3SetOpaquePlaneBlt (s3, GXcopy, pGC->planemask, pGC->fgPixel, pGC->bgPixel); + } + +#if BITMAP_BIT_ORDER == LSBFirst +#define SHIFT << +#else +#define SHIFT >> +#endif + +#define LoopIt(count, w, loadup, fetch) \ + while (nglyph >= count) \ + { \ + nglyph -= count; \ + _s3PlaneBlt (s3, x, y, w, h); \ + x += w; \ + loadup \ + lwTmp = h; \ + PixTransStart(h); \ + while (lwTmp--) { \ + tmp = fetch; \ + S3AdjustBits32(tmp); \ + PixTransStore(tmp); \ + } \ + } + + if (widthGlyph <= 8) + { + widthGlyphs = widthGlyph << 2; + LoopIt(4, widthGlyphs, + char1 = (unsigned long *) (*ppci++)->bits; + char2 = (unsigned long *) (*ppci++)->bits; + char3 = (unsigned long *) (*ppci++)->bits; + char4 = (unsigned long *) (*ppci++)->bits;, + (*char1++ | ((*char2++ | ((*char3++ | (*char4++ + SHIFT widthGlyph)) + SHIFT widthGlyph)) + SHIFT widthGlyph))) + } + else if (widthGlyph <= 10) + { + widthGlyphs = (widthGlyph << 1) + widthGlyph; + LoopIt(3, widthGlyphs, + char1 = (unsigned long *) (*ppci++)->bits; + char2 = (unsigned long *) (*ppci++)->bits; + char3 = (unsigned long *) (*ppci++)->bits;, + (*char1++ | ((*char2++ | (*char3++ SHIFT widthGlyph)) SHIFT widthGlyph))) + } + else if (widthGlyph <= 16) + { + widthGlyphs = widthGlyph << 1; + LoopIt(2, widthGlyphs, + char1 = (unsigned long *) (*ppci++)->bits; + char2 = (unsigned long *) (*ppci++)->bits;, + (*char1++ | (*char2++ SHIFT widthGlyph))) + } + lw = h * ((widthGlyph + 31) >> 5); + while (nglyph--) + { + _s3PlaneBlt (s3, x, y, widthGlyph, h); + x += widthGlyph; + char1 = (unsigned long *) (*ppci++)->bits; + lwTmp = lw; + PixTransStart(lw); + while (lwTmp--) + { + tmp = *char1++; + S3AdjustBits32(tmp); + PixTransStore(tmp); + } + } + MarkSyncS3 (pDrawable->pScreen); +} + +void +s3PolyTEGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, + int x, int y, + unsigned int nglyph, CharInfoPtr *ppci, + pointer pglyphBase) +{ + s3ImageTEGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, (pointer) 1); +} + +Bool +_s3Segment (DrawablePtr pDrawable, + GCPtr pGC, + int x1, + int y1, + int x2, + int y2, + Bool drawLast, + Bool s3Set) +{ + SetupS3(pDrawable->pScreen); + FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); + 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; /* bresenham error and increments */ + int len; /* length of segment */ + int axis; /* major axis */ + int octant; + int cmd; + unsigned int bias = miGetZeroLineBias(pDrawable->pScreen); + unsigned int oc1; /* outcode of point 1 */ + unsigned int oc2; /* outcode of point 2 */ + + CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy, + 1, 1, octant); + + cmd = LASTPIX; + + if (adx > ady) + { + axis = X_AXIS; + e1 = ady << 1; + e2 = e1 - (adx << 1); + e = e1 - adx; + len = adx; + } + else + { + cmd |= YMAJAXIS; + axis = Y_AXIS; + e1 = adx << 1; + e2 = e1 - (ady << 1); + e = e1 - ady; + SetYMajorOctant(octant); + len = ady; + } + + /* S3 line drawing hardware has limited resolution for error terms */ + if (len >= 4096) + { + int dashOff = 0; + + KdCheckSync (pDrawable->pScreen); + fbSegment (pDrawable, pGC, x1, y1, x2, y2, drawLast, &dashOff); + return FALSE; + } + + FIXUP_ERROR (e, octant, bias); + + nBox = REGION_NUM_RECTS (pClip); + pBox = REGION_RECTS (pClip); + + if (signdx > 0) + cmd |= INC_X; + if (signdy > 0) + cmd |= INC_Y; + + /* we have bresenham parameters and two points. + all we have to do now is clip and draw. + */ + + if (drawLast) + len++; + while(nBox--) + { + oc1 = 0; + oc2 = 0; + OUTCODES(oc1, x1, y1, pBox); + OUTCODES(oc2, x2, y2, pBox); + if ((oc1 | oc2) == 0) + { + if (!s3Set) + { + s3SetGlobalBitmap (pDrawable->pScreen, s3GCMap (pGC)); + _s3SetSolidFill (s3, pGC->fgPixel, pGC->alu, pGC->planemask); + s3Set = TRUE; + } + _s3SetCur (s3, x1, y1); + _s3ClipLine (s3, cmd, e1, e2, e, 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 */ + err = e; + if (clip1) + { + clipdx = abs(new_x1 - x1); + clipdy = abs(new_y1 - y1); + if (axis == X_AXIS) + err += (e2 - e1) * clipdy + e1 * clipdx; + else + err += (e2 - e1) * clipdx + e1 * clipdy; + } + if (!s3Set) + { + s3SetGlobalBitmap (pDrawable->pScreen, s3GCMap (pGC)); + _s3SetSolidFill (s3, pGC->fgPixel, pGC->alu, pGC->planemask); + s3Set = TRUE; + } + _s3SetCur (s3, new_x1, new_y1); + _s3ClipLine (s3, cmd, e1, e2, err, len); + } + pBox++; + } + } /* while (nBox--) */ + return s3Set; +} + +void +s3Polylines (DrawablePtr pDrawable, GCPtr pGC, + int mode, int npt, DDXPointPtr ppt) +{ + SetupS3(pDrawable->pScreen); + int x, y, nx, ny; + int ox = pDrawable->x, oy = pDrawable->y; + Bool s3Set = FALSE; + + if (!npt) + return; + + x = ppt->x + ox; + y = ppt->y + oy; + while (--npt) + { + ++ppt; + if (mode == CoordModePrevious) + { + nx = x + ppt->x; + ny = y + ppt->y; + } + else + { + nx = ppt->x + ox; + ny = ppt->y + oy; + } + s3Set = _s3Segment (pDrawable, pGC, x, y, nx, ny, + npt == 1 && pGC->capStyle != CapNotLast, + s3Set); + x = nx; + y = ny; + } + if (s3Set) + MarkSyncS3 (pDrawable->pScreen); +} + +void +s3PolySegment (DrawablePtr pDrawable, GCPtr pGC, + int nsegInit, xSegment *pSegInit) +{ + SetupS3(pDrawable->pScreen); + int x, y; + int ox = pDrawable->x, oy = pDrawable->y; + RegionPtr pClip = fbGetCompositeClip (pGC); + BoxPtr pBox; + int nbox; + int nseg; + xSegment *pSeg; + int dx, dy; + int maj, min, len, inc; + int t; + CARD32 cmd; + CARD32 init_cmd; + Bool drawLast; + Bool s3Set = FALSE; + + drawLast = pGC->capStyle != CapNotLast; + + for (nseg = nsegInit, pSeg = pSegInit; nseg--; pSeg++) + { + s3Set = _s3Segment (pDrawable, pGC, pSeg->x1 + ox, pSeg->y1 + oy, + pSeg->x2 + ox, pSeg->y2 + oy, drawLast, s3Set); + + } + if (s3Set) + MarkSyncS3 (pDrawable->pScreen); +} + +/* + * Check to see if a pattern can be painted with the S3 + */ + +#define _s3CheckPatternSize(s) ((s) <= S3_TILE_SIZE && ((s) & ((s) - 1)) == 0) +#define s3CheckPattern(w,h) (_s3CheckPatternSize(w) && _s3CheckPatternSize(h)) + +Bool +s3AllocPattern (ScreenPtr pScreen, + int ma, + PixmapPtr pPixmap, + int xorg, int yorg, + int fillStyle, Pixel fg, Pixel bg, + s3PatternPtr *ppPattern) +{ + KdScreenPriv(pScreen); + s3ScreenInfo(pScreenPriv); + s3PatternPtr pPattern; + + if (s3s->fb[ma].patterns.cache && fillStyle != FillSolid && + s3CheckPattern (pPixmap->drawable.width, pPixmap->drawable.height)) + { + if (!(pPattern = *ppPattern)) + { + pPattern = (s3PatternPtr) xalloc (sizeof (s3PatternRec)); + if (!pPattern) + return FALSE; + *ppPattern = pPattern; + } + + pPattern->cache = 0; + pPattern->id = 0; + pPattern->pPixmap = pPixmap; + pPattern->fillStyle = fillStyle; + pPattern->xrot = (-xorg) & (S3_TILE_SIZE-1); + pPattern->yrot = (-yorg) & (S3_TILE_SIZE-1); + pPattern->fore = fg; + pPattern->back = bg; + return TRUE; + } + else + { + if (*ppPattern) + { + xfree (*ppPattern); + *ppPattern = 0; + } + return FALSE; + } +} + +void +s3CheckGCFill (GCPtr pGC) +{ + s3PrivGCPtr s3Priv = s3GetGCPrivate (pGC); + PixmapPtr pPixmap; + + switch (pGC->fillStyle) { + case FillSolid: + pPixmap = 0; + break; + case FillOpaqueStippled: + case FillStippled: + pPixmap = pGC->stipple; + break; + case FillTiled: + pPixmap = pGC->tile.pixmap; + break; + } + s3AllocPattern (pGC->pScreen, + s3GCMap(pGC), + pPixmap, + pGC->patOrg.x + pGC->lastWinOrg.x, + pGC->patOrg.y + pGC->lastWinOrg.y, + pGC->fillStyle, pGC->fgPixel, pGC->bgPixel, + &s3Priv->pPattern); +} + +void +s3MoveGCFill (GCPtr pGC) +{ + s3PrivGCPtr s3Priv = s3GetGCPrivate (pGC); + int xorg, yorg; + s3PatternPtr pPattern; + + if (pPattern = s3Priv->pPattern) + { + /* + * Reset origin + */ + xorg = pGC->patOrg.x + pGC->lastWinOrg.x; + yorg = pGC->patOrg.y + pGC->lastWinOrg.y; + pPattern->xrot = (-xorg) & (S3_TILE_SIZE - 1); + pPattern->yrot = (-yorg) & (S3_TILE_SIZE - 1); + /* + * Invalidate cache entry + */ + pPattern->id = 0; + pPattern->cache = 0; + } +} + +/* + * S3 Patterns. These are always full-depth images, stored in off-screen + * memory. + */ + +Pixel +s3FetchPatternPixel (s3PatternPtr pPattern, int x, int y) +{ + CARD8 *src; + CARD16 *src16; + CARD32 *src32; + PixmapPtr pPixmap = pPattern->pPixmap; + + x = (x + pPattern->xrot) % pPixmap->drawable.width; + y = (y + pPattern->yrot) % pPixmap->drawable.height; + src = (CARD8 *) pPixmap->devPrivate.ptr + y * pPixmap->devKind; + switch (pPixmap->drawable.bitsPerPixel) { + case 1: + return (src[x>>3] >> (x & 7)) & 1 ? 0xffffffff : 0x00; + case 4: + if (x & 1) + return src[x>>1] >> 4; + else + return src[x>>1] & 0xf; + case 8: + return src[x]; + case 16: + src16 = (CARD16 *) src; + return src16[x]; + case 32: + src32 = (CARD32 *) src; + return src32[x]; + } +} + +/* + * Place pattern image on screen; done with S3 locked + */ +void +_s3PutPattern (ScreenPtr pScreen, int ma, s3PatternPtr pPattern) +{ + SetupS3(pScreen); + s3ScreenInfo(pScreenPriv); + int x, y; + CARD8 *dstLine, *dst8; + CARD16 *dst16; + CARD32 *dst32; + S3PatternCache *cache = pPattern->cache; +#ifdef S3_TRIO + int fb = 0; +#else + int fb = s3s->fbmap[ma]; +#endif + + DRAW_DEBUG ((DEBUG_PATTERN, "_s3PutPattern 0x%x id %d to %d %d", + pPattern, pPattern->id, cache->x, cache->y)); + + dstLine = (pScreenPriv->screen->fb[fb].frameBuffer + + cache->y * pScreenPriv->screen->fb[fb].byteStride + + cache->x * pScreenPriv->bytesPerPixel[fb]); + + CheckSyncS3 (pScreen); + + for (y = 0; y < S3_TILE_SIZE; y++) + { + switch (pScreenPriv->screen->fb[fb].bitsPerPixel) { + case 8: + dst8 = dstLine; + for (x = 0; x < S3_TILE_SIZE; x++) + *dst8++ = s3FetchPatternPixel (pPattern, x, y); + DRAW_DEBUG ((DEBUG_PATTERN, "%c%c%c%c%c%c%c%c", + dstLine[0] ? 'X' : ' ', + dstLine[1] ? 'X' : ' ', + dstLine[2] ? 'X' : ' ', + dstLine[3] ? 'X' : ' ', + dstLine[4] ? 'X' : ' ', + dstLine[5] ? 'X' : ' ', + dstLine[6] ? 'X' : ' ', + dstLine[7] ? 'X' : ' ')); + break; + case 16: + dst16 = (CARD16 *) dstLine; + for (x = 0; x < S3_TILE_SIZE; x++) + *dst16++ = s3FetchPatternPixel (pPattern, x, y); + break; + case 32: + dst32 = (CARD32 *) dstLine; + for (x = 0; x < S3_TILE_SIZE; x++) + *dst32++ = s3FetchPatternPixel (pPattern, x, y); + break; + } + dstLine += pScreenPriv->screen->fb[fb].byteStride; + } +} + +/* + * Load a stipple to off-screen memory; done with S3 locked + */ +void +_s3LoadPattern (ScreenPtr pScreen, int ma, s3PatternPtr pPattern) +{ + SetupS3(pScreen); + s3ScreenInfo(pScreenPriv); + S3PatternCache *cache; + + DRAW_DEBUG((DEBUG_PATTERN, + "s3LoadPattern 0x%x id %d cache 0x%x cacheid %d", + pPattern, pPattern->id, pPattern->cache, + pPattern->cache ? pPattern->cache->id : -1)); + /* + * Check to see if its still loaded + */ + cache = pPattern->cache; + if (cache && cache->id == pPattern->id) + return; + /* + * Lame replacement strategy; assume we'll have plenty of room. + */ + cache = &s3s->fb[ma].patterns.cache[s3s->fb[ma].patterns.last_used]; + if (++s3s->fb[ma].patterns.last_used == s3s->fb[ma].patterns.ncache) + s3s->fb[ma].patterns.last_used = 0; + cache->id = ++s3s->fb[ma].patterns.last_id; + pPattern->id = cache->id; + pPattern->cache = cache; + _s3PutPattern (pScreen, ma, pPattern); +} + +void +s3DestroyGC (GCPtr pGC) +{ + s3PrivGCPtr s3Priv = s3GetGCPrivate (pGC); + + if (s3Priv->pPattern) + xfree (s3Priv->pPattern); + miDestroyGC (pGC); +} + +GCFuncs s3GCFuncs = { + s3ValidateGC, + miChangeGC, + miCopyGC, + s3DestroyGC, + miChangeClip, + miDestroyClip, + miCopyClip +}; + +int +s3CreateGC (GCPtr pGC) +{ + KdScreenPriv(pGC->pScreen); + s3ScreenInfo(pScreenPriv); + s3PrivGCPtr s3Priv; + + if (!fbCreateGC (pGC)) + return FALSE; + + if (pGC->depth != 1) + pGC->funcs = &s3GCFuncs; + + s3Priv = s3GetGCPrivate(pGC); + s3Priv->type = DRAWABLE_PIXMAP; + s3Priv->pPattern = 0; +#ifndef S3_TRIO + if (pGC->depth == s3s->primary_depth) + s3Priv->ma = 0; + else + s3Priv->ma = 1; +#endif + return TRUE; +} + +Bool +s3CreateWindow (WindowPtr pWin) +{ + KdScreenPriv(pWin->drawable.pScreen); + s3ScreenInfo(pScreenPriv); + + pWin->devPrivates[s3WindowPrivateIndex].ptr = 0; + return KdCreateWindow (pWin); +} + +Bool +s3DestroyWindow (WindowPtr pWin) +{ + s3PatternPtr pPattern; + if (pPattern = s3GetWindowPrivate(pWin)) + xfree (pPattern); + return fbDestroyWindow (pWin); +} + +Bool +s3ChangeWindowAttributes (WindowPtr pWin, Mask mask) +{ + KdScreenPriv(pWin->drawable.pScreen); + Bool ret; + s3PatternPtr pPattern; + PixmapPtr pPixmap; + int fillStyle; + + ret = fbChangeWindowAttributes (pWin, mask); + if (mask & CWBackPixmap) + { + if (pWin->backgroundState == BackgroundPixmap) + { + pPixmap = pWin->background.pixmap; + fillStyle = FillTiled; + } + else + { + pPixmap = 0; + fillStyle = FillSolid; + } + pPattern = s3GetWindowPrivate(pWin); + s3AllocPattern (pWin->drawable.pScreen, + s3DrawMap (&pWin->drawable), + pPixmap, + pWin->drawable.x, pWin->drawable.y, + fillStyle, 0, 0, &pPattern); + DRAW_DEBUG ((DEBUG_PAINT_WINDOW, "Background pattern 0x%x pixmap 0x%x style %d", + pPattern, pPixmap, fillStyle)); + s3SetWindowPrivate (pWin, pPattern); + } + return ret; +} + + +#ifndef S3_TRIO +void +s3PaintKey (DrawablePtr pDrawable, + RegionPtr pRegion, + CARD32 pixel, + int fb) +{ + SetupS3 (pDrawable->pScreen); + s3ScreenInfo (pScreenPriv); + int nBox = REGION_NUM_RECTS(pRegion); + BoxPtr pBox = REGION_RECTS(pRegion); + int ma; + + if (!nBox) + return; + + for (ma = 0; s3s->fbmap[ma] >= 0; ma++) + if (s3s->fbmap[ma] == fb) + break; + s3SetGlobalBitmap (pDrawable->pScreen, ma); + _s3SetSolidFill (s3, pixel, GXcopy, 0xffffffff); + while (nBox--) + { + _s3SolidRect(s3,pBox->x1,pBox->y1,pBox->x2-pBox->x1,pBox->y2-pBox->y1); + pBox++; + } + MarkSyncS3 (pDrawable->pScreen); +} +#endif + +void +s3PaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) +{ + SetupS3(pWin->drawable.pScreen); + s3ScreenInfo(pScreenPriv); + s3PatternPtr pPattern; + + DRAW_DEBUG ((DEBUG_PAINT_WINDOW, "s3PaintWindow 0x%x extents %d %d %d %d n %d", + pWin->drawable.id, + pRegion->extents.x1, pRegion->extents.y1, + pRegion->extents.x2, pRegion->extents.y2, + REGION_NUM_RECTS(pRegion))); + if (!REGION_NUM_RECTS(pRegion)) + return; + switch (what) { + case PW_BACKGROUND: + switch (pWin->backgroundState) { + case None: + return; + case ParentRelative: + do { + pWin = pWin->parent; + } while (pWin->backgroundState == ParentRelative); + (*pWin->drawable.pScreen->PaintWindowBackground)(pWin, pRegion, + what); + return; + case BackgroundPixmap: + pPattern = s3GetWindowPrivate(pWin); + if (pPattern) + { + s3FillBoxPattern ((DrawablePtr)pWin, + (int)REGION_NUM_RECTS(pRegion), + REGION_RECTS(pRegion), + GXcopy, ~0, pPattern); + return; + } + break; + case BackgroundPixel: + s3FillBoxSolid((DrawablePtr)pWin, + (int)REGION_NUM_RECTS(pRegion), + REGION_RECTS(pRegion), + pWin->background.pixel, GXcopy, ~0); + return; + } + break; + case PW_BORDER: +#ifndef S3_TRIO + if (s3s->fbmap[1] >= 0) + fbOverlayUpdateLayerRegion (pWin->drawable.pScreen, + fbOverlayWindowLayer (pWin), + pRegion); +#endif + if (pWin->borderIsPixel) + { + s3FillBoxSolid((DrawablePtr)pWin, + (int)REGION_NUM_RECTS(pRegion), + REGION_RECTS(pRegion), + pWin->border.pixel, GXcopy, ~0); + return; + } + break; + } + KdCheckPaintWindow (pWin, pRegion, what); +} + +void +s3CopyWindowProc (DrawablePtr pSrcDrawable, + DrawablePtr pDstDrawable, + GCPtr pGC, + BoxPtr pboxOrig, + int nboxOrig, + int dx, + int dy, + Bool reverse, + Bool upsidedown, + Pixel bitplane, + void *closure) +{ + SetupS3(pDstDrawable->pScreen); + s3ScreenInfo(pScreenPriv); + KdScreenInfo *screen = pScreenPriv->screen; + int srcX, srcY, dstX, dstY; + int x1, x2; + int w, h; + int flags; + int fb = (int) closure; + int ma; + BoxPtr pbox; + int nbox; + int bitsPerPixel; + +#ifdef S3_TRIO + ma = 0; +#else + for (ma = 0; s3s->fbmap[ma] >= 0; ma++) + if (s3s->fbmap[ma] == fb) + break; +#endif + bitsPerPixel = screen->fb[fb].bitsPerPixel; + if (bitsPerPixel == 24) + dx *= 3; + nbox = nboxOrig; + pbox = pboxOrig; + s3SetGlobalBitmap (pDstDrawable->pScreen, ma); + _s3SetBlt(s3,GXcopy,~0); + while (nbox--) + { + x1 = pbox->x1; + x2 = pbox->x2; + if (bitsPerPixel == 24) + { + x1 *= 3; + x2 *= 3; + } + + w = x2 - x1; + h = pbox->y2 - pbox->y1; + flags = 0; + if (reverse) + { + dstX = x2 - 1; + } + else + { + dstX = x1; + flags |= INC_X; + } + srcX = dstX + dx; + + if (upsidedown) + { + dstY = pbox->y2 - 1; + } + else + { + dstY = pbox->y1; + flags |= INC_Y; + } + srcY = dstY + dy; + + _s3Blt (s3, srcX, srcY, dstX, dstY, w, h, flags); + pbox++; + } + MarkSyncS3 (pDstDrawable->pScreen); +} + +void +s3CopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + KdScreenPriv (pScreen); + s3ScreenInfo (pScreenPriv); + KdScreenInfo *screen = pScreenPriv->screen; + RegionRec rgnDst; + int dx, dy; + WindowPtr pwinRoot; + + pwinRoot = WindowTable[pWin->drawable.pScreen->myNum]; + + dx = ptOldOrg.x - pWin->drawable.x; + dy = ptOldOrg.y - pWin->drawable.y; + + REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy); + + REGION_INIT (pWin->drawable.pScreen, &rgnDst, NullBox, 0); + + REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst, + &pWin->borderClip, prgnSrc); + + fbCopyRegion ((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot, + 0, + &rgnDst, dx, dy, s3CopyWindowProc, 0, 0); + + REGION_UNINIT(pWin->drawable.pScreen, &rgnDst); +} + +void +s3_24FillBoxSolid (DrawablePtr pDrawable, int nBox, BoxPtr pBox, + unsigned long pixel, int alu, unsigned long planemask) +{ + SetupS3(pDrawable->pScreen); + register int r; + int x1, x2; + + s3SetGlobalBitmap (pDrawable->pScreen, s3DrawMap (pDrawable)); + _s3SetSolidFill(s3,pixel,alu,planemask); + + while (nBox--) { + x1 = pBox->x1 * 3; + x2 = pBox->x2 * 3; + _s3SolidRect(s3,x1,pBox->y1,x2-x1,pBox->y2-pBox->y1); + pBox++; + } + MarkSyncS3 (pDrawable->pScreen); +} + +#define ok24(p) (((p) & 0xffffff) == ((((p) & 0xff) << 16) | (((p) >> 8) & 0xffff))) + +void +s3_24FillSpans (DrawablePtr pDrawable, GCPtr pGC, int n, + DDXPointPtr ppt, int *pwidth, int fSorted) +{ + SetupS3(pDrawable->pScreen); + int x, y, x1, y1, x2, y2; + int width; + /* next three parameters are post-clip */ + int nTmp; + int *pwidthFree;/* copies of the pointers to free */ + DDXPointPtr pptFree; + BoxPtr extents; + RegionPtr pClip = fbGetCompositeClip (pGC); + + if (pGC->fillStyle != FillSolid || !ok24 (pGC->fgPixel) || !ok24(pGC->planemask)) + { + KdCheckFillSpans (pDrawable, pGC, n, ppt, pwidth, fSorted); + return; + } + + s3SetGlobalBitmap (pDrawable->pScreen, s3GCMap (pGC)); + if (REGION_NUM_RECTS(pClip) == 1) + { + extents = REGION_RECTS(pClip); + x1 = extents->x1; + x2 = extents->x2; + y1 = extents->y1; + y2 = extents->y2; + _s3SetSolidFill(s3,pGC->fgPixel,pGC->alu,pGC->planemask); + while (n--) + { + y = ppt->y; + if (y1 <= y && y < y2) + { + x = ppt->x; + width = *pwidth; + if (x < x1) + { + width -= (x1 - x); + x = x1; + } + if (x2 < x + width) + width = x2 - x; + if (width > 0) + { + _s3SolidRect(s3,x*3,y,width*3,1); + } + } + ppt++; + pwidth++; + } + } + else + { + nTmp = n * miFindMaxBand(pClip); + pwidthFree = (int *)ALLOCATE_LOCAL(nTmp * sizeof(int)); + pptFree = (DDXPointRec *)ALLOCATE_LOCAL(nTmp * sizeof(DDXPointRec)); + if(!pptFree || !pwidthFree) + { + if (pptFree) DEALLOCATE_LOCAL(pptFree); + if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); + return; + } + n = miClipSpans(fbGetCompositeClip(pGC), + ppt, pwidth, n, + pptFree, pwidthFree, fSorted); + pwidth = pwidthFree; + ppt = pptFree; + _s3SetSolidFill(s3,pGC->fgPixel,pGC->alu,pGC->planemask); + while (n--) + { + x = ppt->x; + y = ppt->y; + ppt++; + width = *pwidth++; + if (width) + { + _s3SolidRect(s3,x*3,y,width*3,1); + } + } + DEALLOCATE_LOCAL(pptFree); + DEALLOCATE_LOCAL(pwidthFree); + } + MarkSyncS3 (pDrawable->pScreen); +} + +void +s3_24CopyNtoN (DrawablePtr pSrcDrawable, + DrawablePtr pDstDrawable, + GCPtr pGC, + BoxPtr pbox, + int nbox, + int dx, + int dy, + Bool reverse, + Bool upsidedown, + Pixel bitplane, + void *closure) +{ + SetupS3(pDstDrawable->pScreen); + int srcX, srcY, dstX, dstY; + int w, h; + int flags; + int x1, x2; + + if (sourceInvarient (pGC->alu)) + { + s3_24FillBoxSolid (pDstDrawable, nbox, pbox, 0, pGC->alu, pGC->planemask); + return; + } + + s3SetGlobalBitmap (pDstDrawable->pScreen, s3GCMap (pGC)); + _s3SetBlt(s3,pGC->alu,pGC->planemask); + DRAW_DEBUG ((DEBUG_RENDER, "s3CopyNtoN alu %d planemask 0x%x", + pGC->alu, pGC->planemask)); + dx *= 3; + while (nbox--) + { + x1 = pbox->x1 * 3; + x2 = pbox->x2 * 3; + w = x2 - x1; + h = pbox->y2 - pbox->y1; + flags = 0; + if (reverse) + { + dstX = x2 - 1; + } + else + { + dstX = x1; + flags |= INC_X; + } + srcX = dstX + dx; + + if (upsidedown) + { + dstY = pbox->y2 - 1; + } + else + { + dstY = pbox->y1; + flags |= INC_Y; + } + srcY = dstY + dy; + + _s3Blt (s3, srcX, srcY, dstX, dstY, w, h, flags); + pbox++; + } + MarkSyncS3 (pSrcDrawable->pScreen); +} + +RegionPtr +s3_24CopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, + int srcx, int srcy, int width, int height, int dstx, int dsty) +{ + SetupS3(pDstDrawable->pScreen); + + if (pSrcDrawable->type == DRAWABLE_WINDOW && + pDstDrawable->type == DRAWABLE_WINDOW && + ok24(pGC->planemask)) + { + return fbDoCopy (pSrcDrawable, pDstDrawable, pGC, + srcx, srcy, width, height, + dstx, dsty, s3_24CopyNtoN, 0, 0); + } + return KdCheckCopyArea (pSrcDrawable, pDstDrawable, pGC, + srcx, srcy, width, height, dstx, dsty); +} + + +#define NUM_STACK_RECTS 1024 + +void +s3_24PolyFillRect (DrawablePtr pDrawable, GCPtr pGC, + int nrectFill, xRectangle *prectInit) +{ + s3GCPrivate(pGC); + xRectangle *prect; + RegionPtr prgnClip; + register BoxPtr pbox; + register BoxPtr pboxClipped; + BoxPtr pboxClippedBase; + BoxPtr pextent; + BoxRec stackRects[NUM_STACK_RECTS]; + int numRects; + int n; + int xorg, yorg; + int x, y; + + if (pGC->fillStyle != FillSolid || !ok24 (pGC->fgPixel) || !ok24(pGC->planemask)) + { + KdCheckPolyFillRect (pDrawable, pGC, nrectFill, prectInit); + return; + } + + prgnClip = fbGetCompositeClip(pGC); + xorg = pDrawable->x; + yorg = pDrawable->y; + + if (xorg || yorg) + { + prect = prectInit; + n = nrectFill; + while(n--) + { + prect->x += xorg; + prect->y += yorg; + prect++; + } + } + + prect = prectInit; + + numRects = REGION_NUM_RECTS(prgnClip) * nrectFill; + if (numRects > NUM_STACK_RECTS) + { + pboxClippedBase = (BoxPtr)ALLOCATE_LOCAL(numRects * sizeof(BoxRec)); + if (!pboxClippedBase) + return; + } + else + pboxClippedBase = stackRects; + + pboxClipped = pboxClippedBase; + + if (REGION_NUM_RECTS(prgnClip) == 1) + { + int x1, y1, x2, y2, bx2, by2; + + pextent = REGION_RECTS(prgnClip); + x1 = pextent->x1; + y1 = pextent->y1; + x2 = pextent->x2; + y2 = pextent->y2; + while (nrectFill--) + { + if ((pboxClipped->x1 = prect->x) < x1) + pboxClipped->x1 = x1; + + if ((pboxClipped->y1 = prect->y) < y1) + pboxClipped->y1 = y1; + + bx2 = (int) prect->x + (int) prect->width; + if (bx2 > x2) + bx2 = x2; + pboxClipped->x2 = bx2; + + by2 = (int) prect->y + (int) prect->height; + if (by2 > y2) + by2 = y2; + pboxClipped->y2 = by2; + + prect++; + if ((pboxClipped->x1 < pboxClipped->x2) && + (pboxClipped->y1 < pboxClipped->y2)) + { + pboxClipped++; + } + } + } + else + { + int x1, y1, x2, y2, bx2, by2; + + pextent = REGION_EXTENTS(pGC->pScreen, prgnClip); + x1 = pextent->x1; + y1 = pextent->y1; + x2 = pextent->x2; + y2 = pextent->y2; + while (nrectFill--) + { + BoxRec box; + + if ((box.x1 = prect->x) < x1) + box.x1 = x1; + + if ((box.y1 = prect->y) < y1) + box.y1 = y1; + + bx2 = (int) prect->x + (int) prect->width; + if (bx2 > x2) + bx2 = x2; + box.x2 = bx2; + + by2 = (int) prect->y + (int) prect->height; + if (by2 > y2) + by2 = y2; + box.y2 = by2; + + prect++; + + if ((box.x1 >= box.x2) || (box.y1 >= box.y2)) + continue; + + n = REGION_NUM_RECTS (prgnClip); + pbox = REGION_RECTS(prgnClip); + + /* clip the rectangle to each box in the clip region + this is logically equivalent to calling Intersect() + */ + while(n--) + { + pboxClipped->x1 = max(box.x1, pbox->x1); + pboxClipped->y1 = max(box.y1, pbox->y1); + pboxClipped->x2 = min(box.x2, pbox->x2); + pboxClipped->y2 = min(box.y2, pbox->y2); + pbox++; + + /* see if clipping left anything */ + if(pboxClipped->x1 < pboxClipped->x2 && + pboxClipped->y1 < pboxClipped->y2) + { + pboxClipped++; + } + } + } + } + if (pboxClipped != pboxClippedBase) + { + s3_24FillBoxSolid(pDrawable, + pboxClipped-pboxClippedBase, pboxClippedBase, + pGC->fgPixel, pGC->alu, pGC->planemask); + } + if (pboxClippedBase != stackRects) + DEALLOCATE_LOCAL(pboxClippedBase); +} + +void +s3_24SolidBoxClipped (DrawablePtr pDrawable, + RegionPtr pClip, + int x1, + int y1, + int x2, + int y2, + FbBits fg) +{ + SetupS3 (pDrawable->pScreen); + BoxPtr pbox; + int nbox; + int partX1, partX2, partY1, partY2; + + s3SetGlobalBitmap (pDrawable->pScreen, s3DrawMap (pDrawable)); + _s3SetSolidFill(s3,fg,GXcopy,~0); + + for (nbox = REGION_NUM_RECTS(pClip), pbox = REGION_RECTS(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; + + partX1 *= 3; + partX2 *= 3; + _s3SolidRect(s3,partX1, partY1, partX2-partX1, partY2-partY1); + } + MarkSyncS3(pDrawable->pScreen); +} + +void +s3_24ImageGlyphBlt (DrawablePtr pDrawable, + GCPtr pGC, + int x, + int y, + unsigned int nglyph, + CharInfoPtr *ppciInit, + pointer 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; + FbBits *dst; + FbStride dstStride; + int dstBpp; + int dstXoff, dstYoff; + FbBits depthMask; + int xBack, widthBack; + int yBack, heightBack; + + depthMask = FbFullMask(pDrawable->depth); + if (!ok24 (pGC->fgPixel) || + !ok24(pGC->bgPixel) || + !ok24(pGC->planemask)) + { + KdCheckImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppciInit, pglyphBase); + return; + } + fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); + + x += pDrawable->x; + y += pDrawable->y; + + 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); + s3_24SolidBoxClipped (pDrawable, + fbGetCompositeClip(pGC), + xBack, + yBack, + xBack + widthBack, + yBack + heightBack, + pPriv->bg); + + KdCheckSync (pDrawable->pScreen); + + 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 (gWidth <= sizeof (FbStip) * 8 && + fbGlyphIn (fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight)) + { + fbGlyph24 (dst + (gy - dstYoff) * dstStride, + dstStride, + dstBpp, + (FbStip *) pglyph, + pPriv->fg, + gx - dstXoff, + gHeight); + } + else + { + gStride = GLYPHWIDTHBYTESPADDED(pci) / sizeof (FbStip); + fbPutXYImage (pDrawable, + fbGetCompositeClip(pGC), + pPriv->fg, + pPriv->bg, + pPriv->pm, + GXcopy, + FALSE, + + gx, + gy, + gWidth, gHeight, + + (FbStip *) pglyph, + gStride, + 0); + } + } + x += pci->metrics.characterWidth; + } +} + +static const GCOps s3_24GCOps = { + s3_24FillSpans, + KdCheckSetSpans, + KdCheckPutImage, + KdCheckCopyArea, + KdCheckCopyPlane, + KdCheckPolyPoint, + KdCheckPolylines, + KdCheckPolySegment, + KdCheckPolyRectangle, + KdCheckPolyArc, + KdCheckFillPolygon, + s3_24PolyFillRect, + KdCheckPolyFillArc, + miPolyText8, + miPolyText16, + miImageText8, + miImageText16, + s3_24ImageGlyphBlt, + KdCheckPolyGlyphBlt, + KdCheckPushPixels, +}; + +void +s3_24ValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable) +{ + if (pDrawable->type != DRAWABLE_WINDOW) + pGC->ops = (GCOps *) &kdAsyncPixmapGCOps; + else + pGC->ops = (GCOps *) &s3_24GCOps; + fbValidateGC (pGC, changes, pDrawable); +} + +GCFuncs s3_24GCFuncs = { + s3_24ValidateGC, + miChangeGC, + miCopyGC, + miDestroyGC, + miChangeClip, + miDestroyClip, + miCopyClip +}; + +Bool +s3_24CreateGC (GCPtr pGC) +{ + if (!fbCreateGC (pGC)) + return FALSE; + + if (pGC->depth != 1) + pGC->funcs = &s3_24GCFuncs; + + return TRUE; +} + +Bool +s3_24CreateWindow(WindowPtr pWin) +{ + return fbCreateWindow (pWin); +} + +void +s3_24PaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) +{ + SetupS3(pWin->drawable.pScreen); + s3PatternPtr pPattern; + + DRAW_DEBUG ((DEBUG_PAINT_WINDOW, "s3PaintWindow 0x%x extents %d %d %d %d n %d", + pWin->drawable.id, + pRegion->extents.x1, pRegion->extents.y1, + pRegion->extents.x2, pRegion->extents.y2, + REGION_NUM_RECTS(pRegion))); + if (!REGION_NUM_RECTS(pRegion)) + return; + switch (what) { + case PW_BACKGROUND: + switch (pWin->backgroundState) { + case None: + return; + case ParentRelative: + do { + pWin = pWin->parent; + } while (pWin->backgroundState == ParentRelative); + (*pWin->drawable.pScreen->PaintWindowBackground)(pWin, pRegion, + what); + return; + case BackgroundPixel: + if (ok24(pWin->background.pixel)) + { + s3_24FillBoxSolid((DrawablePtr)pWin, + (int)REGION_NUM_RECTS(pRegion), + REGION_RECTS(pRegion), + pWin->background.pixel, GXcopy, ~0); + return; + } + } + break; + case PW_BORDER: + if (pWin->borderIsPixel && ok24(pWin->border.pixel)) + { + s3_24FillBoxSolid((DrawablePtr)pWin, + (int)REGION_NUM_RECTS(pRegion), + REGION_RECTS(pRegion), + pWin->border.pixel, GXcopy, ~0); + return; + } + break; + } + KdCheckPaintWindow (pWin, pRegion, what); +} + +Bool +s3DrawInit (ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + s3ScreenInfo(pScreenPriv); + int ncache_w, ncache_h, ncache; + int px, py; + S3PatternCache *cache; + Bool dumb = FALSE; + int ma; + + switch (pScreenPriv->screen->fb[0].bitsPerPixel) { + case 8: + case 16: + case 32: + break; + case 24: + dumb = TRUE; + break; + default: + return FALSE; + } + /* + * Hook up asynchronous drawing + */ + RegisterSync (pScreen); + /* + * Replace various fb screen functions + */ + if (dumb) + { + pScreen->CreateGC = s3_24CreateGC; + pScreen->CreateWindow = s3_24CreateWindow; + pScreen->PaintWindowBackground = s3_24PaintWindow; + pScreen->PaintWindowBorder = s3_24PaintWindow; + pScreen->CopyWindow = s3CopyWindow; + } + else + { + if (serverGeneration != s3Generation) + { + s3GCPrivateIndex = AllocateGCPrivateIndex (); + s3WindowPrivateIndex = AllocateWindowPrivateIndex (); + s3Generation = serverGeneration; + } + if (!AllocateWindowPrivate(pScreen, s3WindowPrivateIndex, 0)) + return FALSE; + if (!AllocateGCPrivate(pScreen, s3GCPrivateIndex, sizeof (s3PrivGCRec))) + return FALSE; + pScreen->CreateGC = s3CreateGC; + pScreen->CreateWindow = s3CreateWindow; + pScreen->ChangeWindowAttributes = s3ChangeWindowAttributes; + pScreen->DestroyWindow = s3DestroyWindow; + pScreen->PaintWindowBackground = s3PaintWindow; + pScreen->PaintWindowBorder = s3PaintWindow; +#ifndef S3_TRIO + if (pScreenPriv->screen->fb[1].depth) + { + FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen); + + pScrPriv->PaintKey = s3PaintKey; + pScrPriv->CopyWindow = s3CopyWindowProc; + pScreen->CopyWindow = fbOverlayCopyWindow; + } + else +#endif + pScreen->CopyWindow = s3CopyWindow; + + /* + * Initialize patterns + */ +#ifdef S3_TRIO + ma = 0; +#else + for (ma = 0; s3s->fbmap[ma] >= 0; ma++) +#endif + { + ncache_w = s3s->fb[ma].offscreen_width / S3_TILE_SIZE; + ncache_h = s3s->fb[ma].offscreen_height / S3_TILE_SIZE; + ncache = ncache_w * ncache_h; + if (ncache > 64) + ncache = 64; + DRAW_DEBUG ((DEBUG_S3INIT, "ncache_w %d ncache_h %d ncache %d", + ncache_w, ncache_h, ncache)); + s3s->fb[ma].patterns.cache = (S3PatternCache *) xalloc (ncache * sizeof (S3PatternCache)); + if (s3s->fb[ma].patterns.cache) + { + DRAW_DEBUG ((DEBUG_S3INIT, "Have pattern cache")); + s3s->fb[ma].patterns.ncache = ncache; + s3s->fb[ma].patterns.last_used = 0; + s3s->fb[ma].patterns.last_id = 0; + cache = s3s->fb[ma].patterns.cache; + for (py = 0; py < ncache_h && ncache; py++) + for (px = 0; px < ncache_w && ncache; px++) + { + cache->id = 0; + cache->x = s3s->fb[ma].offscreen_x + px * S3_TILE_SIZE; + cache->y = s3s->fb[ma].offscreen_y + py * S3_TILE_SIZE; + cache++; + ncache--; + } + } + } + } + return TRUE; +} + +void +s3DrawEnable (ScreenPtr pScreen) +{ + SetupS3(pScreen); + s3ScreenInfo(pScreenPriv); + int c; + int ma; + + s3SetGlobalBitmap (pScreen, 0); + _s3WaitIdleEmpty (s3); + if (pScreenPriv->screen->fb[0].bitsPerPixel == 24) + { + _s3SetScissorsTl(s3, 0, 0); + _s3SetScissorsBr(s3, pScreenPriv->screen->width*3 - 1, pScreenPriv->screen->height - 1); + _s3SetSolidFill(s3, pScreen->whitePixel, GXcopy, ~0); + _s3SolidRect (s3, 0, 0, pScreenPriv->screen->width*3, pScreenPriv->screen->height); + } + else + { + /* + * Flush pattern cache + */ +#ifdef S3_TRIO + ma = 0; +#else + for (ma = 0; s3s->fbmap[ma] >= 0; ma++) +#endif + { + for (c = 0; c < s3s->fb[ma].patterns.ncache; c++) + s3s->fb[ma].patterns.cache[c].id = 0; + } + + _s3SetScissorsTl(s3, 0, 0); + _s3SetScissorsBr(s3, pScreenPriv->screen->width - 1, pScreenPriv->screen->height - 1); + _s3SetSolidFill(s3, pScreen->blackPixel, GXcopy, ~0); + _s3SolidRect (s3, 0, 0, pScreenPriv->screen->width, pScreenPriv->screen->height); + } + MarkSyncS3 (pScreen); +} + +void +s3DrawDisable (ScreenPtr pScreen) +{ + SetupS3 (pScreen); + _s3WaitIdleEmpty (s3); +} + +void +s3DrawFini (ScreenPtr pScreen) +{ + SetupS3(pScreen); + s3ScreenInfo(pScreenPriv); + int ma; + +#ifdef S3_TRIO + ma = 0; +#else + for (ma = 0; s3s->fbmap[ma] >= 0; ma++) +#endif + { + if (s3s->fb[ma].patterns.cache) + { + xfree (s3s->fb[ma].patterns.cache); + s3s->fb[ma].patterns.cache = 0; + s3s->fb[ma].patterns.ncache = 0; + } + } +} + +void +s3DrawSync (ScreenPtr pScreen) +{ + SetupS3(pScreen); + + _s3WaitIdleEmpty(s3c->s3); +} --- xorg-server-1.4.2.orig/hw/kdrive/savage/s3.nick +++ xorg-server-1.4.2/hw/kdrive/savage/s3.nick @@ -0,0 +1,41 @@ +/* $RCSId: $ */ + +global f_ref = 14318000; + +function s3_clock (m, n, r) +{ + return f_ref * (m + 2) / ((n + 2) * (2 ^ r)); +} + +function s3_near (f1, f2) +{ + return abs (f1 - f2) < f1 / 10; +} + +function s3_clocks (f) +{ + auto m, n, r, ft; + auto dist, min_dist; + auto min_m, min_n, min_r; + + min_dist = f / 5; + for (r = 0; r <= 3; r++) + for (n = 0; n <= 31; n++) + for (m = 0; m <= 127; m++) + { + ft = s3_clock (m, n, r); + if (s3_near (ft, f)) + printf ("m %d n %d r %d = %d\n", + m, n, r, ft); + dist = abs (f - ft); + if (dist < min_dist) + { + min_dist = dist; + min_m = m; + min_n = n; + min_r = r; + } + } + printf ("m %d n %d r %d f %d dist %d\n", + min_m, min_n, min_r, s3_clock(min_m, min_n, min_r), min_dist); +} --- xorg-server-1.4.2.orig/hw/kdrive/savage/s3stub.c +++ xorg-server-1.4.2/hw/kdrive/savage/s3stub.c @@ -0,0 +1,93 @@ +/* + * Copyright 1999 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_CONFIG_H +#include +#endif +#include "s3.h" + +void +InitCard (char *name) +{ + KdCardAttr attr; +#ifdef VXWORKS + attr.naddr = 2; + attr.io = 0; + attr.address[0] = 0xbc000000; /* registers */ + attr.address[1] = 0xba000000; /* frame buffer */ + KdCardInfoAdd (&s3Funcs, &attr, 0); +#else + CARD32 count; + + count = 0; + while (LinuxFindPci (0x5333, 0x8a22, count, &attr)) + { + KdCardInfoAdd (&s3Funcs, &attr, 0); + count++; + } +#endif +} + +void +InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) +{ + KdInitOutput (pScreenInfo, argc, argv); +} + +void +InitInput (int argc, char **argv) +{ + KdOsAddInputDrivers (); + KdInitInput (); +} + +extern int s3CpuTimeout; +extern int s3AccelTimeout; + +void +ddxUseMsg (void) +{ + ErrorF("\nSavage Driver Options:\n"); + ErrorF("-cpu Sets CPU timout\n"); + ErrorF("-accel Sets acceleration timout\n"); + + KdUseMsg(); +} + +int +ddxProcessArgument (int argc, char **argv, int i) +{ + int ret; + + if (!strcmp (argv[i], "-cpu")) + { + s3CpuTimeout = strtol(argv[i+1], NULL, 0); + return 2; + } + if (!strcmp (argv[i], "-accel")) + { + s3AccelTimeout = strtol (argv[i+1], NULL, 0); + return 2; + } + return KdProcessArgument (argc, argv, i); +} --- xorg-server-1.4.2.orig/hw/kdrive/savage/s3.c +++ xorg-server-1.4.2/hw/kdrive/savage/s3.c @@ -0,0 +1,1835 @@ +/* + * Copyright 1999 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_CONFIG_H +#include +#endif +#include "s3.h" + +#define REGISTERS_OFFSET (0x1000000) +#define PACKED_OFFSET (0x8100) +#define IOMAP_OFFSET (0x8000) + +#define S3_MIN_CLOCK 250000 + +static void +_s3SetBlank (S3Ptr s3, S3Vga *s3vga, Bool blank) +{ + CARD8 clock_mode; + + s3SetImm(s3vga, s3_screen_off, blank ? 1 : 0); +} + +Bool +s3CardInit (KdCardInfo *card) +{ + S3CardInfo *s3c; + S3Ptr s3; + S3Vga *s3vga; + int size; + CARD8 *registers; + CARD32 s3FrameBuffer; + CARD32 s3Registers; + CARD8 *temp_buffer; + CARD32 max_memory; + VGA32 save_linear_window_size; + VGA32 save_enable_linear; + VGA32 save_register_lock_2; + VGA32 save_misc_output; + + s3c = (S3CardInfo *) xalloc (sizeof (S3CardInfo)); + if (!s3c) + { + goto bail0; + } + + memset (s3c, '\0', sizeof (S3CardInfo)); + + card->driver = s3c; + +#ifdef VXWORKS + s3c->bios_initialized = 0; +#else + s3c->bios_initialized = 1; +#endif + + if (card->attr.naddr > 1 && card->attr.address[1]) + { + s3FrameBuffer = card->attr.address[1]; + s3Registers = card->attr.address[0]; + max_memory = 32 * 1024 * 1024; + } + else + { + s3FrameBuffer = card->attr.address[0]; + s3Registers = s3FrameBuffer + REGISTERS_OFFSET; + max_memory = 16 * 1024 * 1024; + } + +#ifdef DEBUG + fprintf (stderr, "S3 at 0x%x/0x%x\n", s3Registers, s3FrameBuffer); +#endif + registers = KdMapDevice (s3Registers, + sizeof (S3) + PACKED_OFFSET); + if (!registers) + { + ErrorF ("Can't map s3 device\n"); + goto bail2; + } + s3 = (S3Ptr) (registers + PACKED_OFFSET); + s3c->registers = registers; + s3c->s3 = s3; + + s3vga = &s3c->s3vga; + s3RegInit (s3vga, (VGAVOL8 *) (registers + IOMAP_OFFSET)); + + if (!s3c->bios_initialized) + { + volatile CARD32 *wakeup; + + wakeup = (volatile CARD32 *) (registers + 0x8510); + ErrorF ("Wakeup S3 chip at 0x%x\n", wakeup); + ErrorF ("Wakeup was 0x%x\n", *wakeup); + /* wakeup the chip */ + *(volatile CARD32 *) (registers + 0x8510) = 1; + ErrorF ("Wakeup is 0x%x\n", *wakeup); + } + s3Set (s3vga, s3_io_addr_select, 1); + s3Set (s3vga, s3_enable_ram, 1); + VgaFlush (&s3vga->card); + + save_register_lock_2 = s3Get (s3vga, s3_register_lock_2); + s3SetImm (s3vga, s3_register_lock_2, 0xa0); + save_linear_window_size = s3Get (s3vga, s3_linear_window_size); + save_enable_linear = s3Get (s3vga, s3_enable_linear); + s3Set (s3vga, s3_linear_window_size, 3); + s3Set (s3vga, s3_enable_linear, 1); + VgaFlush (&s3vga->card); + VgaFinish (&s3vga->card); + + /* + * Can't trust S3 register value for frame buffer amount, must compute + */ + temp_buffer = KdMapDevice (s3FrameBuffer, max_memory); + + s3c->memory = KdFrameBufferSize (temp_buffer, max_memory); + + s3Set (s3vga, s3_linear_window_size, save_linear_window_size); + s3Set (s3vga, s3_enable_linear, save_enable_linear); + VgaFlush (&s3vga->card); + s3SetImm (s3vga, s3_register_lock_2, save_register_lock_2); + VgaFinish (&s3vga->card); +#ifdef DEBUG + fprintf (stderr, "Frame buffer 0x%x\n", s3c->memory); +#endif + KdUnmapDevice (temp_buffer, max_memory); + + if (!s3c->memory) + { + ErrorF ("Can't detect s3 frame buffer at 0x%x\n", s3FrameBuffer); + goto bail3; + } + + s3c->frameBuffer = KdMapDevice (s3FrameBuffer, s3c->memory); + if (!s3c->frameBuffer) + { + ErrorF ("Can't map s3 frame buffer\n"); + goto bail3; + } + + card->driver = s3c; + + return TRUE; +bail3: + KdUnmapDevice ((void *) s3, sizeof (S3)); +bail2: +bail1: + xfree (s3c); +bail0: + return FALSE; +} + +Bool +s3ModeSupported (KdScreenInfo *screen, + const KdMonitorTiming *t) +{ + if (screen->fb[1].depth) + { + /* + * Must have at least one true color stream + */ + if (screen->fb[0].depth <= 8 && + screen->fb[1].depth <= 8) + return FALSE; + } + /* make sure the clock isn't too fast */ + if (t->clock > S3_MAX_CLOCK * 2) + return FALSE; + /* width must be a multiple of 16 */ + if (t->horizontal & 0xf) + return FALSE; + return TRUE; +} + +Bool +s3ModeUsable (KdScreenInfo *screen) +{ + KdCardInfo *card = screen->card; + S3CardInfo *s3c = (S3CardInfo *) card->driver; + int screen_size; + int pixel_width; + int byte_width; + int fb; + + screen_size = 0; + for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++) + { + if (screen->fb[fb].depth >= 24) + { + screen->fb[fb].depth = 24; + if (screen->fb[fb].bitsPerPixel != 24) + screen->fb[fb].bitsPerPixel = 32; + } + else if (screen->fb[fb].depth >= 16) + { + screen->fb[fb].depth = 16; + screen->fb[fb].bitsPerPixel = 16; + } + else if (screen->fb[fb].depth >= 15) + { + screen->fb[fb].depth = 15; + screen->fb[fb].bitsPerPixel = 16; + } + else + { + screen->fb[fb].depth = 8; + screen->fb[fb].bitsPerPixel = 8; + } + + /* + * SGRAM requires stride % 64 == 0 + */ + screen->fb[fb].pixelStride = (screen->width + 63) & ~63; + screen->fb[fb].byteStride = screen->fb[fb].pixelStride * (screen->fb[fb].bitsPerPixel >> 3); + screen_size += screen->fb[fb].byteStride * screen->height; + } + + return screen_size <= s3c->memory; +} + +Bool +s3ScreenInit (KdScreenInfo *screen) +{ + KdCardInfo *card = screen->card; + S3CardInfo *s3c = (S3CardInfo *) card->driver; + S3ScreenInfo *s3s; + int memory; + int requested_memory; + int v_total, h_total; + int m, n, r; + int i; + const KdMonitorTiming *t; + int screen_size; + int fb; + int ma; + + s3s = (S3ScreenInfo *) xalloc (sizeof (S3ScreenInfo)); + if (!s3s) + return FALSE; + + memset (s3s, '\0', sizeof (S3ScreenInfo)); + +#ifdef PHOENIX + screen->width = 1152; + screen->height = 900; + screen->rate = 85; + screen->depth = 32; +#endif + if (!screen->width || !screen->height) + { + screen->width = 800; + screen->height = 600; + screen->rate = 72; + } + if (!screen->fb[0].depth) + screen->fb[0].depth = 8; + + t = KdFindMode (screen, s3ModeSupported); + screen->rate = t->rate; + screen->width = t->horizontal; + screen->height = t->vertical; + s3GetClock (t->clock, &m, &n, &r, 511, 127, 4, 250000); +#ifdef DEBUG + fprintf (stderr, "computed %d,%d,%d (%d)\n", + m, n, r, S3_CLOCK(m,n,r)); +#endif +#if 0 + /* + * Can only operate in pixel-doubled mode at 8 or 16 bits per pixel + */ + if (screen->depth > 16 && S3_CLOCK(m,n,r) > S3_MAX_CLOCK) + screen->depth = 16; +#endif + + if (!KdTuneMode (screen, s3ModeUsable, s3ModeSupported)) + { + xfree (s3s); + return FALSE; + } + + s3s->fbmap[2] = -1; + if (screen->fb[1].depth) + { + if (screen->fb[0].bitsPerPixel >= 16) + { + s3s->fbmap[0] = 1; + s3s->fbmap[1] = 0; + } + else + { + s3s->fbmap[0] = 0; + s3s->fbmap[1] = 1; + } + } + else + { + s3s->fbmap[0] = 0; + s3s->fbmap[1] = -1; + } + + screen_size = 0; + for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++) + screen_size += screen->fb[fb].byteStride * screen->height; + + memory = s3c->memory - screen_size; + + /* + * Stick cursor at end of memory + */ + if (memory >= 2048) + { + s3s->cursor_base = s3c->frameBuffer + (s3c->memory - 2048); + memory -= 2048; + } + else + s3s->cursor_base = 0; + + screen_size = 0; + for (ma = 0; s3s->fbmap[ma] >= 0; ma++) + { + fb = s3s->fbmap[ma]; + screen->fb[fb].frameBuffer = s3c->frameBuffer + screen_size; + screen_size += screen->fb[fb].byteStride * screen->height; + + REGION_INIT(pScreen, (&s3s->region[fb]), NullBox, 0); + if (screen->fb[fb].bitsPerPixel == 8) + s3s->fb[ma].chroma_key = 0xff; + else + s3s->fb[ma].chroma_key = 0; + + /* + * Use remaining memory for off-screen storage, but only use + * one piece (either right or bottom). + */ + if (memory >= screen->fb[fb].byteStride * S3_TILE_SIZE) + { + s3s->fb[ma].offscreen = screen->fb[fb].frameBuffer; + s3s->fb[ma].offscreen_x = 0; + s3s->fb[ma].offscreen_y = screen->height; + s3s->fb[ma].offscreen_width = screen->fb[fb].pixelStride; + s3s->fb[ma].offscreen_height = S3_TILE_SIZE; + memory -= s3s->fb[ma].offscreen_height * screen->fb[fb].byteStride; + screen_size += s3s->fb[ma].offscreen_height * screen->fb[fb].byteStride; + } + else + s3s->fb[ma].offscreen = 0; + + switch (screen->fb[fb].depth) { + case 8: + screen->fb[fb].visuals = ((1 << StaticGray) | + (1 << GrayScale) | + (1 << StaticColor) | + (1 << PseudoColor) | + (1 << TrueColor) | + (1 << DirectColor)); + screen->fb[fb].blueMask = 0x00; + screen->fb[fb].greenMask = 0x00; + screen->fb[fb].redMask = 0x00; + break; + case 15: + screen->fb[fb].visuals = (1 << TrueColor); + screen->fb[fb].blueMask = 0x001f; + screen->fb[fb].greenMask = 0x03e0; + screen->fb[fb].redMask = 0x7c00; + break; + case 16: + screen->fb[fb].visuals = (1 << TrueColor); + screen->fb[fb].blueMask = 0x001f; + screen->fb[fb].greenMask = 0x07e0; + screen->fb[fb].redMask = 0xf800; + break; + case 24: + screen->fb[fb].visuals = (1 << TrueColor); + screen->fb[fb].blueMask = 0x0000ff; + screen->fb[fb].greenMask = 0x00ff00; + screen->fb[fb].redMask = 0xff0000; + break; + } + } + + screen->driver = s3s; + + return TRUE; +} + +typedef struct _biosInit { + VGA16 reg; + VGA8 value; +} s3BiosInit; + +s3BiosInit s3BiosReg[] = { + S3_SR +0x15, 0x23, + S3_MISC_OUT, 0x2f, + 0xffff, 1, + S3_SR +0x15, 0x03, + + S3_SR + 0x0, 0x03, + S3_SR + 0x1, 0x00, + S3_SR + 0x2, 0x03, + S3_SR + 0x3, 0x00, + S3_SR + 0x4, 0x02, + S3_SR + 0x5, 0x05, + S3_SR + 0x6, 0x06, + S3_SR + 0x7, 0x07, +/* S3_SR + 0x8, 0x06, */ + S3_SR + 0x9, 0x00, + S3_SR + 0xa, 0x0a, + S3_SR + 0xb, 0x00, + S3_SR + 0xc, 0x0c, + S3_SR + 0xd, 0x00, + S3_SR + 0xe, 0x0e, + S3_SR + 0xf, 0x0f, + +/* S3_SR +0x10, 0x00, */ +/* S3_SR +0x11, 0x0c, */ + S3_SR +0x12, 0x01, + S3_SR +0x13, 0x52, + S3_SR +0x14, 0x00, + +/* S3_SR +0x15, 0x03, */ + + S3_SR +0x16, 0xc5, + S3_SR +0x17, 0xfc, + S3_SR +0x18, 0x40, + S3_SR +0x19, 0x00, + S3_SR +0x1a, 0x01, + S3_SR +0x1b, 0x02, + S3_SR +0x1c, 0x5d, + S3_SR +0x1d, 0x00, + S3_SR +0x1e, 0x00, + S3_SR +0x1f, 0x00, + S3_SR +0x20, 0x20, + S3_SR +0x21, 0x21, + S3_SR +0x22, 0x22, + S3_SR +0x23, 0x23, + S3_SR +0x24, 0x24, + S3_SR +0x25, 0x25, + S3_SR +0x26, 0x26, + S3_SR +0x27, 0x04, + S3_SR +0x28, 0xff, + S3_SR +0x29, 0x00, + S3_SR +0x2a, 0x2a, + S3_SR +0x2b, 0x2b, + S3_SR +0x2c, 0x2c, + S3_SR +0x2d, 0x2d, + S3_SR +0x2e, 0x2e, + S3_SR +0x2f, 0x2f, + S3_SR +0x30, 0x00, + S3_SR +0x31, 0x06, + S3_SR +0x32, 0x41, + S3_SR +0x33, 0x67, + S3_SR +0x34, 0x00, + S3_SR +0x35, 0x00, + S3_SR +0x36, 0x01, + S3_SR +0x37, 0x52, + S3_SR +0x38, 0x5d, + S3_SR +0x39, 0x05, + S3_SR +0x3a, 0x3a, + S3_SR +0x3b, 0x3b, + S3_SR +0x3c, 0x3c, + S3_SR +0x3d, 0x00, + S3_SR +0x3e, 0x3e, + S3_SR +0x3f, 0x00, + S3_SR +0x40, 0x40, + S3_SR +0x41, 0x41, + S3_SR +0x42, 0x42, + S3_SR +0x43, 0x43, + S3_SR +0x44, 0x44, + S3_SR +0x45, 0x45, + S3_SR +0x46, 0x46, + S3_SR +0x47, 0x47, + S3_SR +0x48, 0x48, + S3_SR +0x49, 0x49, + S3_SR +0x4a, 0x4a, + S3_SR +0x4b, 0x4b, + S3_SR +0x4c, 0x4c, + S3_SR +0x4d, 0x4d, + S3_SR +0x4e, 0x4e, + S3_SR +0x4f, 0x4f, + S3_SR +0x50, 0x00, + S3_SR +0x51, 0x00, + S3_SR +0x52, 0x00, + S3_SR +0x53, 0x00, + S3_SR +0x54, 0x00, + S3_SR +0x55, 0x00, + S3_SR +0x56, 0x00, + S3_SR +0x57, 0x00, + S3_SR +0x58, 0x00, + S3_SR +0x59, 0x70, + S3_SR +0x5a, 0x38, + S3_SR +0x5b, 0x08, + S3_SR +0x5c, 0x77, + S3_SR +0x5d, 0x77, + S3_SR +0x5e, 0x00, + S3_SR +0x5f, 0x00, + S3_SR +0x60, 0xff, + S3_SR +0x61, 0xbf, + S3_SR +0x62, 0xff, + S3_SR +0x63, 0xff, + S3_SR +0x64, 0xf7, + S3_SR +0x65, 0xff, + S3_SR +0x66, 0xff, + S3_SR +0x67, 0xff, + S3_SR +0x68, 0xff, + S3_SR +0x69, 0xff, + S3_SR +0x6a, 0xff, + S3_SR +0x6b, 0xff, + S3_SR +0x6c, 0xff, + S3_SR +0x6d, 0xff, + S3_SR +0x6e, 0x9b, + S3_SR +0x6f, 0xbf, + + S3_AR + 0x00, 0x00, + S3_AR + 0x01, 0x01, + S3_AR + 0x02, 0x02, + S3_AR + 0x03, 0x03, + S3_AR + 0x04, 0x04, + S3_AR + 0x05, 0x05, + S3_AR + 0x06, 0x06, + S3_AR + 0x07, 0x07, + S3_AR + 0x08, 0x08, + S3_AR + 0x09, 0x09, + S3_AR + 0x0a, 0x0a, + S3_AR + 0x0b, 0x0b, + S3_AR + 0x0c, 0x0c, + S3_AR + 0x0d, 0x0d, + S3_AR + 0x0e, 0x0e, + S3_AR + 0x0f, 0x0f, + S3_AR + 0x10, 0x05, + S3_AR + 0x11, 0x00, + S3_AR + 0x12, 0x0f, + S3_AR + 0x13, 0x08, + S3_AR + 0x14, 0x00, + + S3_GR + 0x00, 0x00, + S3_GR + 0x01, 0x00, + S3_GR + 0x02, 0x00, + S3_GR + 0x03, 0x00, + S3_GR + 0x04, 0x00, + S3_GR + 0x05, 0x10, + S3_GR + 0x06, 0x0e, + S3_GR + 0x07, 0x00, + + S3_CR + 0x00, 0x5f, + S3_CR + 0x01, 0x4f, + S3_CR + 0x02, 0x50, + S3_CR + 0x03, 0x82, + S3_CR + 0x04, 0x55, + S3_CR + 0x05, 0x81, + S3_CR + 0x06, 0xbf, + S3_CR + 0x07, 0x1f, + S3_CR + 0x08, 0x00, + S3_CR + 0x09, 0x4f, + S3_CR + 0x0a, 0x0d, + S3_CR + 0x0b, 0x0e, + S3_CR + 0x0c, 0x00, + S3_CR + 0x0d, 0x00, + S3_CR + 0x0e, 0x3f, + S3_CR + 0x0f, 0xff, + S3_CR + 0x10, 0x9c, + S3_CR + 0x11, 0x0e, + S3_CR + 0x12, 0x8f, + S3_CR + 0x13, 0x28, + S3_CR + 0x14, 0x1f, + S3_CR + 0x15, 0x96, + S3_CR + 0x16, 0xb9, + S3_CR + 0x17, 0xa3, + S3_CR + 0x18, 0xff, + S3_CR + 0x19, 0xdf, + S3_CR + 0x1a, 0xdf, + S3_CR + 0x1b, 0xdf, + S3_CR + 0x1c, 0xdf, + S3_CR + 0x1d, 0xdf, + S3_CR + 0x1e, 0xdf, + S3_CR + 0x1f, 0xdf, + S3_CR + 0x20, 0xdf, + S3_CR + 0x21, 0x00, +/* S3_CR + 0x22, 0x07, */ + S3_CR + 0x23, 0x00, + S3_CR + 0x24, 0xdf, + S3_CR + 0x25, 0xdf, + S3_CR + 0x26, 0x00, + S3_CR + 0x27, 0xdf, + S3_CR + 0x28, 0xdf, + S3_CR + 0x29, 0xdf, + S3_CR + 0x2a, 0xdf, + S3_CR + 0x2b, 0xdf, + S3_CR + 0x2c, 0xdf, + S3_CR + 0x2d, 0x8a, + S3_CR + 0x2e, 0x22, + S3_CR + 0x2f, 0x02, + S3_CR + 0x30, 0xe1, + S3_CR + 0x31, 0x05, + S3_CR + 0x32, 0x40, + S3_CR + 0x33, 0x08, + S3_CR + 0x34, 0x00, + S3_CR + 0x35, 0x00, + S3_CR + 0x36, 0xbf, + S3_CR + 0x37, 0x9b, +/* S3_CR + 0x38, 0x7b, */ +/* S3_CR + 0x39, 0xb8, */ + S3_CR + 0x3a, 0x45, + S3_CR + 0x3b, 0x5a, + S3_CR + 0x3c, 0x10, + S3_CR + 0x3d, 0x00, + S3_CR + 0x3e, 0xfd, + S3_CR + 0x3f, 0x00, + S3_CR + 0x40, 0x00, + S3_CR + 0x41, 0x92, + S3_CR + 0x42, 0xc0, + S3_CR + 0x43, 0x68, + S3_CR + 0x44, 0xff, + S3_CR + 0x45, 0xe8, + S3_CR + 0x46, 0xff, + S3_CR + 0x47, 0xff, + S3_CR + 0x48, 0xf8, + S3_CR + 0x49, 0xff, + S3_CR + 0x4a, 0xfe, + S3_CR + 0x4b, 0xff, + S3_CR + 0x4c, 0xff, + S3_CR + 0x4d, 0xff, + S3_CR + 0x4e, 0xff, + S3_CR + 0x4f, 0xff, + S3_CR + 0x50, 0x00, + S3_CR + 0x51, 0x00, + S3_CR + 0x52, 0x00, + S3_CR + 0x53, 0x00, + S3_CR + 0x54, 0x00, + S3_CR + 0x55, 0x00, + S3_CR + 0x56, 0x00, + S3_CR + 0x57, 0x00, +#if 0 + S3_CR + 0x58, 0x00, + S3_CR + 0x59, 0xf0, +#endif + S3_CR + 0x5a, 0x00, + S3_CR + 0x5b, 0x00, +#if 0 + S3_CR + 0x5c, 0x00, +#endif + S3_CR + 0x5d, 0x00, + S3_CR + 0x5e, 0x00, + S3_CR + 0x5f, 0x00, + S3_CR + 0x60, 0x09, + S3_CR + 0x61, 0x9d, + S3_CR + 0x62, 0xff, + S3_CR + 0x63, 0x00, + S3_CR + 0x64, 0xfd, + S3_CR + 0x65, 0x04, + S3_CR + 0x66, 0x88, + S3_CR + 0x67, 0x00, + S3_CR + 0x68, 0x7f, + S3_CR + 0x69, 0x00, + S3_CR + 0x6a, 0x00, + S3_CR + 0x6b, 0x00, + S3_CR + 0x6c, 0x00, + S3_CR + 0x6d, 0x11, + S3_CR + 0x6e, 0xff, + S3_CR + 0x6f, 0xfe, + + S3_CR + 0x70, 0x30, + S3_CR + 0x71, 0xc0, + S3_CR + 0x72, 0x07, + S3_CR + 0x73, 0x1f, + S3_CR + 0x74, 0x1f, + S3_CR + 0x75, 0x1f, + S3_CR + 0x76, 0x0f, + S3_CR + 0x77, 0x1f, + S3_CR + 0x78, 0x01, + S3_CR + 0x79, 0x01, + S3_CR + 0x7a, 0x1f, + S3_CR + 0x7b, 0x1f, + S3_CR + 0x7c, 0x17, + S3_CR + 0x7d, 0x17, + S3_CR + 0x7e, 0x17, + S3_CR + 0x7f, 0xfd, + S3_CR + 0x80, 0x00, + S3_CR + 0x81, 0x92, + S3_CR + 0x82, 0x10, + S3_CR + 0x83, 0x07, + S3_CR + 0x84, 0x42, + S3_CR + 0x85, 0x00, + S3_CR + 0x86, 0x00, + S3_CR + 0x87, 0x00, + S3_CR + 0x88, 0x10, + S3_CR + 0x89, 0xfd, + S3_CR + 0x8a, 0xfd, + S3_CR + 0x8b, 0xfd, + S3_CR + 0x8c, 0xfd, + S3_CR + 0x8d, 0xfd, + S3_CR + 0x8e, 0xfd, + S3_CR + 0x8f, 0xfd, + S3_CR + 0x90, 0x00, + S3_CR + 0x91, 0x4f, + S3_CR + 0x92, 0x10, + S3_CR + 0x93, 0x00, + S3_CR + 0x94, 0xfd, + S3_CR + 0x95, 0xfd, + S3_CR + 0x96, 0xfd, + S3_CR + 0x97, 0xfd, + S3_CR + 0x98, 0xfd, + S3_CR + 0x99, 0xff, + S3_CR + 0x9a, 0xfd, + S3_CR + 0x9b, 0xff, + S3_CR + 0x9c, 0xfd, + S3_CR + 0x9d, 0xfd, + S3_CR + 0x9e, 0xfd, + S3_CR + 0x9f, 0xff, + S3_CR + 0xa0, 0x0f, +#if 0 + S3_CR + 0xa1, 0x00, + S3_CR + 0xa2, 0x00, + S3_CR + 0xa3, 0x00, + S3_CR + 0xa4, 0x55, +#endif + S3_CR + 0xa5, 0x09, + S3_CR + 0xa6, 0x20, +#if 0 + S3_CR + 0xa7, 0x00, + S3_CR + 0xa8, 0x00, + S3_CR + 0xa9, 0x00, + S3_CR + 0xaa, 0x00, + S3_CR + 0xab, 0x00, + S3_CR + 0xac, 0x00, + S3_CR + 0xad, 0x00, + S3_CR + 0xae, 0x00, + S3_CR + 0xaf, 0x00, + S3_CR + 0xb0, 0xff, +#endif + S3_CR + 0xb1, 0x0e, +#if 0 + S3_CR + 0xb2, 0x55, + S3_CR + 0xb3, 0x00, + S3_CR + 0xb4, 0x55, + S3_CR + 0xb5, 0x00, + S3_CR + 0xb6, 0x00, +#endif + S3_CR + 0xb7, 0x84, +#if 0 + S3_CR + 0xb8, 0xff, + S3_CR + 0xb9, 0xff, + S3_CR + 0xba, 0xff, + S3_CR + 0xbb, 0xff, + S3_CR + 0xbc, 0xff, + S3_CR + 0xbd, 0xff, + S3_CR + 0xbe, 0xff, + S3_CR + 0xbf, 0xff, +#endif + + S3_SR +0x15, 0x23, + 0xffff, 1, + S3_SR +0x15, 0x03, + 0xffff, 1, +}; + +#define S3_NUM_BIOS_REG (sizeof (s3BiosReg) / sizeof (s3BiosReg[0])) + +typedef struct _bios32Init { + VGA16 offset; + VGA32 value; +} s3Bios32Init; + +s3Bios32Init s3Bios32Reg[] = { + 0x8168, 0x00000000, + 0x816c, 0x00000001, + 0x8170, 0x00000000, + 0x8174, 0x00000000, + 0x8178, 0x00000000, + 0x817c, 0x00000000, +#if 0 + 0x8180, 0x00140000, + 0x8184, 0x00000000, + 0x8188, 0x00000000, + 0x8190, 0x00000000, + 0x8194, 0x00000000, + 0x8198, 0x00000000, + 0x819c, 0x00000000, + 0x81a0, 0x00000000, +#endif + 0x81c0, 0x00000000, + 0x81c4, 0x01fbffff, + 0x81c8, 0x00f7ffbf, + 0x81cc, 0x00f7ff00, + 0x81d0, 0x11ffff7f, + 0x81d4, 0x7fffffdf, + 0x81d8, 0xfdfff9ff, + 0x81e0, 0xfd000000, + 0x81e4, 0x00000000, + 0x81e8, 0x00000000, + 0x81ec, 0x00010000, + 0x81f0, 0x07ff057f, + 0x81f4, 0x07ff07ff, + 0x81f8, 0x00000000, + 0x81fc, 0x00000000, + 0x8200, 0x00000000, + 0x8204, 0x00000000, + 0x8208, 0x33000000, + 0x820c, 0x7f000000, + 0x8210, 0x80000000, + 0x8214, 0x00000000, + 0x8218, 0xffffffff, + 0x8300, 0xff007fef, + 0x8304, 0xfffdf7bf, + 0x8308, 0xfdfffbff, +}; + +#define S3_NUM_BIOS32_REG (sizeof (s3Bios32Reg) / sizeof (s3Bios32Reg[0])) + +/* + * Initialize the card precisely as the bios does + */ +s3DoBiosInit (KdCardInfo *card) +{ + S3CardInfo *s3c = card->driver; + CARD32 *regs = (CARD32 *) s3c->registers; + S3Vga *s3vga = &s3c->s3vga; + int r; + + for (r = 0; r < S3_NUM_BIOS_REG; r++) + { + if (s3BiosReg[r].reg == 0xffff) + sleep (s3BiosReg[r].value); + else + VgaStore (&s3vga->card, s3BiosReg[r].reg, s3BiosReg[r].value); + } + VgaStore (&s3vga->card, S3_SR+0x10, 0x22); + VgaStore (&s3vga->card, S3_SR+0x11, 0x44); + VgaStore (&s3vga->card, S3_SR+0x15, 0x01); + sleep (1); + VgaStore (&s3vga->card, S3_SR+0x15, 0x03); + VgaStore (&s3vga->card, S3_CR+0x6f, 0xff); + VgaStore (&s3vga->card, S3_CR+0x3f, 0x3f); + sleep (1); + VgaStore (&s3vga->card, S3_CR+0x3f, 0x00); + VgaStore (&s3vga->card, S3_CR+0x6f, 0xfe); + VgaInvalidate (&s3vga->card); + for (r = 0; r < S3_NUM_BIOS32_REG; r++) + regs[s3Bios32Reg[r].offset/4] = s3Bios32Reg[r].value; +} + +void +s3Preserve (KdCardInfo *card) +{ + S3CardInfo *s3c = card->driver; + S3Ptr s3 = s3c->s3; + S3Vga *s3vga = &s3c->s3vga; + S3Save *save = &s3c->save; + CARD8 t1, t2; + CARD8 *cursor_base; + CARD8 streams_mode; + + s3Save (s3vga); + if (!s3c->bios_initialized) + s3DoBiosInit (card); + + _s3SetBlank (s3, s3vga, TRUE); + /* + * Preserve the first part of the frame buffer which holds + * the text mode fonts and data + */ + s3Set (s3vga, s3_linear_window_size, 3); + s3Set (s3vga, s3_enable_linear, 1); + VgaFlush (&s3vga->card); + memcpy (save->text_save, s3c->frameBuffer, S3_TEXT_SAVE); + /* + * Preserve graphics engine state + */ + save->alt_mix = s3->alt_mix; + save->write_mask = s3->write_mask; + save->fg = s3->fg; + save->bg = s3->bg; + /* + * Preserve streams processor state + */ + streams_mode = s3Get (s3vga, s3_streams_mode); + s3SetImm (s3vga, s3_streams_mode, 3); + save->global_bitmap_1 = s3->global_bitmap_1; + save->global_bitmap_2 = s3->global_bitmap_2; + save->adv_func_cntl = s3->adv_func_cntl; + save->primary_bitmap_1 = s3->primary_bitmap_1; + save->primary_bitmap_2 = s3->primary_bitmap_2; + save->secondary_bitmap_1 = s3->secondary_bitmap_1; + save->secondary_bitmap_2 = s3->secondary_bitmap_2; + save->primary_stream_control = s3->primary_stream_control; + save->blend_control = s3->blend_control; + save->primary_stream_addr_0 = s3->primary_stream_addr_0; + save->primary_stream_addr_1 = s3->primary_stream_addr_1; + save->primary_stream_stride = s3->primary_stream_stride; + save->primary_stream_xy = s3->primary_stream_xy; + save->primary_stream_size = s3->primary_stream_size; + save->primary_stream_mem = s3->primary_stream_mem; + save->secondary_stream_xy = s3->secondary_stream_xy; + save->secondary_stream_size = s3->secondary_stream_size; + save->streams_fifo = s3->streams_fifo; + s3SetImm (s3vga, s3_streams_mode, streams_mode); + _s3SetBlank (s3, s3vga, FALSE); +} + +/* + * Enable the card for rendering. Manipulate the initial settings + * of the card here. + */ +int s3CpuTimeout, s3AccelTimeout; + +void +s3SetGlobalBitmap (ScreenPtr pScreen, int ma) +{ + KdScreenPriv(pScreen); + s3ScreenInfo (pScreenPriv); + + if (s3s->current_ma != ma) + { + s3CardInfo (pScreenPriv); + S3Vga *s3vga = &s3c->s3vga; + S3Ptr s3 = s3c->s3; + CARD32 gb1, gb2; + int depth; + int length; + KdCheckSync (pScreen); + switch (s3s->fb[ma].accel_bpp) { + case 8: + case 24: + length = 0; + break; + case 16: + length = 1; + break; + case 32: + length = 3; + break; + } + s3SetImm (s3vga, s3_pixel_length, length); + gb1 = s3s->fb[ma].bitmap_offset; + gb2 = ((1 << 0) | + (0 << 2) | + (1 << 3) | + ((s3s->fb[ma].accel_stride >> 4) << 4) | + (s3s->fb[ma].accel_bpp << 16) | + (0 << 24) | + (1 << 28)); + s3->global_bitmap_1 = gb1; + s3->global_bitmap_2 = gb2; + s3->global_bitmap_2 = gb2; + s3s->current_ma = ma; + } +} + +Bool +s3Enable (ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + KdCardInfo *card = pScreenPriv->card; + KdScreenInfo *screen = pScreenPriv->screen; + s3CardInfo (pScreenPriv); + s3ScreenInfo (pScreenPriv); + + S3Vga *s3vga = &s3c->s3vga; + S3Ptr s3 = s3c->s3; + int hactive, hblank, hfp, hbp; + int vactive, vblank, vfp, vbp; + int hsize; + + int h_total; + int h_display_end; + int h_blank_start; + int h_blank_end; + int h_sync_start; + int h_sync_end; + int h_screen_off; + int h_start_fifo_fetch; + + int primary_stream_l1[KD_MAX_FB]; + + int v_total; + int v_retrace_start; + int v_retrace_end; + int v_display_end; + int v_blank_start; + int v_blank_end; + int v_blank_start_adjust = 0; + int v_blank_end_adjust = 0; + + int h_blank_start_adjust = 0; + int h_blank_end_adjust = 0; + int h_sync_start_adjust = 0; + int h_sync_end_adjust = 0; + int h_start_fifo_fetch_adjust = 0; + int h_sync_extend; + int h_blank_extend; + int i; + CARD16 cursor_address; + const KdMonitorTiming *t; + int m, n, r; + Bool clock_double; + int cpu_timeout; + int accel_timeout; + int bytes_per_ms; + CARD32 control[2]; + int fb; + int ma; + + s3s->primary_depth = screen->fb[s3s->fbmap[0]].depth; + + s3s->use_streams = TRUE; + + t = KdFindMode (screen, s3ModeSupported); + + hfp = t->hfp; + hbp = t->hbp; + hblank = t->hblank; + hactive = t->horizontal; + + vfp = t->vfp; + vbp = t->vbp; + vblank = t->vblank; + vactive = t->vertical; + + + m = s3Get (s3vga, s3_dclk_m); + n = s3Get (s3vga, s3_dclk_n); + r = s3Get (s3vga, s3_dclk_r); +#define DEBUG_CLOCK +#ifdef DEBUG_CLOCK + fprintf (stderr, "old clock %d, %d, %d (%d)\n", m, n, r, S3_CLOCK(m,n,r)); +#endif + clock_double = FALSE; + s3GetClock (t->clock, &m, &n, &r, 511, 127, 4, 250000); + if (S3_CLOCK(m,n,r) > S3_MAX_CLOCK && !s3s->use_streams) + clock_double = TRUE; + s3Set (s3vga, s3_clock_select, 3); + s3Set (s3vga, s3_dclk_m, m); + s3Set (s3vga, s3_dclk_n, n); + s3Set (s3vga, s3_dclk_r, r); +#ifdef DEBUG_CLOCK + fprintf (stderr, "new clock %d, %d, %d (%d)\n", m, n, r, S3_CLOCK(m,n,r)); +#endif + + if (s3s->use_streams) + { + s3Set (s3vga, s3_streams_mode, 3); + s3Set (s3vga, s3_enable_l1_parameter, 1); + } + else + { + s3Set (s3vga, s3_streams_mode, 0); + s3Set (s3vga, s3_enable_l1_parameter, 0); + } + s3Set (s3vga, s3_flat_panel_output_control_1, 0); + s3Set (s3vga, s3_flat_panel_output_control_2, 0); + s3Set (s3vga, s3_select_graphics_mode, 1); + s3Set (s3vga, s3_enable_blinking, 0); + s3Set (s3vga, s3_enable_vga_16bit, 0); + s3Set (s3vga, s3_enhanced_memory_mapping, 1); + s3Set (s3vga, s3_enable_sff, 1); + s3Set (s3vga, s3_enable_2d_access, 1); + s3Set (s3vga, s3_2bk_cga, 1); + s3Set (s3vga, s3_4bk_hga, 1); + s3Set (s3vga, s3_v_total_double, 0); + s3Set (s3vga, s3_address_16k_wrap, 1); + s3Set (s3vga, s3_word_mode, 0); + s3Set (s3vga, s3_byte_mode, 1); + s3Set (s3vga, s3_hardware_reset, 1); + s3Set (s3vga, s3_max_scan_line, 0); + s3Set (s3vga, s3_linear_window_size, 3); + s3Set (s3vga, s3_enable_linear, 1); + s3Set (s3vga, s3_enable_2d_3d, 1); + s3Set (s3vga, s3_refresh_control, 1); + s3Set (s3vga, s3_disable_pci_read_bursts, 0); + s3Set (s3vga, s3_pci_disconnect_enable, 1); + s3Set (s3vga, s3_primary_load_control, 0); + s3Set (s3vga, s3_secondary_load_control, 0); + s3Set (s3vga, s3_pci_retry_enable, 1); + s3Set (s3vga, s3_enable_256, 1); + s3Set (s3vga, s3_border_select, 1); /* eliminate white border */ + s3SetImm (s3vga, s3_lock_palette, 0); /* unlock palette/border regs */ + s3Set (s3vga, s3_disable_v_retrace_int, 1); + if (t->hpol == KdSyncPositive) + s3Set (s3vga, s3_horz_sync_neg, 0); + else + s3Set (s3vga, s3_horz_sync_neg, 1); + if (t->vpol == KdSyncPositive) + s3Set (s3vga, s3_vert_sync_neg, 0); + else + s3Set (s3vga, s3_vert_sync_neg, 1); + + s3Set (s3vga, s3_dot_clock_8, 1); + s3Set (s3vga, s3_enable_write_plane, 0xf); + s3Set (s3vga, s3_extended_memory_access, 1); + s3Set (s3vga, s3_sequential_addressing_mode, 1); + s3Set (s3vga, s3_select_chain_4_mode, 1); + s3Set (s3vga, s3_linear_addressing_control, 1); + + s3Set (s3vga, s3_enable_gamma_correction, 0); + + s3Set (s3vga, s3_enable_8_bit_luts, 1); + + s3Set (s3vga, s3_dclk_invert, 0); + s3Set (s3vga, s3_enable_clock_double, 0); + s3Set (s3vga, s3_dclk_over_2, 0); + + s3Set (s3vga, s3_delay_h_enable, 0); + s3Set (s3vga, s3_sdclk_skew, 0); + + s3Set (s3vga, s3_dac_mask, 0xff); + +#if 0 +#ifdef DEBUG_CLOCK + m = s3Get (s3vga, s3_mclk_m); + n = s3Get (s3vga, s3_mclk_n); + r = s3Get (s3vga, s3_mclk_r); + fprintf (stderr, "old mclk %d, %d, %d (%d)\n", m, n, r, S3_CLOCK(m,n,r)); +#endif + + s3GetClock (125282, &m, &n, &r, 127, 31, 3, 250000); + +#ifdef DEBUG_CLOCK + fprintf (stderr, "new mclk %d, %d, %d (%d)\n", m, n, r,S3_CLOCK(m,n,r)); +#endif + + s3Set (s3vga, s3_mclk_m, m); + s3Set (s3vga, s3_mclk_n, n); + s3Set (s3vga, s3_mclk_r, r); + +#ifdef DEBUG_CLOCK + m = s3Get (s3vga, s3_eclk_m); + n = s3Get (s3vga, s3_eclk_n); + r = s3Get (s3vga, s3_eclk_r); + fprintf (stderr, "old eclk %d, %d, %d (%d)\n", m, n, r, S3_CLOCK(m,n,r)); +#endif + +#define S3_ECLK 125282 + + s3GetClock (S3_ECLK, &m, &n, &r, 127, 31, 3, 250000); + +#ifdef DEBUG_CLOCK + fprintf (stderr, "new eclk %d, %d, %d (%d)\n", m, n, r,S3_CLOCK(m,n,r)); +#endif + + s3Set (s3vga, s3_eclk_m, m); + s3Set (s3vga, s3_eclk_n, n); + s3Set (s3vga, s3_eclk_r, r); +#endif + + /* + * Compute character lengths for horizontal timing values + */ + hactive = screen->width / 8; + hblank /= 8; + hfp /= 8; + hbp /= 8; + /* + * Set pixel size, choose clock doubling mode + */ + + bytes_per_ms = 0; + + for (ma = 0; s3s->fbmap[ma] >= 0; ma++) + { + fb = s3s->fbmap[ma]; + s3s->fb[ma].accel_bpp = screen->fb[fb].bitsPerPixel; + s3s->fb[ma].accel_stride = screen->fb[fb].pixelStride; + s3s->fb[ma].bitmap_offset = screen->fb[fb].frameBuffer - s3c->frameBuffer; + switch (s3s->fb[ma].accel_bpp) { + case 8: + h_screen_off = hactive; + s3Set (s3vga, s3_pixel_length, 0); + s3Set (s3vga, s3_color_mode, 0); + control[ma] = 0; + /* + * Set up for double-pixel mode, switch color modes, + * divide the dclk and delay h blank by 2 dclks + */ + if (clock_double) + { + s3Set (s3vga, s3_color_mode, 1); + s3Set (s3vga, s3_dclk_over_2, 1); + s3Set (s3vga, s3_enable_clock_double, 1); + s3Set (s3vga, s3_h_skew, 1); + h_blank_start_adjust = -3; + h_blank_end_adjust = -4; + s3Set (s3vga, s3_border_select, 0); + } + break; + case 16: + h_screen_off = hactive * 2; + s3Set (s3vga, s3_pixel_length, 1); + if (screen->fb[fb].depth == 15) + control[ma] = 3 << 24; + else + control[ma] = 5 << 24; + if (clock_double) + { + if (screen->fb[fb].depth == 15) + s3Set (s3vga, s3_color_mode, 3); + else + s3Set (s3vga, s3_color_mode, 5); + s3Set (s3vga, s3_dclk_over_2, 1); + s3Set (s3vga, s3_enable_clock_double, 1); + s3Set (s3vga, s3_border_select, 0); + h_blank_start_adjust = 4; + h_blank_end_adjust = -4; + } + else + { + if (screen->fb[fb].depth == 15) + s3Set (s3vga, s3_color_mode, 2); + else + s3Set (s3vga, s3_color_mode, 4); + s3Set (s3vga, s3_dclk_over_2, 0); + s3Set (s3vga, s3_enable_clock_double, 0); + s3Set (s3vga, s3_delay_blank, 0); + } + break; + case 24: + control[ma] = 6 << 24; + h_screen_off = hactive * 3; + s3s->fb[ma].accel_bpp = 8; + s3s->fb[ma].accel_stride = screen->fb[fb].pixelStride * 3; + break; + case 32: + control[ma] = 7 << 24; + h_screen_off = hactive * 4; + s3Set (s3vga, s3_pixel_length, 3); + s3Set (s3vga, s3_color_mode, 0xd); + break; + } + bytes_per_ms += t->clock * (screen->fb[fb].bitsPerPixel / 8); + primary_stream_l1[ma] = (screen->width * screen->fb[fb].bitsPerPixel / (8 * 8)) - 1; + } + + /* + * X server starts frame buffer at top of memory + */ + s3Set (s3vga, s3_start_address, 0); + + /* + * Set various registers to avoid snow on the screen + */ + + fprintf (stderr, "bytes_per_ms %d\n", bytes_per_ms); + fprintf (stderr, "primary 0x%x master 0x%x command 0x%x lpb 0x%x cpu 0x%x 2d 0x%x\n", + s3Get (s3vga, s3_primary_stream_timeout), + s3Get (s3vga, s3_master_control_unit_timeout), + s3Get (s3vga, s3_command_buffer_timeout), + s3Get (s3vga, s3_lpb_timeout), + s3Get (s3vga, s3_cpu_timeout), + s3Get (s3vga, s3_2d_graphics_engine_timeout)); + + /* + * Test: + * accel x11perf -line500 + * cpu x11perf -circle500 + * + * cpu accel + * 1600x1200x32x85 (918000) 1 1 not enough + * 1600x1200x32x75 (810000) 3 2 + * 1600x1200x32x70 (756000) 4 3 + * 1600x1200x32x60 (648000) 6 5 + * + * 1280x1024x32x85 (630000) 6 4 + * 1280x1024x32x75 (540000) a 6 + * 1280x1024x32x60 (432000) 1f a + * + * 1152x900x32x85 (490000) a 6 + * 1152x900x32x75 (433000) 1f 8 + * 1152x900x32x70 (401000) 1f a + * 1152x900x32x66 (380000) 1f a + * + * 1024x768x32x85 (378000) 1f a + * 1024x768x32x75 (315000) 1f b + * 1024x768x32x70 (300000) 1f b + * 1024x768x32x60 (260000) 1f 12 + * + * 800x600x32x85 (225000) 1f 1a + * 800x600x32x72 (200000) 1f 1d + * 800x600x32x75 (198000) 1f 1d + * + * 1600x1200x16x85 (459000) 1f 8 + * 1600x1200x16x75 (405000) 1f a + * 1600x1200x16x70 (378000) 1f b + * 1600x1200x16x60 (324000) 1f f + * + * 1280x1024x16x85 (315000) 1f 12 + * 1280x1024x16x75 (270000) 1f 16 + * 1280x1024x16x60 (216000) 1f 1d + * + * 1600x1200x8x85 (229000) 1f 1f + * + */ + + if (s3CpuTimeout) + { + if (s3CpuTimeout < 0) + cpu_timeout = 0; + else + cpu_timeout = s3CpuTimeout; + if (s3AccelTimeout < 0) + accel_timeout = 0; + else if (s3AccelTimeout) + accel_timeout = s3AccelTimeout; + else + accel_timeout = s3CpuTimeout; + } + else if (bytes_per_ms >= 900000) + { + cpu_timeout = 0x01; + accel_timeout = 0x01; + } + else if (bytes_per_ms >= 800000) + { + cpu_timeout = 0x03; + accel_timeout = 0x02; + } + else if (bytes_per_ms >= 700000) + { + cpu_timeout = 0x04; + accel_timeout = 0x03; + } + else if (bytes_per_ms >= 600000) + { + cpu_timeout = 0x06; + accel_timeout = 0x04; + } + else if (bytes_per_ms >= 475000) + { + cpu_timeout = 0x0a; + accel_timeout = 0x06; + } + else if (bytes_per_ms >= 425000) + { + cpu_timeout = 0x1f; + accel_timeout = 0x8; + } + else if (bytes_per_ms >= 300000) + { + cpu_timeout = 0x1f; + accel_timeout = 0x0a; + } + else if (bytes_per_ms >= 250000) + { + cpu_timeout = 0x1f; + accel_timeout = 0x12; + } + else if (bytes_per_ms >= 200000) + { + cpu_timeout = 0x1f; + accel_timeout = 0x1a; + } + else + { + cpu_timeout = 0x1f; + accel_timeout = 0x1f; + } + + fprintf (stderr, "cpu 0x%x accel 0x%x\n", cpu_timeout, accel_timeout); + + s3Set (s3vga, s3_primary_stream_timeout, 0xc0); + s3Set (s3vga, s3_master_control_unit_timeout, 0xf); + s3Set (s3vga, s3_command_buffer_timeout, 0x1f); + s3Set (s3vga, s3_lpb_timeout, 0xf); + s3Set (s3vga, s3_2d_graphics_engine_timeout, accel_timeout); + s3Set (s3vga, s3_cpu_timeout, cpu_timeout); + + s3Set (s3vga, s3_fifo_fetch_timing, 1); + s3Set (s3vga, s3_fifo_drain_delay, 2); + + /* + * Compute horizontal register values from timings + */ + h_total = hactive + hblank - 5; + h_display_end = hactive - 1; + + h_sync_start = hactive + hfp + h_sync_start_adjust; + h_sync_end = hactive + hblank - hbp + h_sync_end_adjust; + /* + * pad the blank values narrow a bit and use the border_select to + * eliminate the remaining border; don't know why, but it doesn't + * work in the documented fashion + */ + h_blank_start = hactive + 1 + h_blank_start_adjust; + h_blank_end = hactive + hblank - 2 + h_blank_end_adjust; + /* + * The manual says h_total - 5, but the + * bios does differently... + */ + if (screen->width >= 1600) + h_start_fifo_fetch = h_total - 24; + else if (screen->width >= 1280) + h_start_fifo_fetch = h_total - 19; + else if (screen->width >= 1024) + h_start_fifo_fetch = h_total - 14; + else if (screen->width >= 800) + h_start_fifo_fetch = h_total - 10; + else + h_start_fifo_fetch = h_total - 5; + + h_start_fifo_fetch += h_start_fifo_fetch_adjust; + if (h_blank_end - h_blank_start >= 0x40) + h_blank_extend = 1; + else + h_blank_extend = 0; + + if (h_sync_end - h_sync_start >= 0x20) + h_sync_extend = 1; + else + h_sync_extend = 0; + +#ifdef DEBUG + fprintf (stderr, "h_total %d h_display_end %d\n", + h_total, h_display_end); + fprintf (stderr, "h_sync_start %d h_sync_end %d h_sync_extend %d\n", + h_sync_start, h_sync_end, h_sync_extend); + fprintf (stderr, "h_blank_start %d h_blank_end %d h_blank_extend %d\n", + h_blank_start, h_blank_end, h_blank_extend); +#endif + + s3Set (s3vga, s3_h_total, h_total); + s3Set (s3vga, s3_h_display_end, h_display_end); + s3Set (s3vga, s3_h_blank_start, h_blank_start); + s3Set (s3vga, s3_h_blank_end, h_blank_end); + s3Set (s3vga, s3_h_sync_start, h_sync_start); + s3Set (s3vga, s3_h_sync_end, h_sync_end); + s3Set (s3vga, s3_screen_offset, h_screen_off); + s3Set (s3vga, s3_h_start_fifo_fetch, h_start_fifo_fetch); + s3Set (s3vga, s3_h_sync_extend, h_sync_extend); + s3Set (s3vga, s3_h_blank_extend, h_blank_extend); + + s3Set (s3vga, s3_dac_power_saving_disable, 0); + s3Set (s3vga, s3_dac_power_up_time, hactive + hblank); + + s3Set (s3vga, s3_primary_stream_l1, primary_stream_l1[0]); + + s3Set (s3vga, s3_streams_fifo_delay, 0); + + v_total = vactive + vblank - 2; + v_display_end = vactive - 1; + + v_blank_start = vactive - 1 + v_blank_start_adjust; + v_blank_end = v_blank_start + vblank - 1 + v_blank_end_adjust; + + v_retrace_start = vactive + vfp; + v_retrace_end = vactive + vblank - vbp; + + s3Set (s3vga, s3_v_total, v_total); + s3Set (s3vga, s3_v_retrace_start, v_retrace_start); + s3Set (s3vga, s3_v_retrace_end, v_retrace_end); + s3Set (s3vga, s3_v_display_end, v_display_end); + s3Set (s3vga, s3_v_blank_start, v_blank_start); + s3Set (s3vga, s3_v_blank_end, v_blank_end); + + if (vactive >= 1024) + s3Set (s3vga, s3_line_compare, 0x7ff); + else + s3Set (s3vga, s3_line_compare, 0x3ff); + + /* + * Set cursor + */ + if (!screen->softCursor) + { + cursor_address = (s3s->cursor_base - s3c->frameBuffer) / 1024; + + s3Set (s3vga, s3_cursor_address, cursor_address); + s3Set (s3vga, s3_cursor_ms_x11, 0); + s3Set (s3vga, s3_cursor_enable, 1); + } + else + s3Set (s3vga, s3_cursor_enable, 0); + +#define MAKE_GBF(bds,be,stride,bpp,tile) (\ + ((bds) << 0) | \ + ((be) << 3) | \ + ((stride) << 4) | \ + ((bpp) << 16) | \ + ((tile) << 24)) + /* + * Set accelerator + */ + switch (screen->width) { +#if 0 + case 640: s3Set (s3vga, s3_ge_screen_width, 1); break; + case 800: s3Set (s3vga, s3_ge_screen_width, 2); break; + case 1024: s3Set (s3vga, s3_ge_screen_width, 0); break; + case 1152: s3Set (s3vga, s3_ge_screen_width, 4); break; + case 1280: s3Set (s3vga, s3_ge_screen_width, 3); break; + case 1600: s3Set (s3vga, s3_ge_screen_width, 6); break; +#endif + default: + s3Set (s3vga, s3_ge_screen_width, 7); /* use global bitmap descriptor */ + } + +#if 0 + crtc->l_parm_0_7 = screen->width / 4; /* Undocumented. */ +#endif + + /* + * Set DPMS to normal + */ + s3Set (s3vga, s3_hsync_control, 0); + s3Set (s3vga, s3_vsync_control, 0); + + _s3SetBlank (s3, s3vga, TRUE); + if (s3s->use_streams) + s3Set (s3vga, s3_primary_stream_definition, 1); + else + s3Set (s3vga, s3_primary_stream_definition, 0); + + VgaFlush(&s3vga->card); + VgaSetImm (&s3vga->card, s3_clock_load_imm, 1); + VgaSetImm(&s3vga->card, s3_clock_load_imm, 0); + + + if (s3s->use_streams) + { + fb = s3s->fbmap[0]; + s3->primary_stream_control = control[0]; + s3->primary_stream_addr_0 = + s3->primary_stream_addr_1 = s3s->fb[0].bitmap_offset; + s3->primary_stream_stride = screen->fb[fb].byteStride; + s3->primary_stream_xy = (1 << 16) | 1; + s3->primary_stream_size = ((screen->fb[fb].pixelStride - 1) << 16) | screen->height; + s3->primary_stream_mem = (screen->fb[fb].byteStride * screen->height) / 8 - 1; + if (s3s->fbmap[1] >= 0) + { + fb = s3s->fbmap[1]; + s3->blend_control = 5 << 24; + if (s3s->fb[0].accel_bpp == 8) + s3->chroma_key_control = 0x33000000 | s3s->fb[0].chroma_key; + else + s3->chroma_key_control = 0x13010101; + s3->secondary_stream_control = control[1] | screen->width; + s3->secondary_stream_h_scale = (1 << 15); + s3->color_adjustment = 0; + s3->secondary_stream_vscale = (1 << 15); + s3->secondary_stream_vinit = 0; + s3->secondary_stream_mbuf = 0; + s3->secondary_stream_addr_0 = + s3->secondary_stream_addr_1 = s3s->fb[1].bitmap_offset; + s3->secondary_stream_stride = screen->fb[fb].byteStride; + s3->secondary_stream_scount = screen->height; + s3->secondary_stream_xy = (1 << 16) | 1; + s3->secondary_stream_size = ((screen->fb[fb].pixelStride - 1) << 16) | screen->height; + s3->secondary_stream_mem = (1 << 22) | ((screen->fb[fb].byteStride * screen->height) / 8 - 1); + } + else + { + s3->blend_control = 1 << 24; + s3->secondary_stream_xy = 0x07ff07ff; + s3->secondary_stream_size = 0x00010001; + } + s3->streams_fifo = (0x20 << 11) | (0x20 << 5) | 0x2; + } + s3->mult_misc_read_sel = (((1 << 9) | + (1 << 11) | + (0xe << 12)) | + (((0xe << 0) | + (0xf << 12)) << 16)); + + s3->cmd_overflow_buf_ptr = (1 << 3); + s3->bci_power_management = (1 << 9); + s3->adv_func_cntl = (3 << 8) | (1 << 4) | (1 << 2) | 1; + s3->primary_bitmap_1 = 0; + s3->primary_bitmap_2 = 0; + s3->secondary_bitmap_1 = 0; + s3->secondary_bitmap_2 = 0; + s3s->current_ma = -1; + _s3SetBlank (s3, s3vga, FALSE); +#if 0 + { + VGA16 r; + static CARD32 streams[][2] = { + /* PCI registers */ + 0x8000, 0x8024, + 0x802c, 0x8034, + 0x803c, 0x8040, +#if 0 + 0x8080, 0x808c, /* AGP */ +#endif + 0x80dc, 0x80e0, + + /* 2D registers */ + 0x8168, 0x8188, + 0x8190, 0x81a0, + 0x81c0, 0x81d8, + 0x81e0, 0x8218, + 0x8300, 0x8308, + 0x8504, 0x8510, + + /* LPB/VIP registers */ + 0xff00, 0xff18, + 0xff20, 0xff38, + 0xff40, 0xff40, + 0xff70, 0xff78, + 0xff8c, 0xffa0, + +#if 0 + /* 3D registers */ + 0x48508, 0x48508, + 0x48528, 0x48528, + 0x48548, 0x48548, + 0x48584, 0x485f0, +#endif + + /* motion compensation registers */ + 0x48900, 0x48924, +#if 0 + 0x48928, 0x48928, +#endif + + /* Mastered data transfer registers */ + 0x48a00, 0x48a1c, + + /* configuation/status registers */ + 0x48c00, 0x48c18, + 0x48c20, 0x48c24, + 0x48c40, 0x48c50, + 0x48c60, 0x48c64, + + 0, 0, + }; +#ifdef PHOENIX +#undef stderr +#define stderr stdout +#endif + CARD32 *regs = (CARD32 *) s3c->registers; + int i; + CARD32 reg; + + + for (r = S3_SR + 0; r < S3_SR + S3_NSR; r++) + fprintf (stderr, "SR%02x = %02x\n", r-S3_SR, VgaFetch (&s3vga->card, r)); + for (r = S3_GR + 0; r < S3_GR + S3_NGR; r++) + fprintf (stderr, "GR%02x = %02x\n", r-S3_GR, VgaFetch (&s3vga->card, r)); + for (r = S3_AR + 0; r < S3_AR + S3_NAR; r++) + fprintf (stderr, "AR%02x = %02x\n", r-S3_AR, VgaFetch (&s3vga->card, r)); + for (r = S3_CR + 0; r < S3_CR + S3_NCR; r++) + fprintf (stderr, "CR%02x = %02x\n", r-S3_CR, VgaFetch (&s3vga->card, r)); + for (r = S3_DAC + 0; r < S3_DAC + S3_NDAC; r++) + fprintf (stderr, "DAC%02x = %02x\n", r-S3_DAC, VgaFetch (&s3vga->card, r)); + fprintf (stderr, "MISC_OUT = %02x\n", VgaFetch (&s3vga->card, S3_MISC_OUT)); + fprintf (stderr, "INPUT_STATUS = %02x\n", VgaFetch (&s3vga->card, S3_INPUT_STATUS_1)); + + + for (i = 0; streams[i][0]; i++) + { + for (reg = streams[i][0]; reg <= streams[i][1]; reg += 4) + fprintf (stderr, "0x%4x: 0x%08x\n", reg, regs[reg/4]); + } + } +#endif + return TRUE; +} + +void +s3Disable (ScreenPtr pScreen) +{ +} + +void +s3Restore (KdCardInfo *card) +{ + S3CardInfo *s3c = card->driver; + S3Ptr s3 = s3c->s3; + S3Vga *s3vga = &s3c->s3vga; + S3Save *save = &s3c->save; + CARD8 *cursor_base; + CARD8 streams_mode; + + _s3SetBlank (s3, s3vga, TRUE); + /* streams processor state */ + streams_mode = s3Get (s3vga, s3_streams_mode); + s3SetImm (s3vga, s3_streams_mode, 3); + s3->global_bitmap_1 = save->global_bitmap_1; + s3->global_bitmap_2 = save->global_bitmap_2; + s3->adv_func_cntl = save->adv_func_cntl; + s3->primary_bitmap_1 = save->primary_bitmap_1; + s3->primary_bitmap_2 = save->primary_bitmap_2; + s3->secondary_bitmap_1 = save->secondary_bitmap_1; + s3->secondary_bitmap_2 = save->secondary_bitmap_2; + s3->primary_stream_control = save->primary_stream_control; + s3->blend_control = save->blend_control; + s3->primary_stream_addr_0 = save->primary_stream_addr_0; + s3->primary_stream_addr_0 = save->primary_stream_addr_0; + s3->primary_stream_stride = save->primary_stream_stride; + s3->primary_stream_xy = save->primary_stream_xy; + s3->primary_stream_size = save->primary_stream_size; + s3->primary_stream_mem = save->primary_stream_mem; + s3->secondary_stream_xy = save->secondary_stream_xy; + s3->secondary_stream_size = save->secondary_stream_size; + s3->streams_fifo = save->streams_fifo; + s3SetImm (s3vga, s3_streams_mode, streams_mode); + /* graphics engine state */ + s3->alt_mix = save->alt_mix; + s3->write_mask = save->write_mask; + s3->fg = save->fg; + s3->bg = save->bg; + /* XXX should save and restore real values? */ + s3->scissors_tl = 0x00000000; + s3->scissors_br = 0x0fff0fff; + + VgaRestore (&s3vga->card); + s3Set (s3vga, s3_linear_window_size, 3); + s3Set (s3vga, s3_enable_linear, 1); + VgaFlush (&s3vga->card); + memcpy (s3c->frameBuffer, save->text_save, S3_TEXT_SAVE); + s3Reset (s3vga); + _s3SetBlank (s3, s3vga, FALSE); +} + +void +_s3SetSync (S3CardInfo *s3c, int hsync, int vsync) +{ + /* this abuses the macros defined to access the crtc structure */ + S3Ptr s3 = s3c->s3; + S3Vga *s3vga = &s3c->s3vga; + + s3Set (s3vga, s3_hsync_control, hsync); + s3Set (s3vga, s3_vsync_control, vsync); + VgaFlush (&s3vga->card); +} + +Bool +s3DPMS (ScreenPtr pScreen, int mode) +{ + KdScreenPriv(pScreen); + s3CardInfo(pScreenPriv); + S3Vga *s3vga = &s3c->s3vga; + + switch (mode) { + case KD_DPMS_NORMAL: + _s3SetSync (s3c, 0, 0); + _s3SetBlank (s3c->s3, s3vga, FALSE); + break; + case KD_DPMS_STANDBY: + _s3SetBlank (s3c->s3, s3vga, TRUE); + _s3SetSync (s3c, 1, 0); + break; + case KD_DPMS_SUSPEND: + _s3SetBlank (s3c->s3, s3vga, TRUE); + _s3SetSync (s3c, 0, 1); + break; + case KD_DPMS_POWERDOWN: + _s3SetBlank (s3c->s3, s3vga, TRUE); + _s3SetSync (s3c, 1, 1); + break; + } + return TRUE; +} + +Bool +s3InitScreen(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + KdCardInfo *card = pScreenPriv->card; + KdScreenInfo *screen = pScreenPriv->screen; + s3CardInfo (pScreenPriv); + s3ScreenInfo (pScreenPriv); + int ma, fb; + + if (screen->fb[1].depth) + { + FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen); + + for (ma = 0; s3s->fbmap[ma] >= 0; ma++) + { + fb = s3s->fbmap[ma]; + pScrPriv->layer[fb].key = s3s->fb[ma].chroma_key; + } + } + return TRUE; +} + +void +s3ScreenFini (KdScreenInfo *screen) +{ + S3ScreenInfo *s3s = (S3ScreenInfo *) screen->driver; + + xfree (s3s); + screen->driver = 0; +} + +void +s3CardFini (KdCardInfo *card) +{ + S3CardInfo *s3c = (S3CardInfo *) card->driver; + + KdUnmapDevice (s3c->frameBuffer, s3c->memory); + KdUnmapDevice (s3c->registers, sizeof (S3) + PACKED_OFFSET); + xfree (s3c); + card->driver = 0; +} + +KdCardFuncs s3Funcs = { + s3CardInit, + s3ScreenInit, + s3InitScreen, + s3Preserve, + s3Enable, + s3DPMS, + s3Disable, + s3Restore, + s3ScreenFini, + s3CardFini, + s3CursorInit, + s3CursorEnable, + s3CursorDisable, + s3CursorFini, + s3RecolorCursor, + s3DrawInit, + s3DrawEnable, + s3DrawSync, + s3DrawDisable, + s3DrawFini, + s3GetColors, + s3PutColors, +}; --- xorg-server-1.4.2.orig/hw/kdrive/savage/s3rtst.c +++ xorg-server-1.4.2/hw/kdrive/savage/s3rtst.c @@ -0,0 +1,141 @@ +/* + * Copyright 1999 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_CONFIG_H +#include +#endif +#include +#include "s3reg.h" + +typedef struct { + VgaReg *reg; + char *name; +} NamedVgaReg; + +NamedVgaReg s3VRegs[] = { + s3_h_total, "h_total", + s3_h_display_end, "h_display_end", + s3_h_blank_start, "h_blank_start", + s3_h_blank_end, "h_blank_end", + s3_display_skew, "display_skew", + s3_h_sync_start, "h_sync_start", + s3_h_sync_end, "h_sync_end", + s3_h_skew, "h_skew", + s3_v_total, "v_total", + s3_preset_row_scan, "preset_row_scan", + s3_max_scan_line, "max_scan_line", + s3_start_address, "start_address", + s3_v_retrace_start, "v_retrace_start", + s3_v_retrace_end, "v_retrace_end", + s3_clear_v_retrace_int, "clear_v_retrace_int", + s3_disable_v_retrace_int, "disable_v_retrace_int", + s3_lock_crtc, "lock_crtc", + s3_v_display_end, "v_display_end", + s3_screen_offset, "screen_offset", + s3_count_by_4_mode, "count_by_4_mode", + s3_doubleword_mode, "doubleword_mode", + s3_v_blank_start, "v_blank_start", + s3_v_blank_end, "v_blank_end", + s3_v_total_double, "v_total_double", + s3_word_mode, "word_mode", + s3_byte_mode, "byte_mode", + s3_line_compare, "line_compare", + s3_device_id, "device_id", + s3_revision, "revision", + s3_lock_vert, "lock_vert", + s3_lock_horz, "lock_horz", + s3_io_disable, "io_disable", + s3_mem_size, "mem_size", + s3_register_lock_1 , "register_lock_1 ", + s3_register_lock_2 , "register_lock_2 ", + s3_refresh_control, "refresh_control", + s3_enable_256, "enable_256", + s3_enable_pci_read_bursts, "enable_pci_read_bursts", + s3_h_start_fifo_fetch, "h_start_fifo_fetch", + s3_interlace, "interlace", + s3_old_screen_off_8, "old_screen_off_8", + s3_h_counter_double_mode, "h_counter_double_mode", + s3_hardware_cursor_enable, "hardware_cursor_enable", + s3_hardware_cursor_right, "hardware_cursor_right", + s3_hardware_cursor_x, "hardware_cursor_x", + s3_hardware_cursor_y, "hardware_cursor_y", + s3_hardware_cursor_fg, "hardware_cursor_fg", + s3_cursor_address, "cursor_address", + s3_cursor_start_x, "cursor_start_x", + s3_cursor_start_y, "cursor_start_y", + s3_ge_screen_width, "ge_screen_width", + s3_pixel_length, "pixel_length", + s3_big_endian_linear, "big_endian_linear", + s3_mmio_select, "mmio_select", + s3_mmio_window, "mmio_window", + s3_swap_nibbles, "swap_nibbles", + s3_hardware_cursor_ms_x11, "hardware_cursor_ms_x11", + s3_h_blank_extend, "h_blank_extend", + s3_h_sync_extend, "h_sync_extend", + s3_enable_2d_3d, "enable_2d_3d", + s3_pci_disconnect_enable, "pci_disconnect_enable", + s3_pci_retry_enable, "pci_retry_enable", + s3_color_mode, "color_mode", + s3_screen_off, "screen_off", + s3_unlock_extended_sequencer, "unlock_extended_sequencer", + s3_disable_io_ports, "disable_io_ports", + s3_hsync_control, "hsync_control", + s3_vsync_control, "vsync_control", + s3_mclk_n, "mclk_n", + s3_mclk_r, "mclk_r", + s3_mclk_m, "mclk_m", + s3_dclk_n, "dclk_n", + s3_dclk_r, "dclk_r", + s3_dclk_m, "dclk_m", + s3_mclk_load, "mclk_load", + s3_dclk_load, "dclk_load", + s3_dclk_over_2, "dclk_over_2", + s3_clock_load_imm, "clock_load_imm", + s3_dclk_invert, "dclk_invert", + s3_enable_clock_double, "enable_clock_double", + s3_dclk_double_15_16_invert, "dclk_double_15_16_invert", + s3_enable_gamma_correction, "enable_gamma_correction", + s3_enable_8_bit_luts, "enable_8_bit_luts", + s3_dclk_control, "dclk_control", + s3_vga_dclk_n, "vga_dclk_n", + s3_vga_dclk_r, "vga_dclk_r", + s3_vga_dclk_m1, "vga_dclk_m1", + s3_vga_dclk_m2, "vga_dclk_m2", + s3_vga_clk_select, "vga_clk_select", + s3_clock_select, "clock_select", +}; + +#define NUM_S3_VREGS (sizeof (s3VRegs)/ sizeof (s3VRegs[0])) + +main (int argc, char **argv) +{ + int i; + + iopl(3); + s3SetImm(s3_register_lock_1, 0x48); + s3SetImm(s3_register_lock_2, 0xa0); + s3SetImm(s3_unlock_extended_sequencer, 0x06); + for (i = 0; i < NUM_S3_VREGS; i++) + printf ("%-20.20s %8x\n", s3VRegs[i].name, s3Get (s3VRegs[i].reg)); + s3Restore (); +} --- xorg-server-1.4.2.orig/hw/kdrive/savage/s3curs.c +++ xorg-server-1.4.2/hw/kdrive/savage/s3curs.c @@ -0,0 +1,422 @@ +/* + * Copyright 1999 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_CONFIG_H +#include +#endif +#include "s3.h" +#include "s3draw.h" +#include "cursorstr.h" + +#define SetupCursor(s) KdScreenPriv(s); \ + s3CardInfo(pScreenPriv); \ + s3ScreenInfo(pScreenPriv); \ + S3Ptr s3 = s3c->s3; \ + S3Vga *s3vga = &s3c->s3vga; \ + S3Cursor *pCurPriv = &s3s->cursor + +static void +_s3MoveCursor (ScreenPtr pScreen, int x, int y) +{ + SetupCursor(pScreen); + CARD8 xlow, xhigh, ylow, yhigh; + CARD8 xoff, yoff; + + DRAW_DEBUG ((DEBUG_CURSOR, "s3MoveCursor %d %d", x, y)); + + x -= pCurPriv->xhot; + xoff = 0; + if (x < 0) + { + xoff = -x; + x = 0; + } + y -= pCurPriv->yhot; + yoff = 0; + if (y < 0) + { + yoff = -y; + y = 0; + } + xlow = (CARD8) x; + xhigh = (CARD8) (x >> 8); + ylow = (CARD8) y; + yhigh = (CARD8) (y >> 8); + + + /* This is the recommended order to move the cursor */ + + s3SetImm (s3vga, s3_cursor_xhigh, xhigh); + s3SetImm (s3vga, s3_cursor_xlow, xlow); + s3SetImm (s3vga, s3_cursor_ylow, ylow); + s3SetImm (s3vga, s3_cursor_xoff, xoff); + s3SetImm (s3vga, s3_cursor_yoff, yoff); + s3SetImm (s3vga, s3_cursor_yhigh, yhigh); + + DRAW_DEBUG ((DEBUG_CURSOR, "s3MoveCursor done")); +} + +static void +s3MoveCursor (ScreenPtr pScreen, int x, int y) +{ + SetupCursor (pScreen); + + if (!pCurPriv->has_cursor) + return; + + if (!pScreenPriv->enabled) + return; + + _s3MoveCursor (pScreen, x, y); +} + +#define S3Trunc(c) (((c) >> 8) & 0xff) + +#define S3CursColor(r,g,b) ((S3Trunc(r) << 16) | \ + (S3Trunc(g) << 8) | \ + (S3Trunc(b))) + +static void +s3AllocCursorColors (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + CursorPtr pCursor = pCurPriv->pCursor; + + if (s3s->use_streams) + { + pCurPriv->source = S3CursColor(pCursor->foreRed, + pCursor->foreGreen, + pCursor->foreBlue); + pCurPriv->mask = S3CursColor(pCursor->backRed, + pCursor->backGreen, + pCursor->backBlue); + } + else + { + KdAllocateCursorPixels (pScreen, 0, pCursor, + &pCurPriv->source, &pCurPriv->mask); + switch (pScreenPriv->screen->fb[0].bitsPerPixel) { + case 4: + pCurPriv->source |= pCurPriv->source << 4; + pCurPriv->mask |= pCurPriv->mask << 4; + case 8: + pCurPriv->source |= pCurPriv->source << 8; + pCurPriv->mask |= pCurPriv->mask << 8; + case 16: + pCurPriv->source |= pCurPriv->source << 16; + pCurPriv->mask |= pCurPriv->mask << 16; + } + } +} + +static void +_s3SetCursorColors (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + /* set foreground */ + /* Reset cursor color stack pointers */ + (void) s3GetImm (s3vga, s3_cursor_enable); + s3SetImm (s3vga, s3_cursor_fg, pCurPriv->source); + s3SetImm (s3vga, s3_cursor_fg, pCurPriv->source >> 8); + s3SetImm (s3vga, s3_cursor_fg, pCurPriv->source >> 16); + + /* set background */ + /* Reset cursor color stack pointers */ + (void) s3GetImm (s3vga, s3_cursor_enable); + s3SetImm (s3vga, s3_cursor_bg, pCurPriv->mask); + s3SetImm (s3vga, s3_cursor_bg, pCurPriv->mask >> 8); + s3SetImm (s3vga, s3_cursor_bg, pCurPriv->mask >> 16); +} + +void +s3RecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef) +{ + SetupCursor (pScreen); + CursorPtr pCursor = pCurPriv->pCursor; + xColorItem sourceColor, maskColor; + + if (!pCurPriv->has_cursor || !pCursor) + return; + + if (!pScreenPriv->enabled) + return; + + if (pdef) + { + while (ndef) + { + if (pdef->pixel == pCurPriv->source || + pdef->pixel == pCurPriv->mask) + break; + ndef--; + } + if (!ndef) + return; + } + s3AllocCursorColors (pScreen); + _s3SetCursorColors (pScreen); +} + +static void +s3LoadCursor (ScreenPtr pScreen, int x, int y) +{ + SetupCursor(pScreen); + CursorPtr pCursor = pCurPriv->pCursor; + CursorBitsPtr bits = pCursor->bits; + int w, h; + unsigned char r[2], g[2], b[2]; + unsigned long *ram; + unsigned long *msk, *mskLine, *src, *srcLine; + unsigned long and, xor; + int i, j; + int cursor_address; + int wsrc; + unsigned char ramdac_control_; + + /* + * Allocate new colors + */ + s3AllocCursorColors (pScreen); + + pCurPriv->pCursor = pCursor; + pCurPriv->xhot = pCursor->bits->xhot; + pCurPriv->yhot = pCursor->bits->yhot; + + /* + * Stick new image into cursor memory + */ + ram = (unsigned long *) s3s->cursor_base; + mskLine = (unsigned long *) bits->mask; + srcLine = (unsigned long *) bits->source; + + h = bits->height; + if (h > S3_CURSOR_HEIGHT) + h = S3_CURSOR_HEIGHT; + + wsrc = BitmapBytePad(bits->width) / 4; /* ulongs per line */ + + for (i = 0; i < S3_CURSOR_HEIGHT; i++) { + msk = mskLine; + src = srcLine; + mskLine += wsrc; + srcLine += wsrc; + for (j = 0; j < S3_CURSOR_WIDTH / 32; j++) { + + unsigned long m, s; + + if (i < h && j < wsrc) + { + m = *msk++; + s = *src++; + xor = m & s; + and = ~m; + } + else + { + and = 0xffffffff; + xor = 0x00000000; + } + + S3AdjustBits32(and); + S3AdjustBits32(xor); +#define S3SwapNibbles(x) ((x) = (((x) & 0x0f0f0f0f) << 4 | \ + ((x) >> 4) & 0x0f0f0f0f)) + if (s3s->use_streams) + { + S3SwapNibbles(and); + S3SwapNibbles(xor); + } + *ram++ = (and & 0xffff) | (xor << 16); + *ram++ = (and >> 16) | (xor & 0xffff0000); + } + } + + _s3WaitIdle (s3); + + /* Set new color */ + _s3SetCursorColors (pScreen); + + /* Enable the cursor */ + s3SetImm (s3vga, s3_cursor_ms_x11, 0); + s3SetImm (s3vga, s3_cursor_enable, 1); + + /* Wait for VRetrace to make sure the position is read */ + _s3WaitVRetrace (s3vga); + + /* Move to new position */ + _s3MoveCursor (pScreen, x, y); +} + +static void +s3UnloadCursor (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + /* Disable cursor */ + s3SetImm (s3vga, s3_cursor_enable, 0); +} + +static Bool +s3RealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) +{ + SetupCursor(pScreen); + + if (!pScreenPriv->enabled) + return TRUE; + + /* miRecolorCursor does this */ + if (pCurPriv->pCursor == pCursor) + { + if (pCursor) + { + int x, y; + + miPointerPosition (&x, &y); + s3LoadCursor (pScreen, x, y); + } + } + return TRUE; +} + +static Bool +s3UnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) +{ + return TRUE; +} + +static void +s3SetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y) +{ + SetupCursor(pScreen); + + pCurPriv->pCursor = pCursor; + + if (!pScreenPriv->enabled) + return; + + if (pCursor) + s3LoadCursor (pScreen, x, y); + else + s3UnloadCursor (pScreen); +} + +miPointerSpriteFuncRec s3PointerSpriteFuncs = { + s3RealizeCursor, + s3UnrealizeCursor, + s3SetCursor, + s3MoveCursor, +}; + +static void +s3QueryBestSize (int class, + unsigned short *pwidth, unsigned short *pheight, + ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + switch (class) + { + case CursorShape: + if (*pwidth > pCurPriv->width) + *pwidth = pCurPriv->width; + if (*pheight > pCurPriv->height) + *pheight = pCurPriv->height; + if (*pwidth > pScreen->width) + *pwidth = pScreen->width; + if (*pheight > pScreen->height) + *pheight = pScreen->height; + break; + default: + fbQueryBestSize (class, pwidth, pheight, pScreen); + break; + } +} + +Bool +s3CursorInit (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + if (!s3s->cursor_base) + { + DRAW_DEBUG ((DEBUG_CURSOR,"Not enough screen memory for cursor %d", s3d->memory)); + pCurPriv->has_cursor = FALSE; + return FALSE; + } + + pCurPriv->width = S3_CURSOR_WIDTH; + pCurPriv->height= S3_CURSOR_HEIGHT; + pScreen->QueryBestSize = s3QueryBestSize; + miPointerInitialize (pScreen, + &s3PointerSpriteFuncs, + &kdPointerScreenFuncs, + FALSE); + pCurPriv->has_cursor = TRUE; + pCurPriv->pCursor = NULL; + return TRUE; +} + +void +s3CursorEnable (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + DRAW_DEBUG ((DEBUG_INIT, "s3CursorEnable")); + if (pCurPriv->has_cursor) + { + if (pCurPriv->pCursor) + { + int x, y; + + miPointerPosition (&x, &y); + s3LoadCursor (pScreen, x, y); + } + else + s3UnloadCursor (pScreen); + } +} + +void +s3CursorDisable (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + if (!pScreenPriv->enabled) + return; + + if (pCurPriv->has_cursor) + { + if (pCurPriv->pCursor) + { + s3UnloadCursor (pScreen); + } + } +} + +void +s3CursorFini (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + pCurPriv->pCursor = NULL; +} --- xorg-server-1.4.2.orig/hw/kdrive/savage/s3reg.c +++ xorg-server-1.4.2/hw/kdrive/savage/s3reg.c @@ -0,0 +1,1301 @@ +/* + * Copyright 1999 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_CONFIG_H +#include +#endif +#include "s3reg.h" + +#define CR00 S3_CR+0x00 +#define CR01 S3_CR+0x01 +#define CR02 S3_CR+0x02 +#define CR03 S3_CR+0x03 +#define CR04 S3_CR+0x04 +#define CR05 S3_CR+0x05 +#define CR06 S3_CR+0x06 +#define CR07 S3_CR+0x07 +#define CR08 S3_CR+0x08 +#define CR09 S3_CR+0x09 +#define CR0A S3_CR+0x0A +#define CR0B S3_CR+0x0B +#define CR0C S3_CR+0x0C +#define CR0D S3_CR+0x0D +#define CR0E S3_CR+0x0E +#define CR0F S3_CR+0x0F +#define CR10 S3_CR+0x10 +#define CR11 S3_CR+0x11 +#define CR12 S3_CR+0x12 +#define CR13 S3_CR+0x13 +#define CR14 S3_CR+0x14 +#define CR15 S3_CR+0x15 +#define CR16 S3_CR+0x16 +#define CR17 S3_CR+0x17 +#define CR18 S3_CR+0x18 +#define CR19 S3_CR+0x19 +#define CR1A S3_CR+0x1A +#define CR1B S3_CR+0x1B +#define CR1C S3_CR+0x1C +#define CR1D S3_CR+0x1D +#define CR1E S3_CR+0x1E +#define CR1F S3_CR+0x1F +#define CR20 S3_CR+0x20 +#define CR21 S3_CR+0x21 +#define CR22 S3_CR+0x22 +#define CR23 S3_CR+0x23 +#define CR24 S3_CR+0x24 +#define CR25 S3_CR+0x25 +#define CR26 S3_CR+0x26 +#define CR27 S3_CR+0x27 +#define CR28 S3_CR+0x28 +#define CR29 S3_CR+0x29 +#define CR2A S3_CR+0x2A +#define CR2B S3_CR+0x2B +#define CR2C S3_CR+0x2C +#define CR2D S3_CR+0x2D +#define CR2E S3_CR+0x2E +#define CR2F S3_CR+0x2F +#define CR30 S3_CR+0x30 +#define CR31 S3_CR+0x31 +#define CR32 S3_CR+0x32 +#define CR33 S3_CR+0x33 +#define CR34 S3_CR+0x34 +#define CR35 S3_CR+0x35 +#define CR36 S3_CR+0x36 +#define CR37 S3_CR+0x37 +#define CR38 S3_CR+0x38 +#define CR39 S3_CR+0x39 +#define CR3A S3_CR+0x3A +#define CR3B S3_CR+0x3B +#define CR3C S3_CR+0x3C +#define CR3D S3_CR+0x3D +#define CR3E S3_CR+0x3E +#define CR3F S3_CR+0x3F +#define CR40 S3_CR+0x40 +#define CR41 S3_CR+0x41 +#define CR42 S3_CR+0x42 +#define CR43 S3_CR+0x43 +#define CR44 S3_CR+0x44 +#define CR45 S3_CR+0x45 +#define CR46 S3_CR+0x46 +#define CR47 S3_CR+0x47 +#define CR48 S3_CR+0x48 +#define CR49 S3_CR+0x49 +#define CR4A S3_CR+0x4A +#define CR4B S3_CR+0x4B +#define CR4C S3_CR+0x4C +#define CR4D S3_CR+0x4D +#define CR4E S3_CR+0x4E +#define CR4F S3_CR+0x4F +#define CR50 S3_CR+0x50 +#define CR51 S3_CR+0x51 +#define CR52 S3_CR+0x52 +#define CR53 S3_CR+0x53 +#define CR54 S3_CR+0x54 +#define CR55 S3_CR+0x55 +#define CR56 S3_CR+0x56 +#define CR57 S3_CR+0x57 +#define CR58 S3_CR+0x58 +#define CR59 S3_CR+0x59 +#define CR5A S3_CR+0x5A +#define CR5B S3_CR+0x5B +#define CR5C S3_CR+0x5C +#define CR5D S3_CR+0x5D +#define CR5E S3_CR+0x5E +#define CR5F S3_CR+0x5F +#define CR60 S3_CR+0x60 +#define CR61 S3_CR+0x61 +#define CR62 S3_CR+0x62 +#define CR63 S3_CR+0x63 +#define CR64 S3_CR+0x64 +#define CR65 S3_CR+0x65 +#define CR66 S3_CR+0x66 +#define CR67 S3_CR+0x67 +#define CR68 S3_CR+0x68 +#define CR69 S3_CR+0x69 +#define CR6A S3_CR+0x6A +#define CR6B S3_CR+0x6B +#define CR6C S3_CR+0x6C +#define CR6D S3_CR+0x6D +#define CR6E S3_CR+0x6E +#define CR6F S3_CR+0x6F +#define CR70 S3_CR+0x70 +#define CR71 S3_CR+0x71 +#define CR72 S3_CR+0x72 +#define CR73 S3_CR+0x73 +#define CR74 S3_CR+0x74 +#define CR75 S3_CR+0x75 +#define CR76 S3_CR+0x76 +#define CR77 S3_CR+0x77 +#define CR78 S3_CR+0x78 +#define CR79 S3_CR+0x79 +#define CR7A S3_CR+0x7A +#define CR7B S3_CR+0x7B +#define CR7C S3_CR+0x7C +#define CR7D S3_CR+0x7D +#define CR7E S3_CR+0x7E +#define CR7F S3_CR+0x7F +#define CR80 S3_CR+0x80 +#define CR81 S3_CR+0x81 +#define CR82 S3_CR+0x82 +#define CR83 S3_CR+0x83 +#define CR84 S3_CR+0x84 +#define CR85 S3_CR+0x85 +#define CR86 S3_CR+0x86 +#define CR87 S3_CR+0x87 +#define CR88 S3_CR+0x88 +#define CR89 S3_CR+0x89 +#define CR8A S3_CR+0x8A +#define CR8B S3_CR+0x8B +#define CR8C S3_CR+0x8C +#define CR8D S3_CR+0x8D +#define CR8E S3_CR+0x8E +#define CR8F S3_CR+0x8F +#define CR90 S3_CR+0x90 +#define CR91 S3_CR+0x91 +#define CR92 S3_CR+0x92 +#define CR93 S3_CR+0x93 +#define CR94 S3_CR+0x94 +#define CR95 S3_CR+0x95 +#define CR96 S3_CR+0x96 +#define CR97 S3_CR+0x97 +#define CR98 S3_CR+0x98 +#define CR99 S3_CR+0x99 +#define CR9A S3_CR+0x9A +#define CR9B S3_CR+0x9B +#define CR9C S3_CR+0x9C +#define CR9D S3_CR+0x9D +#define CR9E S3_CR+0x9E +#define CR9F S3_CR+0x9F +#define CRA0 S3_CR+0xA0 +#define CRA1 S3_CR+0xA1 +#define CRA2 S3_CR+0xA2 +#define CRA3 S3_CR+0xA3 +#define CRA4 S3_CR+0xA4 +#define CRA5 S3_CR+0xA5 +#define CRA6 S3_CR+0xA6 +#define CRA7 S3_CR+0xA7 +#define CRA8 S3_CR+0xA8 +#define CRA9 S3_CR+0xA9 +#define CRAA S3_CR+0xAA +#define CRAB S3_CR+0xAB +#define CRAC S3_CR+0xAC +#define CRAD S3_CR+0xAD +#define CRAE S3_CR+0xAE +#define CRAF S3_CR+0xAF +#define CRB0 S3_CR+0xB0 +#define CRB1 S3_CR+0xB1 +#define CRB2 S3_CR+0xB2 +#define CRB3 S3_CR+0xB3 +#define CRB4 S3_CR+0xB4 +#define CRB5 S3_CR+0xB5 +#define CRB6 S3_CR+0xB6 +#define CRB7 S3_CR+0xB7 +#define CRB8 S3_CR+0xB8 +#define CRB9 S3_CR+0xB9 +#define CRBA S3_CR+0xBA +#define CRBB S3_CR+0xBB +#define CRBC S3_CR+0xBC +#define CRBD S3_CR+0xBD +#define CRBE S3_CR+0xBE +#define CRBF S3_CR+0xBF + +#define CR_FIRST CR00 + +VgaReg s3_h_total[] = { + CR00, 0, 8, + CR5D, 0, 1, + CR5F, 0, 2, + VGA_REG_END +}; + +VgaReg s3_h_display_end[] = { + CR01, 0, 8, + CR5D, 1, 1, + CR5F, 2, 2, + VGA_REG_END +}; + +VgaReg s3_h_blank_start[] = { + CR02, 0, 8, + CR5D, 2, 1, + CR5F, 4, 2, + VGA_REG_END +}; + +VgaReg s3_h_blank_end[] = { + CR03, 0, 5, + CR05, 7, 1, + VGA_REG_END +}; + +VgaReg s3_display_skew[] = { + CR03, 5, 2, + VGA_REG_END +}; + +VgaReg s3_h_sync_start[] = { + CR04, 0, 8, + CR5D, 4, 1, + CR5F, 6, 2, + VGA_REG_END +}; + +VgaReg s3_h_sync_end[] = { + CR05, 0, 5, + VGA_REG_END +}; + +VgaReg s3_h_skew[] = { + CR05, 5, 2, + VGA_REG_END +}; + +VgaReg s3_v_total[] = { + CR06, 0, 8, + CR07, 0, 1, + CR07, 5, 1, + CR5E, 0, 1, + VGA_REG_END +}; + +VgaReg s3_preset_row_scan[] = { + CR08, 0, 8, + VGA_REG_END +}; + +VgaReg s3_max_scan_line[] = { + CR09, 0, 5, + VGA_REG_END +}; + +VgaReg s3_start_address[] = { + CR0D, 0, 8, + CR0C, 0, 8, + CR69, 0, 7, + VGA_REG_END +}; + +VgaReg s3_v_retrace_start[] = { + CR10, 0, 8, + CR07, 2, 1, + CR07, 7, 1, + CR5E, 4, 1, + VGA_REG_END +}; + +VgaReg s3_v_retrace_end[] = { + CR11, 0, 4, + VGA_REG_END +}; + +VgaReg s3_clear_v_retrace_int[] = { + CR11, 4, 1, + VGA_REG_END +}; + +VgaReg s3_disable_v_retrace_int[] = { + CR11, 5, 1, + VGA_REG_END +}; + +VgaReg s3_lock_crtc[] = { + CR11, 7, 1, + VGA_REG_END +}; + +VgaReg s3_v_display_end[] = { + CR12, 0, 8, + CR07, 1, 1, + CR07, 6, 1, + CR5E, 1, 1, + VGA_REG_END +}; + +VgaReg s3_screen_offset[] = { + CR13, 0, 8, + CR51, 4, 2, + VGA_REG_END +}; + +VgaReg s3_count_by_4_mode[] = { + CR14, 5, 1, + VGA_REG_END +}; + +VgaReg s3_doubleword_mode[] = { + CR14, 6, 1, + VGA_REG_END +}; + +VgaReg s3_v_blank_start[] = { + CR15, 0, 8, + CR07, 3, 1, + CR09, 5, 1, + CR5E, 2, 1, + VGA_REG_END +}; + +VgaReg s3_v_blank_end[] = { + CR16, 0, 8, + VGA_REG_END +}; + +VgaReg s3_2bk_cga[] = { + CR17, 0, 1, + VGA_REG_END +}; + +VgaReg s3_4bk_hga[] = { + CR17, 1, 1, + VGA_REG_END +}; + +VgaReg s3_v_total_double[] = { + CR17, 2, 1, + VGA_REG_END +}; + +VgaReg s3_word_mode[] = { + CR17, 3, 1, + VGA_REG_END +}; + +VgaReg s3_address_16k_wrap[] = { + CR17, 5, 1, + VGA_REG_END +}; + +VgaReg s3_byte_mode[] = { + CR17, 6, 1, + VGA_REG_END +}; + +VgaReg s3_hardware_reset[] = { + CR17, 7, 1, + VGA_REG_END +}; + +VgaReg s3_line_compare[] = { + CR18, 0, 8, + CR07, 4, 1, + CR09, 6, 1, + CR5E, 6, 1, + VGA_REG_END +}; + +VgaReg s3_delay_primary_load[] = { + CR21, 1, 1, + VGA_REG_END +}; + +VgaReg s3_device_id[] = { + CR2E, 0, 8, + CR2D, 0, 8, + VGA_REG_END +}; + +VgaReg s3_revision[] = { + CR2F, 0, 8, + VGA_REG_END +}; + +VgaReg s3_enable_vga_16bit[] = { + CR31, 2, 1, + VGA_REG_END +}; + +VgaReg s3_enhanced_memory_mapping[] = { + CR31, 3, 1, + VGA_REG_END +}; + +VgaReg s3_lock_dac_writes[] = { + CR33, 4, 1, + VGA_REG_END +}; + +VgaReg s3_border_select[] = { + CR33, 5, 1, + VGA_REG_END +}; + +VgaReg s3_lock_palette[] = { + CR33, 6, 1, + VGA_REG_END +}; + +VgaReg s3_enable_sff[] = { + CR34, 4, 1, + VGA_REG_END +}; + +VgaReg s3_lock_vert[] = { + CR35, 4, 1, + VGA_REG_END +}; + +VgaReg s3_lock_horz[] = { + CR35, 5, 1, + VGA_REG_END +}; + +VgaReg s3_io_disable[] = { + CR36, 4, 1, + VGA_REG_END +}; + +VgaReg s3_mem_size[] = { + CR36, 5, 3, + VGA_REG_END +}; + +VgaReg s3_register_lock_1 [] = { + CR38, 0, 8, /* load with 0x48 */ + VGA_REG_END +}; + +VgaReg s3_register_lock_2 [] = { + CR39, 0, 8, /* load with 0xa0 */ + VGA_REG_END +}; + +VgaReg s3_refresh_control[] = { + CR3A, 0, 2, + VGA_REG_END +}; + +VgaReg s3_enable_256[] = { + CR3A, 4, 1, + VGA_REG_END +}; + +VgaReg s3_disable_pci_read_bursts[] = { + CR3A, 7, 1, + VGA_REG_END +}; + +VgaReg s3_h_start_fifo_fetch[] = { + CR3B, 0, 8, + CR5D, 6, 1, + CR5B, 2, 2, + VGA_REG_END +}; + +VgaReg s3_enable_2d_access[] = { + CR40, 0, 1, + VGA_REG_END +}; + +VgaReg s3_interlace[] = { + CR42, 5, 1, + VGA_REG_END +}; + +VgaReg s3_old_screen_off_8[] = { + CR43, 2, 1, + VGA_REG_END +}; + +VgaReg s3_h_counter_double_mode[] = { + CR43, 7, 1, + VGA_REG_END +}; + +VgaReg s3_cursor_enable[] = { + CR45, 0, 1, + VGA_REG_END +}; + +VgaReg s3_cursor_right[] = { + CR45, 4, 1, + VGA_REG_END +}; + +VgaReg s3_cursor_xhigh[] = { + CR46, 0, 3, + VGA_REG_END +}; + +VgaReg s3_cursor_xlow[] = { + CR47, 0, 8, + VGA_REG_END +}; + +VgaReg s3_cursor_yhigh[] = { + CR48, 0, 3, + VGA_REG_END +}; + +VgaReg s3_cursor_ylow[] = { + CR49, 0, 8, + VGA_REG_END +}; + +VgaReg s3_cursor_fg[] = { + CR4A, 0, 8, + VGA_REG_END +}; + +VgaReg s3_cursor_bg[] = { + CR4B, 0, 8, + VGA_REG_END +}; + +VgaReg s3_cursor_address[] = { + CR4D, 0, 8, + CR4C, 0, 8, + VGA_REG_END +}; + +VgaReg s3_cursor_xoff[] = { + CR4E, 0, 6, + VGA_REG_END +}; + +VgaReg s3_cursor_yoff[] = { + CR4F, 0, 6, + VGA_REG_END +}; + +VgaReg s3_ge_screen_width[] = { + CR50, 6, 2, + CR50, 0, 1, + VGA_REG_END +}; + +VgaReg s3_pixel_length[] = { + CR50, 4, 2, + VGA_REG_END +}; + +VgaReg s3_big_endian_linear[] = { + CR53, 1, 2, + VGA_REG_END +}; + +VgaReg s3_mmio_select[] = { + CR53, 3, 2, + VGA_REG_END +}; + +VgaReg s3_mmio_window[] = { + CR53, 5, 1, + VGA_REG_END +}; + +VgaReg s3_swap_nibbles[] = { + CR53, 6, 1, + VGA_REG_END +}; + +VgaReg s3_cursor_ms_x11[] = { + CR55, 4, 1, + VGA_REG_END +}; + +VgaReg s3_linear_window_size[] = { + CR58, 0, 2, + VGA_REG_END +}; + +VgaReg s3_enable_linear[] = { + CR58, 4, 1, + VGA_REG_END +}; + +VgaReg s3_h_blank_extend[] = { + CR5D, 3, 1, + VGA_REG_END +}; + +VgaReg s3_h_sync_extend[] = { + CR5D, 5, 1, + VGA_REG_END +}; + +VgaReg s3_sdclk_skew[] = { + CR60, 0, 4, + VGA_REG_END +}; + +VgaReg s3_delay_blank[] = { + CR65, 3, 2, + VGA_REG_END +}; + +VgaReg s3_delay_h_enable[] = { + CR65, 6, 2, + CR65, 0, 1, + VGA_REG_END +}; + +VgaReg s3_enable_2d_3d[] = { + CR66, 0, 1, + VGA_REG_END +}; + +VgaReg s3_pci_disconnect_enable[] = { + CR66, 3, 1, + VGA_REG_END +}; + +VgaReg s3_primary_load_control[] = { + CR66, 4, 1, + VGA_REG_END +}; + +VgaReg s3_secondary_load_control[] = { + CR66, 5, 1, + VGA_REG_END +}; + +VgaReg s3_pci_retry_enable[] = { + CR66, 7, 1, + VGA_REG_END +}; + +VgaReg s3_streams_mode[] = { + CR67, 2, 2, + VGA_REG_END +}; + +VgaReg s3_color_mode[] = { + CR67, 4, 4, + VGA_REG_END +}; + +VgaReg s3_primary_stream_definition[] = { + CR69, 7, 1, + VGA_REG_END +}; + +VgaReg s3_primary_stream_timeout[] = { + CR71, 0, 8, + VGA_REG_END +}; + +VgaReg s3_master_control_unit_timeout[] = { + CR74, 0, 8, + VGA_REG_END +}; + +VgaReg s3_command_buffer_timeout[] = { + CR75, 0, 8, + VGA_REG_END +}; + +VgaReg s3_lpb_timeout[] = { + CR76, 0, 8, + VGA_REG_END +}; + +VgaReg s3_cpu_timeout[] = { + CR78, 0, 8, + VGA_REG_END +}; + +VgaReg s3_2d_graphics_engine_timeout[] = { + CR79, 0, 8, + VGA_REG_END +}; + +VgaReg s3_fifo_drain_delay[] = { + CR85, 0, 3, + VGA_REG_END +}; + +VgaReg s3_fifo_fetch_timing[] = { + CR85, 4, 1, + VGA_REG_END +}; + +VgaReg s3_dac_power_up_time[] = { + CR86, 0, 7, + VGA_REG_END +}; + +VgaReg s3_dac_power_saving_disable[] = { + CR86, 7, 1, + VGA_REG_END +}; + +VgaReg s3_flat_panel_output_control_1[] = { + CR90, 3, 1, + VGA_REG_END +}; + +VgaReg s3_streams_fifo_delay[] = { + CR90, 4, 2, + VGA_REG_END +}; + +VgaReg s3_flat_panel_output_control_2[] = { + CR90, 6, 1, + VGA_REG_END +}; + +VgaReg s3_enable_l1_parameter[] = { + CR90, 7, 1, + VGA_REG_END +}; + +VgaReg s3_primary_stream_l1[] = { + CR91, 0, 8, + CR90, 0, 3, + VGA_REG_END +}; + +#define CR_LAST CR91 + +#define SR00 S3_SR+0x00 +#define SR01 S3_SR+0x01 +#define SR02 S3_SR+0x02 +#define SR03 S3_SR+0x03 +#define SR04 S3_SR+0x04 +#define SR05 S3_SR+0x05 +#define SR06 S3_SR+0x06 +#define SR07 S3_SR+0x07 +#define SR08 S3_SR+0x08 +#define SR09 S3_SR+0x09 +#define SR0A S3_SR+0x0A +#define SR0B S3_SR+0x0B +#define SR0C S3_SR+0x0C +#define SR0D S3_SR+0x0D +#define SR0E S3_SR+0x0E +#define SR0F S3_SR+0x0F +#define SR10 S3_SR+0x10 +#define SR11 S3_SR+0x11 +#define SR12 S3_SR+0x12 +#define SR13 S3_SR+0x13 +#define SR14 S3_SR+0x14 +#define SR15 S3_SR+0x15 +#define SR16 S3_SR+0x16 +#define SR17 S3_SR+0x17 +#define SR18 S3_SR+0x18 +#define SR19 S3_SR+0x19 +#define SR1A S3_SR+0x1A +#define SR1B S3_SR+0x1B +#define SR1C S3_SR+0x1C +#define SR1D S3_SR+0x1D +#define SR1E S3_SR+0x1E +#define SR1F S3_SR+0x1F +#define SR20 S3_SR+0x20 +#define SR21 S3_SR+0x21 +#define SR22 S3_SR+0x22 +#define SR23 S3_SR+0x23 +#define SR24 S3_SR+0x24 +#define SR25 S3_SR+0x25 +#define SR26 S3_SR+0x26 +#define SR27 S3_SR+0x27 +#define SR28 S3_SR+0x28 +#define SR29 S3_SR+0x29 +#define SR2A S3_SR+0x2A +#define SR2B S3_SR+0x2B +#define SR2C S3_SR+0x2C +#define SR2D S3_SR+0x2D +#define SR2E S3_SR+0x2E +#define SR2F S3_SR+0x2F +#define SR30 S3_SR+0x30 +#define SR31 S3_SR+0x31 +#define SR32 S3_SR+0x32 +#define SR33 S3_SR+0x33 +#define SR34 S3_SR+0x34 +#define SR35 S3_SR+0x35 +#define SR36 S3_SR+0x36 +#define SR37 S3_SR+0x37 +#define SR38 S3_SR+0x38 +#define SR39 S3_SR+0x39 +#define SR3A S3_SR+0x3A +#define SR3B S3_SR+0x3B +#define SR3C S3_SR+0x3C +#define SR3D S3_SR+0x3D +#define SR3E S3_SR+0x3E +#define SR3F S3_SR+0x3F +#define SR40 S3_SR+0x40 +#define SR41 S3_SR+0x41 +#define SR42 S3_SR+0x42 +#define SR43 S3_SR+0x43 +#define SR44 S3_SR+0x44 +#define SR45 S3_SR+0x45 +#define SR46 S3_SR+0x46 +#define SR47 S3_SR+0x47 +#define SR48 S3_SR+0x48 +#define SR49 S3_SR+0x49 +#define SR4A S3_SR+0x4A +#define SR4B S3_SR+0x4B +#define SR4C S3_SR+0x4C +#define SR4D S3_SR+0x4D +#define SR4E S3_SR+0x4E +#define SR4F S3_SR+0x4F +#define SR50 S3_SR+0x50 +#define SR51 S3_SR+0x51 +#define SR52 S3_SR+0x52 +#define SR53 S3_SR+0x53 +#define SR54 S3_SR+0x54 +#define SR55 S3_SR+0x55 +#define SR56 S3_SR+0x56 +#define SR57 S3_SR+0x57 +#define SR58 S3_SR+0x58 +#define SR59 S3_SR+0x59 +#define SR5A S3_SR+0x5A +#define SR5B S3_SR+0x5B +#define SR5C S3_SR+0x5C +#define SR5D S3_SR+0x5D +#define SR5E S3_SR+0x5E +#define SR5F S3_SR+0x5F +#define SR60 S3_SR+0x60 +#define SR61 S3_SR+0x61 +#define SR62 S3_SR+0x62 +#define SR63 S3_SR+0x63 +#define SR64 S3_SR+0x64 +#define SR65 S3_SR+0x65 +#define SR66 S3_SR+0x66 +#define SR67 S3_SR+0x67 +#define SR68 S3_SR+0x68 +#define SR69 S3_SR+0x69 +#define SR6A S3_SR+0x6A +#define SR6B S3_SR+0x6B +#define SR6C S3_SR+0x6C +#define SR6D S3_SR+0x6D +#define SR6E S3_SR+0x6E +#define SR6F S3_SR+0x6F + +#define SR_FIRST SR02 + +VgaReg s3_dot_clock_8[] = { + SR01, 0, 1, + VGA_REG_END +}; + +VgaReg s3_screen_off[] = { + SR01, 5, 1, + VGA_REG_END +}; + +VgaReg s3_enable_write_plane[] = { + SR02, 0, 4, + VGA_REG_END +}; + +VgaReg s3_extended_memory_access[] = { + SR04, 1, 1, + VGA_REG_END +}; + +VgaReg s3_sequential_addressing_mode[] = { + SR04, 2, 1, + VGA_REG_END +}; + +VgaReg s3_select_chain_4_mode[] = { + SR04, 3, 1, + VGA_REG_END +}; + +VgaReg s3_unlock_extended_sequencer[] = { + SR08, 0, 8, /* write 0x06 */ + VGA_REG_END +}; + +VgaReg s3_linear_addressing_control[] = { + SR09, 0, 1, + VGA_REG_END +}; + +VgaReg s3_disable_io_ports[] = { + SR09, 7, 1, + VGA_REG_END +}; + +VgaReg s3_hsync_control[] = { + SR0D, 4, 2, + VGA_REG_END +}; + +VgaReg s3_vsync_control[] = { + SR0D, 6, 2, + VGA_REG_END +}; + +VgaReg s3_mclk_n[] = { + SR10, 0, 5, + VGA_REG_END +}; + +VgaReg s3_mclk_r[] = { + SR10, 5, 2, + VGA_REG_END +}; + +VgaReg s3_mclk_m[] = { + SR11, 0, 7, + VGA_REG_END +}; + +VgaReg s3_dclk_n[] = { + SR12, 0, 6, + SR29, 4, 1, + VGA_REG_END +}; + +VgaReg s3_dclk_r[] = { + SR12, 6, 2, + SR29, 2, 1, + VGA_REG_END +}; + +VgaReg s3_dclk_m[] = { + SR13, 0, 8, + SR29, 3, 1, + VGA_REG_END +}; + +VgaReg s3_mclk_load[] = { + SR15, 0, 1, + VGA_REG_END +}; + +VgaReg s3_dclk_load[] = { + SR15, 1, 1, + VGA_REG_END +}; + +VgaReg s3_dclk_over_2[] = { + SR15, 4, 1, + VGA_REG_END +}; + +VgaReg s3_clock_load_imm[] = { + SR15, 5, 1, + VGA_REG_END +}; + +VgaReg s3_dclk_invert[] = { + SR15, 6, 1, + VGA_REG_END +}; + +VgaReg s3_enable_clock_double[] = { + SR18, 7, 1, + VGA_REG_END +}; + +VgaReg s3_dclk_double_15_16_invert[] = { + SR1A, 0, 1, + VGA_REG_END +}; + +VgaReg s3_enable_gamma_correction[] = { + SR1B, 3, 1, + VGA_REG_END +}; + +VgaReg s3_enable_8_bit_luts[] = { + SR1B, 4, 1, + VGA_REG_END +}; + +VgaReg s3_dclk_control[] = { + SR1B, 7, 1, + VGA_REG_END +}; + +VgaReg s3_eclk_n[] = { + SR32, 0, 5, + VGA_REG_END +}; + +VgaReg s3_eclk_r[] = { + SR32, 5, 2, + VGA_REG_END +}; + +VgaReg s3_eclk_m[] = { + SR32, 0, 5, + VGA_REG_END +}; + +VgaReg s3_vga_dclk_n[] = { + SR36, 0, 6, + SR39, 4, 1, + VGA_REG_END +}; + +VgaReg s3_vga_dclk_r[] = { + SR36, 6, 2, + SR39, 2, 1, + VGA_REG_END +}; + +VgaReg s3_vga_dclk_m1[] = { + SR37, 0, 8, + SR39, 3, 1, + VGA_REG_END +}; + +VgaReg s3_vga_dclk_m2[] = { + SR38, 0, 8, + SR39, 3, 1, + VGA_REG_END +}; + +VgaReg s3_vga_clk_select[] = { + SR39, 0, 1, + VGA_REG_END +}; + +#define SR_LAST SR39 + +#define AR00 (S3_AR+0x00) +#define AR10 (S3_AR+0x10) +#define AR11 (S3_AR+0x11) +#define AR12 (S3_AR+0x12) +#define AR13 (S3_AR+0x13) +#define AR14 (S3_AR+0x14) + +#define AR_FIRST AR00 + +VgaReg s3_select_graphics_mode[] = { + AR10, 0, 1, + VGA_REG_END +}; + +VgaReg s3_enable_blinking[] = { + AR10, 3, 1, + VGA_REG_END +}; + +VgaReg s3_border_color[] = { + AR11, 0, 8, + VGA_REG_END +}; + +#define AR_LAST AR11 + +VgaReg s3_io_addr_select[] = { + S3_MISC_OUT, 0, 1, + VGA_REG_END +}; + +VgaReg s3_enable_ram[] = { + S3_MISC_OUT, 1, 1, + VGA_REG_END +}; + +VgaReg s3_clock_select[] = { + S3_MISC_OUT, 2, 2, + VGA_REG_END +}; + +VgaReg s3_horz_sync_neg[] = { + S3_MISC_OUT, 6, 1, + VGA_REG_END +}; + +VgaReg s3_vert_sync_neg[] = { + S3_MISC_OUT, 7, 1, + VGA_REG_END +}; + +VgaReg s3_display_mode_inactive[] = { + S3_INPUT_STATUS_1, 0, 1, + VGA_REG_END +}; + +VgaReg s3_vertical_sync_active[] = { + S3_INPUT_STATUS_1, 3, 1, + VGA_REG_END +}; + +VgaReg s3_dac_mask[] = { + S3_DAC + 0, 0, 8, + VGA_REG_END +}; + +VgaReg s3_dac_read_index[] = { + S3_DAC + 1, 0, 8, + VGA_REG_END +}; + +VgaReg s3_dac_write_index[] = { + S3_DAC + 2, 0, 8, + VGA_REG_END +}; + +VgaReg s3_dac_data[] = { + S3_DAC + 3, 0, 8, + VGA_REG_END +}; + +VGA8 +_s3Inb (VgaCard *card, VGA16 port) +{ + VGAVOL8 *reg; + + if (card->closure) + return VgaReadMemb ((VGA32) card->closure + port); + else + return VgaInb (port); +} + +void +_s3Outb (VgaCard *card, VGA8 value, VGA16 port) +{ + if (card->closure) + VgaWriteMemb (value, (VGA32) card->closure + port); + else + VgaOutb (value, port); +} + +void +_s3RegMap (VgaCard *card, VGA16 reg, VgaMap *map, VGABOOL write) +{ + + if (reg < S3_SR + S3_NSR) + { + map->access = VgaAccessIndIo; + map->port = 0x3c4; + map->addr = 0; + map->value = 1; + map->index = reg - S3_SR; + } + else if (reg < S3_GR + S3_NGR) + { + map->access = VgaAccessIndIo; + map->port = 0x3ce; + map->addr = 0; + map->value = 1; + map->index = reg - S3_GR; + } + else if (reg < S3_AR + S3_NAR) + { + reg -= S3_AR; + map->access = VgaAccessDone; + /* reset AFF to index */ + (void) _s3Inb (card, 0x3da); + if (reg >= 16) + reg |= 0x20; + _s3Outb (card, reg, 0x3c0); + if (write) + _s3Outb (card, map->value, 0x3c0); + else + map->value = _s3Inb (card, 0x3c1); + if (!(reg & 0x20)) + { + /* enable video display again */ + (void) _s3Inb (card, 0x3da); + _s3Outb (card, 0x20, 0x3c0); + } + return; + } + else if (reg < S3_CR + S3_NCR) + { + map->access = VgaAccessIndIo; + map->port = 0x3d4; + map->addr = 0; + map->value = 1; + map->index = reg - S3_CR; + } + else if (reg < S3_DAC + S3_NDAC) + { + map->access = VgaAccessIo; + map->port = 0x3c6 + reg - S3_DAC; + } + else switch (reg) { + case S3_MISC_OUT: + map->access = VgaAccessIo; + if (write) + map->port = 0x3c2; + else + map->port = 0x3cc; + break; + case S3_INPUT_STATUS_1: + map->access = VgaAccessIo; + map->port = 0x3da; + break; + } + if (card->closure) + { + map->port = map->port + (VGA32) card->closure; + if (map->access == VgaAccessIo) + map->access = VgaAccessMem; + if (map->access == VgaAccessIndIo) + map->access = VgaAccessIndMem; + } +} + +VgaSave s3Saves[] = { + CR_FIRST, CR18, + CR31, CR_LAST, + SR_FIRST, SR15, + SR18, SR_LAST, + AR_FIRST, AR_LAST, + S3_MISC_OUT, S3_MISC_OUT, + VGA_SAVE_END +}; + +void +s3RegInit (S3Vga *s3vga, VGAVOL8 *mmio) +{ + s3vga->card.map = _s3RegMap; + s3vga->card.closure = (void *) mmio; + s3vga->card.max = S3_NREG; + s3vga->card.values = s3vga->values; + s3vga->card.saves = s3Saves; +} + +void +s3Save (S3Vga *s3vga) +{ + s3vga->save_lock_crtc = s3Get(s3vga, s3_lock_crtc); + s3SetImm (s3vga, s3_lock_crtc, 0); + s3vga->save_register_lock_1 = s3Get (s3vga, s3_register_lock_1); + s3SetImm (s3vga, s3_register_lock_1, 0x48); + s3vga->save_register_lock_2 = s3Get (s3vga, s3_register_lock_2); + s3SetImm (s3vga, s3_register_lock_2, 0xa5); + s3vga->save_unlock_extended_sequencer = s3Get (s3vga, s3_unlock_extended_sequencer); + s3SetImm (s3vga, s3_unlock_extended_sequencer, 0x06); + s3vga->save_lock_horz = s3Get (s3vga, s3_lock_horz); + s3SetImm (s3vga, s3_lock_horz, 0); + s3vga->save_lock_vert = s3Get (s3vga, s3_lock_vert); + s3SetImm (s3vga, s3_lock_vert, 0); + s3vga->save_dot_clock_8 = s3Get (s3vga, s3_dot_clock_8); + VgaPreserve (&s3vga->card); +} + +void +s3Reset (S3Vga *s3vga) +{ + VgaRestore (&s3vga->card); + s3SetImm (s3vga, s3_clock_load_imm, 1); + s3SetImm (s3vga, s3_clock_load_imm, 0); + s3SetImm (s3vga, s3_dot_clock_8, s3vga->save_dot_clock_8); + s3SetImm (s3vga, s3_lock_vert, s3vga->save_lock_vert); + s3SetImm (s3vga, s3_lock_horz, s3vga->save_lock_horz); + s3SetImm (s3vga, s3_lock_dac_writes, s3vga->save_lock_dac_writes); + s3SetImm (s3vga, s3_unlock_extended_sequencer, s3vga->save_unlock_extended_sequencer); + s3SetImm (s3vga, s3_register_lock_2, s3vga->save_register_lock_2); + s3SetImm (s3vga, s3_register_lock_1, s3vga->save_register_lock_1); + s3SetImm (s3vga, s3_lock_crtc, s3vga->save_lock_crtc); + VgaFinish (&s3vga->card); +} --- xorg-server-1.4.2.orig/hw/kdrive/savage/s3gc.c +++ xorg-server-1.4.2/hw/kdrive/savage/s3gc.c @@ -0,0 +1,299 @@ +/* + * Copyright 1999 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_CONFIG_H +#include +#endif +#include "s3.h" +#include "s3draw.h" + +#include "Xmd.h" +#include "gcstruct.h" +#include "scrnintstr.h" +#include "pixmapstr.h" +#include "regionstr.h" +#include "mistruct.h" +#include "fontstruct.h" +#include "dixfontstr.h" +#include "migc.h" + +/* + * Common op groups. Common assumptions: + * + * lineWidth 0 + * lineStyle LineSolid + * fillStyle FillSolid + * rop GXcopy + * font <= 32 pixels wide + */ + +/* TE font */ +static const GCOps s3TEOps = { + s3FillSpans, + KdCheckSetSpans, + KdCheckPutImage, + s3CopyArea, + s3CopyPlane, + KdCheckPolyPoint, + s3Polylines, + s3PolySegment, + KdCheckPolyRectangle, + KdCheckPolyArc, + s3FillPoly, + s3PolyFillRect, + s3PolyFillArcSolid, + miPolyText8, + miPolyText16, + miImageText8, + miImageText16, + s3ImageTEGlyphBlt, + s3PolyTEGlyphBlt, + s3PushPixels +}; + +/* Non TE font */ +static const GCOps s3NonTEOps = { + s3FillSpans, + KdCheckSetSpans, + KdCheckPutImage, + s3CopyArea, + s3CopyPlane, + KdCheckPolyPoint, + s3Polylines, + s3PolySegment, + KdCheckPolyRectangle, + KdCheckPolyArc, + s3FillPoly, + s3PolyFillRect, + s3PolyFillArcSolid, + miPolyText8, + miPolyText16, + miImageText8, + miImageText16, + s3ImageGlyphBlt, + s3PolyGlyphBlt, + s3PushPixels +}; + +static GCOps * +s3MatchCommon (DrawablePtr pDraw, GCPtr pGC, FbGCPrivPtr fbPriv) +{ + KdScreenPriv (pDraw->pScreen); + + if (!REGION_NOTEMPTY(pDraw->pScreen,fbGetCompositeClip(pGC))) + { + DRAW_DEBUG ((DEBUG_CLIP, "Empty composite clip, clipping all ops")); + return &kdNoopOps; + } + + if (pDraw->type != DRAWABLE_WINDOW) + return (GCOps *) &kdAsyncPixmapGCOps; + + if (pGC->lineWidth != 0) + return 0; + if (pGC->lineStyle != LineSolid) + return 0; + if (pGC->fillStyle != FillSolid) + return 0; + if (fbPriv->and != 0) + return 0; + if (pGC->font) + { + if (TERMINALFONT(pGC->font)) + return (GCOps *) &s3TEOps; + else + return (GCOps *) &s3NonTEOps; + } + return 0; +} + +void +s3ValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable) +{ + int new_type; /* drawable type has changed */ + int new_origin; + + /* flags for changing the proc vector */ + FbGCPrivPtr fbPriv; + s3PrivGCPtr s3Priv; + int oneRect; + GCOps *newops; + + fbPriv = fbGetGCPrivate(pGC); + s3Priv = s3GetGCPrivate(pGC); + + new_type = FALSE; + new_origin = FALSE; + + /* + * If the type of drawable has changed, fix up accelerated functions + */ + if (s3Priv->type != pDrawable->type) + { + new_type = TRUE; + s3Priv->type = pDrawable->type; + } + + /* + * Check tile/stipple origin + */ + if (pGC->lastWinOrg.x != pDrawable->x || pGC->lastWinOrg.y != pDrawable->y) + new_origin = TRUE; + + /* + * Call down to FB to set clip list and rrop values + */ + + fbValidateGC (pGC, changes, pDrawable); + + /* + * Check accelerated pattern if necessary + */ + if (changes & (GCFillStyle|GCStipple|GCTile)) + s3CheckGCFill (pGC); + else if (s3Priv->pPattern && + (new_origin || changes & (GCTileStipXOrigin|GCTileStipYOrigin))) + s3MoveGCFill (pGC); + + /* + * Try to match common vector + */ + + if (newops = s3MatchCommon (pDrawable, pGC, fbPriv)) + { + if (pGC->ops->devPrivate.val) + miDestroyGCOps (pGC->ops); + pGC->ops = newops; + return; + } + + /* + * No common vector matched, create private ops vector and + * fill it in + */ + if (!pGC->ops->devPrivate.val) + { + /* + * Switch from noop vector by first switching to fb + * vector and fixing it up + */ + if (pGC->ops == &kdNoopOps) + { + pGC->ops = (GCOps *) &kdAsyncPixmapGCOps; + new_type = TRUE; + } + pGC->ops = miCreateGCOps (pGC->ops); + pGC->ops->devPrivate.val = 1; + } + + /* + * Fills + */ + if (new_type || (changes & (GCFillStyle|GCTile|GCStipple))) + { + pGC->ops->FillSpans = KdCheckFillSpans; + pGC->ops->PolyFillRect = KdCheckPolyFillRect; + if (s3Priv->type == DRAWABLE_WINDOW && + (pGC->fillStyle != FillTiled || s3Priv->pPattern)) + { + pGC->ops->FillSpans = s3FillSpans; + pGC->ops->PolyFillRect = s3PolyFillRect; + } + } + + /* + * Blt + */ + if (new_type) + { + pGC->ops->CopyArea = s3CopyArea; + pGC->ops->CopyPlane = s3CopyPlane; + pGC->ops->PushPixels = s3PushPixels; + } + + /* + * Lines + */ + if (new_type || (changes & (GCLineStyle|GCLineWidth|GCFillStyle))) + { + pGC->ops->Polylines = KdCheckPolylines; + pGC->ops->PolySegment = KdCheckPolySegment; + if (pGC->lineStyle == LineSolid && + pGC->lineWidth == 0 && + pGC->fillStyle == FillSolid && + s3Priv->type == DRAWABLE_WINDOW) + { + pGC->ops->Polylines = s3Polylines; + pGC->ops->PolySegment = s3PolySegment; + } + } + + /* + * Polygons + */ + if (new_type || (changes & (GCFillStyle))) + { + pGC->ops->FillPolygon = KdCheckFillPolygon; + if (s3Priv->type == DRAWABLE_WINDOW && + pGC->fillStyle == FillSolid) + { + pGC->ops->FillPolygon = s3FillPoly; + } + } + + /* + * Filled arcs + */ + if (new_type || (changes & GCFillStyle)) + { + pGC->ops->PolyFillArc = KdCheckPolyFillArc; + if (s3Priv->type == DRAWABLE_WINDOW && + pGC->fillStyle == FillSolid) + { + pGC->ops->PolyFillArc = s3PolyFillArcSolid; + } + } + + /* + * Text + */ + if (new_type || (changes & (GCFont|GCFillStyle))) + { + pGC->ops->PolyGlyphBlt = KdCheckPolyGlyphBlt; + pGC->ops->ImageGlyphBlt = KdCheckImageGlyphBlt; + if (s3Priv->type == DRAWABLE_WINDOW && pGC->font) + { + if (pGC->fillStyle == FillSolid) + { + if (TERMINALFONT(pGC->font)) + pGC->ops->PolyGlyphBlt = s3PolyTEGlyphBlt; + else + pGC->ops->PolyGlyphBlt = s3PolyGlyphBlt; + } + if (TERMINALFONT(pGC->font)) + pGC->ops->ImageGlyphBlt = s3ImageTEGlyphBlt; + else + pGC->ops->ImageGlyphBlt = s3ImageGlyphBlt; + } + } +} --- xorg-server-1.4.2.orig/hw/kdrive/savage/s3.h +++ xorg-server-1.4.2/hw/kdrive/savage/s3.h @@ -0,0 +1,534 @@ +/* + * Copyright 1999 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 _S3_H_ +#define _S3_H_ + +#include "kdrive.h" +#include "s3reg.h" + +/* VESA Approved Register Definitions */ + +/* + * Linear Addressing 000 0000 - 0ff ffff (16m) + * Image data transfer 100 0000 - 100 7fff (32k) + * PCI config 100 8000 - 100 8043 + * Packed enhanced regs 100 8100 - 100 814a + * Streams regs 100 8180 - 100 81ff + * Current Y pos 100 82e8 + * CRT VGA 3b? regs 100 83b0 - 100 83bf + * CRT VGA 3c? regs 100 83c0 - 100 83cf + * CRT VGA 3d? regs 100 83d0 - 100 83df + * Subsystem status (42e8h) 100 8504 + * Advanced function (42e8h) 100 850c + * Enhanced regs 100 86e8 - 100 eeea + * Local peripheral bus 100 ff00 - 100 ff5c + * + * We don't care about the image transfer or PCI regs, so + * this structure starts at the packed enhanced regs + */ + +typedef volatile CARD32 VOL32; +typedef volatile CARD16 VOL16; +typedef volatile CARD8 VOL8; + +typedef volatile struct _s3 { + VOL32 alt_curxy; /* 8100 */ + VOL32 _pad0; /* 8104 */ + VOL32 alt_step; /* 8108 */ + VOL32 _pad1; /* 810c */ + VOL32 err_term; /* 8110 */ + VOL32 _pad2; /* 8114 */ + VOL32 cmd_gp_stat; /* 8118 */ + VOL32 short_stroke; /* 811c */ + VOL32 bg; /* 8120 */ + VOL32 fg; /* 8124 */ + VOL32 write_mask; /* 8128 */ + VOL32 read_mask; /* 812c */ + VOL32 color_cmp; /* 8130 */ + VOL32 alt_mix; /* 8134 */ + VOL32 scissors_tl; /* 8138 */ + VOL32 scissors_br; /* 813c */ +#if 0 + VOL16 pix_cntl; /* 8140 */ + VOL16 mult_misc2; /* 8142 */ +#else + VOL32 pix_cntl_mult_misc2; /* 8140 */ +#endif + VOL32 mult_misc_read_sel; /* 8144 */ + VOL32 alt_pcnt; /* 8148 min_axis_pcnt, maj_axis_pcnt */ + VOL8 _pad3a[0x1c]; /* 814c */ + VOL32 global_bitmap_1; /* 8168 */ + VOL32 global_bitmap_2; /* 816c */ + VOL32 primary_bitmap_1; /* 8170 */ + VOL32 primary_bitmap_2; /* 8174 */ + VOL32 secondary_bitmap_1; /* 8178 */ + VOL32 secondary_bitmap_2; /* 817c */ + VOL32 primary_stream_control; /* 8180 */ + VOL32 chroma_key_control; /* 8184 */ + VOL32 genlocking_control; /* 8188 */ + VOL8 _pad3b[0x4]; /* 818c */ + VOL32 secondary_stream_control; /* 8190 */ + VOL32 chroma_key_upper_bound; /* 8194 */ + VOL32 secondary_stream_h_scale; /* 8198 */ + VOL32 color_adjustment; /* 819c */ + VOL32 blend_control; /* 81a0 */ + VOL8 _pad3c[0x1c]; /* 81a4 */ + VOL32 primary_stream_addr_0; /* 81c0 */ + VOL32 primary_stream_addr_1; /* 81c4 */ + VOL32 primary_stream_stride; /* 81c8 */ + VOL32 secondary_stream_mbuf; /* 81cc */ + VOL32 secondary_stream_addr_0;/* 81d0 */ + VOL32 secondary_stream_addr_1;/* 81d4 */ + VOL32 secondary_stream_stride;/* 81d8 */ + VOL8 _pad81dc[4]; /* 81dc */ + VOL32 secondary_stream_vscale;/* 81e0 */ + VOL32 secondary_stream_vinit; /* 81e4 */ + VOL32 secondary_stream_scount;/* 81e8 */ + VOL32 streams_fifo; /* 81ec */ + VOL32 primary_stream_xy; /* 81f0 */ + VOL32 primary_stream_size; /* 81f4 */ + VOL32 secondary_stream_xy; /* 81f8 */ + VOL32 secondary_stream_size; /* 81fc */ + VOL8 _pad8200[0xe8]; /* 8200 */ + VOL32 cur_y; /* 82e8 */ + VOL8 _pad4[0x14]; /* 82ec */ + VOL32 primary_stream_mem; /* 8300 */ + VOL32 secondary_stream_mem; /* 8304 */ + VOL8 _pad8308[0xD2]; /* 8308 */ + VOL8 input_status_1; /* 83da */ + VOL8 _pad83db[0x131]; /* 83db */ + VOL32 adv_func_cntl; /* 850c */ + VOL8 _pad8510[0x5dd8]; /* 8510 */ + VOL32 pix_trans; /* e2e8 */ + VOL8 _pade2ec[0x3a92c]; /* e2ec */ + VOL32 cmd_overflow_buf_ptr; /* 48c18 */ + VOL8 _pad48c1c[0x8]; /* 48c1c */ + VOL32 bci_power_management; /* 48c24 */ + VOL8 _pad48c28[0x38]; /* 48c28 */ + VOL32 alt_status_0; /* 48c60 */ + VOL32 alt_status_1; /* 48c64 */ +} S3, *S3Ptr; + +#define VGA_STATUS_1_DTM 0x01 +#define VGA_STATUS_1_VSY 0x08 + +#define DAC_MASK 0x03c6 +#define DAC_R_INDEX 0x03c7 +#define DAC_W_INDEX 0x03c8 +#define DAC_DATA 0x03c9 +#define DISP_STAT 0x02e8 +#define H_TOTAL 0x02e8 +#define H_DISP 0x06e8 +#define H_SYNC_STRT 0x0ae8 +#define H_SYNC_WID 0x0ee8 +#define V_TOTAL 0x12e8 +#define V_DISP 0x16e8 +#define V_SYNC_STRT 0x1ae8 +#define V_SYNC_WID 0x1ee8 +#define DISP_CNTL 0x22e8 +#define ADVFUNC_CNTL 0x4ae8 +#define SUBSYS_STAT 0x42e8 +#define SUBSYS_CNTL 0x42e8 +#define ROM_PAGE_SEL 0x46e8 +#define CUR_Y 0x82e8 +#define CUR_X 0x86e8 +#define DESTY_AXSTP 0x8ae8 +#define DESTX_DIASTP 0x8ee8 +#define ERR_TERM 0x92e8 +#define MAJ_AXIS_PCNT 0x96e8 +#define GP_STAT 0x9ae8 +#define CMD 0x9ae8 +#define SHORT_STROKE 0x9ee8 +#define BKGD_COLOR 0xa2e8 +#define FRGD_COLOR 0xa6e8 +#define WRT_MASK 0xaae8 +#define RD_MASK 0xaee8 +#define COLOR_CMP 0xb2e8 +#define BKGD_MIX 0xb6e8 +#define FRGD_MIX 0xbae8 +#define MULTIFUNC_CNTL 0xbee8 +#define MIN_AXIS_PCNT 0x0000 +#define SCISSORS_T 0x1000 +#define SCISSORS_L 0x2000 +#define SCISSORS_B 0x3000 +#define SCISSORS_R 0x4000 +#define MEM_CNTL 0x5000 +#define PATTERN_L 0x8000 +#define PATTERN_H 0x9000 +#define PIX_CNTL 0xa000 +#define CONTROL_MISC2 0xd000 +#define PIX_TRANS 0xe2e8 + +/* Advanced Function Control Regsiter */ +#define CLKSEL 0x0004 +#define DISABPASSTHRU 0x0001 + +/* Graphics Processor Status Register */ + +#define GPNSLOT 13 + +#define GPBUSY_1 0x0080 +#define GPBUSY_2 0x0040 +#define GPBUSY_3 0x0020 +#define GPBUSY_4 0x0010 +#define GPBUSY_5 0x0008 +#define GPBUSY_6 0x0004 +#define GPBUSY_7 0x0002 +#define GPBUSY_8 0x0001 +#define GPBUSY_9 0x8000 +#define GPBUSY_10 0x4000 +#define GPBUSY_11 0x2000 +#define GPBUSY_12 0x1000 +#define GPBUSY_13 0x0800 + +#define GPEMPTY 0x0400 +#define GPBUSY 0x0200 +#define DATDRDY 0x0100 + +/* Command Register */ +#define CMD_NOP 0x0000 +#define CMD_LINE 0x2000 +#define CMD_RECT 0x4000 +#define CMD_RECTV1 0x6000 +#define CMD_RECTV2 0x8000 +#define CMD_LINEAF 0xa000 +#define CMD_BITBLT 0xc000 +#define CMD_PATBLT 0xe000 +#define CMD_OP_MSK 0xe000 +#define BYTSEQ 0x1000 +#define _32BITNOPAD 0x0600 +#define _32BIT 0x0400 +#define _16BIT 0x0200 +#define _8BIT 0x0000 +#define PCDATA 0x0100 +#define INC_Y 0x0080 +#define YMAJAXIS 0x0040 +#define INC_X 0x0020 +#define DRAW 0x0010 +#define LINETYPE 0x0008 +#define LASTPIX 0x0004 /* Draw last pixel in line */ +#define PLANAR 0x0002 +#define WRTDATA 0x0001 + +/* Background Mix Register */ +#define BSS_BKGDCOL 0x0000 +#define BSS_FRGDCOL 0x0020 +#define BSS_PCDATA 0x0040 +#define BSS_BITBLT 0x0060 + +/* Foreground Mix Register */ +#define FSS_BKGDCOL 0x0000 +#define FSS_FRGDCOL 0x0020 +#define FSS_PCDATA 0x0040 +#define FSS_BITBLT 0x0060 + +/* The Mixes */ +#define MIX_MASK 0x001f + +#define MIX_NOT_DST 0x0000 +#define MIX_0 0x0001 +#define MIX_1 0x0002 +#define MIX_DST 0x0003 +#define MIX_NOT_SRC 0x0004 +#define MIX_XOR 0x0005 +#define MIX_XNOR 0x0006 +#define MIX_SRC 0x0007 +#define MIX_NAND 0x0008 +#define MIX_NOT_SRC_OR_DST 0x0009 +#define MIX_SRC_OR_NOT_DST 0x000a +#define MIX_OR 0x000b +#define MIX_AND 0x000c +#define MIX_SRC_AND_NOT_DST 0x000d +#define MIX_NOT_SRC_AND_DST 0x000e +#define MIX_NOR 0x000f + +#define MIX_MIN 0x0010 +#define MIX_DST_MINUS_SRC 0x0011 +#define MIX_SRC_MINUS_DST 0x0012 +#define MIX_PLUS 0x0013 +#define MIX_MAX 0x0014 +#define MIX_HALF__DST_MINUS_SRC 0x0015 +#define MIX_HALF__SRC_MINUS_DST 0x0016 +#define MIX_AVERAGE 0x0017 +#define MIX_DST_MINUS_SRC_SAT 0x0018 +#define MIX_SRC_MINUS_DST_SAT 0x001a +#define MIX_HALF__DST_MINUS_SRC_SAT 0x001c +#define MIX_HALF__SRC_MINUS_DST_SAT 0x001e +#define MIX_AVERAGE_SAT 0x001f + +/* Pixel Control Register */ +#define MIXSEL_FRGDMIX 0x0000 +#define MIXSEL_PATT 0x0040 +#define MIXSEL_EXPPC 0x0080 +#define MIXSEL_EXPBLT 0x00c0 +#define COLCMPOP_F 0x0000 +#define COLCMPOP_T 0x0008 +#define COLCMPOP_GE 0x0010 +#define COLCMPOP_LT 0x0018 +#define COLCMPOP_NE 0x0020 +#define COLCMPOP_EQ 0x0028 +#define COLCMPOP_LE 0x0030 +#define COLCMPOP_GT 0x0038 +#define PLANEMODE 0x0004 + +/* Multifunction Control Misc 8144 */ +#define MISC_DST_BA_0 (0x0 << 0) +#define MISC_DST_BA_1 (0x1 << 0) +#define MISC_DST_BA_2 (0x2 << 0) +#define MISC_DST_BA_3 (0x3 << 0) +#define MISC_SRC_BA_0 (0x0 << 2) +#define MISC_SRC_BA_1 (0x1 << 2) +#define MISC_SRC_BA_2 (0x2 << 2) +#define MISC_SRC_BA_3 (0x3 << 2) +#define MISC_RSF (1 << 4) +#define MISC_EXT_CLIP (1 << 5) +#define MISC_SRC_NE (1 << 7) +#define MISC_ENB_CMP (1 << 8) +#define MISC_32B (1 << 9) +#define MISC_DC (1 << 11) +#define MISC_INDEX_E (0xe << 12) + +#define S3_SAVAGE4_SLOTS 0x0001ffff +#define S3_SAVAGE4_2DI 0x00800000 + +#define _s3WaitLoop(s3,mask,value){ \ + int __loop = 1000000; \ + while (((s3)->alt_status_0 & (mask)) != (value)) \ + if (--__loop == 0) { \ + ErrorF ("savage wait loop failed 0x%x\n", s3->alt_status_0); \ + break; \ + } \ +} + +#define S3_SAVAGE4_ROOM 10 + +#define _s3WaitSlots(s3,n) { \ + int __loop = 1000000; \ + while (((s3)->alt_status_0 & S3_SAVAGE4_SLOTS) >= S3_SAVAGE4_ROOM-(n)) \ + if (--__loop == 0) { \ + ErrorF ("savage wait loop failed 0x%x\n", s3->alt_status_0); \ + break; \ + } \ +} + +#define _s3WaitEmpty(s3) _s3WaitLoop(s3,S3_SAVAGE4_SLOTS, 0) +#define _s3WaitIdleEmpty(s3) _s3WaitLoop(s3,S3_SAVAGE4_SLOTS|S3_SAVAGE4_2DI, S3_SAVAGE4_2DI) +#define _s3WaitIdle(s3) _s3WaitLoop(s3,S3_SAVAGE4_2DI, S3_SAVAGE4_2DI) + +typedef struct _s3Cursor { + int width, height; + int xhot, yhot; + Bool has_cursor; + CursorPtr pCursor; + Pixel source, mask; +} S3Cursor; + +typedef struct _s3PatternCache { + int id; + int x, y; +} S3PatternCache; + +typedef struct _s3Patterns { + S3PatternCache *cache; + int ncache; + int last_used; + int last_id; +} S3Patterns; + +#define S3_CLOCK_REF 14318 /* KHz */ + +#define S3_CLOCK(m,n,r) ((S3_CLOCK_REF * ((m) + 2)) / (((n) + 2) * (1 << (r)))) + +#define S3_MAX_CLOCK 150000 /* KHz */ + +typedef struct _s3Timing { + /* label */ + int horizontal; + int vertical; + int rate; + /* horizontal timing */ + int hfp; /* front porch */ + int hbp; /* back porch */ + int hblank; /* blanking */ + /* vertical timing */ + int vfp; /* front porch */ + int vbp; /* back porch */ + int vblank; /* blanking */ + /* clock values */ + int dac_m; + int dac_n; + int dac_r; +} S3Timing; + +#define S3_TEXT_SAVE (64*1024) + +typedef struct _s3Save { + CARD8 cursor_fg; + CARD8 cursor_bg; + CARD8 lock1; + CARD8 lock2; + CARD8 locksrtc; + CARD8 clock_mode; + CARD32 alt_mix; + CARD32 write_mask; + CARD32 fg; + CARD32 bg; + CARD32 global_bitmap_1; + CARD32 global_bitmap_2; + CARD32 adv_func_cntl; + CARD32 primary_bitmap_1; + CARD32 primary_bitmap_2; + CARD32 secondary_bitmap_1; + CARD32 secondary_bitmap_2; + CARD32 primary_stream_control; + CARD32 blend_control; + CARD32 primary_stream_addr_0; + CARD32 primary_stream_addr_1; + CARD32 primary_stream_stride; + CARD32 primary_stream_xy; + CARD32 primary_stream_size; + CARD32 primary_stream_mem; + CARD32 secondary_stream_xy; + CARD32 secondary_stream_size; + CARD32 streams_fifo; + CARD8 text_save[S3_TEXT_SAVE]; +} S3Save; + +typedef struct _s3CardInfo { + S3Ptr s3; /* pointer to register structure */ + int memory; /* amount of memory */ + CARD8 *frameBuffer; /* pointer to frame buffer */ + CARD8 *registers; /* pointer to register map */ + S3Vga s3vga; + S3Save save; + Bool need_sync; + Bool bios_initialized; /* whether the bios has been run */ +} S3CardInfo; + +typedef struct _s3FbInfo { + CARD8 *offscreen; /* pointer to offscreen area */ + int offscreen_y; /* top y coordinate of offscreen area */ + int offscreen_x; /* top x coordinate of offscreen area */ + int offscreen_width; /* width of offscreen area */ + int offscreen_height; /* height of offscreen area */ + S3Patterns patterns; + CARD32 bitmap_offset; + int accel_stride; + int accel_bpp; + CARD32 chroma_key; +} S3FBInfo; + +typedef struct _s3ScreenInfo { + CARD8 *cursor_base; /* pointer to cursor area */ + S3Cursor cursor; + Bool managing_border; + Bool use_streams; + int primary_depth; + int current_ma; + CARD32 border_pixel; + S3FBInfo fb[KD_MAX_FB]; + RegionRec region[KD_MAX_FB]; + int fbmap[KD_MAX_FB+1]; /* map from fb to stream */ +} S3ScreenInfo; + +#define getS3CardInfo(kd) ((S3CardInfo *) ((kd)->card->driver)) +#define s3CardInfo(kd) S3CardInfo *s3c = getS3CardInfo(kd) + +#define getS3ScreenInfo(kd) ((S3ScreenInfo *) ((kd)->screen->driver)) +#define s3ScreenInfo(kd) S3ScreenInfo *s3s = getS3ScreenInfo(kd) + +Bool s3CardInit (KdCardInfo *); +Bool s3ScreenInit (KdScreenInfo *); +Bool s3Enable (ScreenPtr pScreen); +void s3Disable (ScreenPtr pScreen); +void s3Fini (ScreenPtr pScreen); + +Bool s3CursorInit (ScreenPtr pScreen); +void s3CursorEnable (ScreenPtr pScreen); +void s3CursorDisable (ScreenPtr pScreen); +void s3CursorFini (ScreenPtr pScreen); +void s3RecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdefs); + +void s3DumbPaintWindow (WindowPtr pWin, RegionPtr pRegion, int what); +void s3DumbCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc); + +Bool s3DrawInit (ScreenPtr pScreen); +void s3DrawEnable (ScreenPtr pScreen); +void s3DrawSync (ScreenPtr pScreen); +void s3DrawDisable (ScreenPtr pScreen); +void s3DrawFini (ScreenPtr pScreen); + +void s3GetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs); +void s3PutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs); + +void S3InitCard (KdCardAttr *attr); + +void s3GetClock (int target, int *Mp, int *Np, int *Rp, int maxM, int maxN, int maxR, int minVco); + +extern KdCardFuncs s3Funcs; + +/* + * Wait for the begining of the retrace interval + */ + +#define S3_RETRACE_LOOP_CHECK if (++_loop_count > 300000) {\ + DRAW_DEBUG ((DEBUG_FAILURE, "S3 wait loop failed at %s:%d", \ + __FILE__, __LINE__)); \ + break; \ +} + +#define DRAW_DEBUG(a) + +#define _s3WaitVRetrace(s3vga) { \ + int _loop_count; \ + _loop_count = 0; \ + while (s3GetImm(s3vga, s3_vertical_sync_active) != 0) S3_RETRACE_LOOP_CHECK; \ + _loop_count = 0; \ + while (s3GetImm(s3vga, s3_vertical_sync_active) == 0) S3_RETRACE_LOOP_CHECK; \ +} +#define _s3WaitVRetraceFast(s3) { \ + int _loop_count; \ + _loop_count = 0; \ + while (s3->input_status_1 & 8) S3_RETRACE_LOOP_CHECK; \ + _loop_count = 0; \ + while ((s3->input_status_1 & 8) == 0) S3_RETRACE_LOOP_CHECK; \ +} +/* + * Wait for the begining of the retrace interval + */ +#define _s3WaitVRetraceEnd(s3vga) { \ + int _loop_count; \ + _loop_count = 0; \ + while (s3GetImm(s3vga, s3_vertical_sync_active) == 0) S3_RETRACE_LOOP_CHECK; \ + _loop_count = 0; \ + while (s3GetImm(s3vga, s3_vertical_sync_active) != 0) S3_RETRACE_LOOP_CHECK; \ +} + +#define S3_CURSOR_WIDTH 64 +#define S3_CURSOR_HEIGHT 64 +#define S3_CURSOR_SIZE ((S3_CURSOR_WIDTH * S3_CURSOR_HEIGHT + 7) / 8) + +#define S3_TILE_SIZE 8 + +#endif /* _S3_H_ */ --- xorg-server-1.4.2.orig/hw/kdrive/savage/s3clock.c +++ xorg-server-1.4.2/hw/kdrive/savage/s3clock.c @@ -0,0 +1,84 @@ +/* + * Copyright 1999 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_CONFIG_H +#include +#endif +#include "s3.h" + +/* + * Clock synthesis: + * + * f_out = f_ref * ((M + 2) / ((N + 2) * (1 << R))) + * + * Constraints: + * + * 1. 135MHz <= f_ref * ((M + 2) / (N + 2)) <= 270 MHz + * 2. N >= 1 + * + * Vertical refresh rate = clock / ((hsize + hblank) * (vsize + vblank)) + * Horizontal refresh rate = clock / (hsize + hblank) + */ + +/* all in kHz */ + +void +s3GetClock (int target, int *Mp, int *Np, int *Rp, int maxM, int maxN, int maxR, int minVco) +{ + int M, N, R, bestM, bestN; + int f_vco, f_out; + int err, abserr, besterr; + + /* + * Compute correct R value to keep VCO in range + */ + for (R = 0; R <= maxR; R++) + { + f_vco = target * (1 << R); + if (f_vco >= minVco) + break; + } + + /* M = f_out / f_ref * ((N + 2) * (1 << R)); */ + besterr = target; + for (N = 1; N <= maxN; N++) + { + M = ((target * (N + 2) * (1 << R) + (S3_CLOCK_REF/2)) + S3_CLOCK_REF/2) / S3_CLOCK_REF - 2; + if (0 <= M && M <= maxM) + { + f_out = S3_CLOCK(M,N,R); + err = target - f_out; + if (err < 0) + err = -err; + if (err < besterr) + { + besterr = err; + bestM = M; + bestN = N; + } + } + } + *Mp = bestM; + *Np = bestN; + *Rp = R; +} --- xorg-server-1.4.2.orig/hw/kdrive/savage/s3draw.h +++ xorg-server-1.4.2/hw/kdrive/savage/s3draw.h @@ -0,0 +1,468 @@ +/* + * Copyright 1999 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 _S3DRAW_H_ +#define _S3DRAW_H_ + +extern int s3GCPrivateIndex; +extern int s3WindowPrivateIndex; + +typedef struct _s3Pattern { + S3PatternCache *cache; + int id; + PixmapPtr pPixmap; + int fillStyle; + int xrot, yrot; + unsigned int fore, back; +} s3PatternRec, *s3PatternPtr; + +typedef struct _s3PrivGC { + int type; /* type of drawable validated against */ + int ma; /* stream descriptor */ + s3PatternPtr pPattern; /* pattern */ +} s3PrivGCRec, *s3PrivGCPtr; + +#define s3GetGCPrivate(g) ((s3PrivGCPtr) \ + (g)->devPrivates[s3GCPrivateIndex].ptr) + +#define s3GCPrivate(g) s3PrivGCPtr s3Priv = s3GetGCPrivate(g) + +#define s3GetWindowPrivate(w) ((s3PatternPtr) \ + (w)->devPrivates[s3WindowPrivateIndex].ptr) + +#define s3SetWindowPrivate(w,p) (\ + (w)->devPrivates[s3WindowPrivateIndex].ptr = (pointer) p) + +void _s3LoadPattern (ScreenPtr pScreen, int fb, s3PatternPtr pPattern); + +#define SetupS3(s) KdScreenPriv(s); \ + s3CardInfo(pScreenPriv); \ + S3Ptr s3 = s3c->s3 + +#ifdef S3_SYNC_DEBUG +#define SYNC_DEBUG() fprintf (stderr, "Sync at %s:%d\n", __FILE__,__LINE__) +#else +#define SYNC_DEBUG() +#endif + +#define S3_ASYNC +#ifdef S3_ASYNC +#define CheckSyncS3(s) KdCheckSync(s) +#define MarkSyncS3(s) KdMarkSync(s) +#define RegisterSync(screen) KdScreenInitAsync (screen) +#else +#define CheckSyncS3(s3c) +#define MarkSyncS3(s3c) _s3WaitIdleEmpty(s3c->s3) +#define RegisterSync(screen) +#endif + +#define WIDEN(x) ((unsigned long) (x)) +#define MERGE(a,b) ((WIDEN(a) << 16) | WIDEN(b)) + +#define s3BitmapDescriptor(_stream) ((_stream) + 1) + +#ifdef S3_TRIO +#define s3DrawMap(pDraw) 0 +#define s3SetGlobalBitmap(s,d) +#else +#define s3DrawMap(pDraw) ((pDraw)->depth == \ + getS3ScreenInfo(pScreenPriv)->primary_depth ? 0 : 1) +#endif + +#define s3GCMap(pGC) (s3GetGCPrivate(pGC)->ma) + +/* + * Ok, so the S3 is broken -- it expects bitmaps to come MSB bit order, + * but it's willing to take them in LSB byte order. These macros + * flip bits around without flipping bytes. Instead of using a table + * and burning memory bandwidth, do them in place with the CPU. + */ + +/* The MIPS compiler automatically places these constants in registers */ +#define S3InvertBits32(v) { \ + v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \ + v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \ + v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \ +} + +#define S3InvertBits16(v) { \ + v = ((v & 0x5555) << 1) | ((v >> 1) & 0x5555); \ + v = ((v & 0x3333) << 2) | ((v >> 2) & 0x3333); \ + v = ((v & 0x0f0f) << 4) | ((v >> 4) & 0x0f0f); \ +} + +#define S3InvertBits8(v) { \ + v = ((v & 0x55) << 1) | ((v >> 1) & 0x55); \ + v = ((v & 0x33) << 2) | ((v >> 2) & 0x33); \ + v = ((v & 0x0f) << 4) | ((v >> 4) & 0x0f); \ +} + +#define S3ByteSwap32(x) ((x) = (((x) >> 24) | \ + (((x) >> 8) & 0xff00) | \ + (((x) << 8) & 0xff0000) | \ + ((x) << 24))) + +#define S3ByteSwap16(x) ((x) = ((x) << 8) | ((x) >> 8)) + +#if BITMAP_BIT_ORDER == LSBFirst +#define S3AdjustBits32(x) S3InvertBits32(x) +#define S3AdjustBits16(x) S3InvertBits16(x) +#else +#define S3AdjustBits32(x) S3ByteSwap32(x) +#define S3AdjustBits16(x) S3ByteSwap16(x) +#endif + +#define _s3WaitSlot(s3) _s3WaitSlots(s3,1) + +#define _s3SetFg(s3,_fg) { \ + DRAW_DEBUG ((DEBUG_REGISTERS, " fg <- 0x%x", _fg));\ + s3->fg = (_fg); \ +} + +#define _s3SetBg(s3,_bg) { \ + DRAW_DEBUG ((DEBUG_REGISTERS, " bg <- 0x%x", _bg));\ + s3->bg = (_bg); \ +} + +#define _s3SetWriteMask(s3,_mask) {\ + DRAW_DEBUG((DEBUG_REGISTERS," write_mask <- 0x%x", _mask)); \ + s3->write_mask = (_mask); \ +} + +#define _s3SetReadMask(s3,_mask) {\ + DRAW_DEBUG((DEBUG_REGISTERS," read_mask <- 0x%x", _mask)); \ + s3->read_mask = (_mask); \ +} + +#define _s3SetPixelControl(s3,_ctl) { \ + DRAW_DEBUG((DEBUG_REGISTERS, " pix_cntl <- 0x%x", PIX_CNTL | (_ctl))); \ + s3->pix_cntl_mult_misc2 = MERGE (CONTROL_MISC2, PIX_CNTL | (_ctl)); \ +} + +#define _s3SetFgMix(s3,_mix) { \ + DRAW_DEBUG((DEBUG_REGISTERS, " fg_mix <- 0x%x", _mix)); \ + s3->enh_fg_mix = (_mix); \ +} + +#define _s3SetBgMix(s3,_mix) { \ + DRAW_DEBUG((DEBUG_REGISTERS, " bg_mix <- 0x%x", _mix)); \ + s3->enh_bg_mix = (_mix); \ +} + +#define _s3SetMix(s3,fg_mix,bg_mix) { \ + DRAW_DEBUG((DEBUG_REGISTERS, " alt_mix <- 0x%x", MERGE(fg_mix,bg_mix))); \ + s3->alt_mix = MERGE(fg_mix,bg_mix); \ +} + +#define _s3SetCur(s3,_x,_y) { \ + DRAW_DEBUG ((DEBUG_REGISTERS, " alt_curxy <- 0x%x", MERGE(_x,_y))); \ + s3->alt_curxy = MERGE(_x,_y); \ +} + +#define _s3SetStep(s3,_x,_y) { \ + DRAW_DEBUG ((DEBUG_REGISTERS, " alt_step <- 0x%x", MERGE(_x,_y))); \ + s3->alt_step = MERGE(_x,_y); \ +} + +#define _s3SetErr(s3,_e) { \ + DRAW_DEBUG ((DEBUG_REGISTERS, " err_term <- 0x%x", _e)); \ + s3->err_term = (_e); \ +} + +#define _s3SetPcnt(s3,_x,_y) { \ + DRAW_DEBUG ((DEBUG_REGISTERS, " alt_pcnt <- 0x%x", MERGE(_x,_y))); \ + s3->alt_pcnt = MERGE(_x,_y); \ +} + +#define _s3SetScissorsTl(s3,t,l) {\ + DRAW_DEBUG ((DEBUG_REGISTERS, " scissors_tl <- 0x%x", MERGE(t,l))); \ + s3->scissors_tl = MERGE(t,l); \ +} + +#define _s3SetScissorsBr(s3,b,r) {\ + DRAW_DEBUG ((DEBUG_REGISTERS, " scissors_br <- 0x%x", MERGE(b,r))); \ + s3->scissors_br = MERGE(b,r); \ +} + +#define _s3CmdWait(s3) + +#define _s3SetCmd(s3,_cmd) { \ + DRAW_DEBUG((DEBUG_REGISTERS, " cmd <- 0x%x", _cmd)); \ + _s3CmdWait(s3); \ + s3->cmd_gp_stat = (_cmd); \ + /* { CARD32 __junk__; __junk__ = s3->cmd_gp_stat; } */ \ +} + +#define _s3SetSolidFill(s3,pix,alu,mask) { \ + DRAW_DEBUG((DEBUG_SET,"set fill 0x%x %d 0x%x",pix,alu,mask)); \ + _s3WaitSlots(s3,4); \ + _s3SetFg (s3, pix); \ + _s3SetWriteMask(s3,mask); \ + _s3SetMix (s3, FSS_FRGDCOL | s3alu[alu], BSS_BKGDCOL | MIX_SRC); \ + _s3SetPixelControl (s3, MIXSEL_FRGDMIX); \ + DRAW_DEBUG((DEBUG_SET," done")); \ +} + +#define _s3SolidRect(s3,x,y,w,h) {\ + DRAW_DEBUG((DEBUG_RENDER,"solid rect %d,%d %dx%d",x,y,w,h)); \ + _s3WaitSlots(s3,3); \ + _s3SetCur(s3, x, y); \ + _s3SetPcnt (s3, (w)-1, (h)-1); \ + _s3SetCmd (s3, CMD_RECT|INC_X|INC_Y|DRAW|WRTDATA); \ + DRAW_DEBUG((DEBUG_RENDER," done")); \ +} + +#define _s3SolidLine(s3,maj,min,len,cmd) { \ + DRAW_DEBUG ((DEBUG_RENDER, "solid line 0x%x 0x%x 0x%x", maj, min, cmd)); \ + _s3WaitSlots(s3,4); \ + _s3SetPcnt(s3, (len), 0); \ + _s3SetStep(s3, 2*((min) - (maj)), 2*(min)); \ + _s3SetErr(s3, 2*(min) - (maj)); \ + _s3SetCmd (s3, CMD_LINE | (cmd) | DRAW | WRTDATA); \ +} + +#define _s3ClipLine(s3,cmd,e1,e2,e,len) {\ + DRAW_DEBUG ((DEBUG_RENDER, "clip line 0x%x 0x%x 0x%x 0x%x 0x%x", cmd,e1,e2,e,len)); \ + _s3WaitSlots(s3, 4); \ + _s3SetPcnt (s3, (len), 0); \ + _s3SetStep (s3, e2, e1); \ + _s3SetErr (s3, e); \ + _s3SetCmd (s3, CMD_LINE | (cmd) | DRAW | WRTDATA); \ +} + +#define _s3SetTile(s3,alu,mask) { \ + DRAW_DEBUG ((DEBUG_SET,"set tile %d 0x%x", alu, mask)); \ + _s3WaitSlots(s3,3); \ + _s3SetWriteMask(s3, mask); \ + _s3SetMix(s3, FSS_BITBLT | s3alu[alu], BSS_BITBLT|s3alu[alu]); \ + _s3SetPixelControl (s3, MIXSEL_FRGDMIX); \ + DRAW_DEBUG((DEBUG_SET," done")); \ +} + +/* + * For some reason, MIX_DST doesn't work in this mode; use MIX_OR with + * an explicit 0 pixel value + */ +#define _s3SetStipple(s3,alu,mask,_fg) {\ + DRAW_DEBUG ((DEBUG_SET,"set stipple 0x%x %d 0x%x", _fg, alu, mask)); \ + _s3WaitSlots(s3,5); \ + _s3SetFg (s3, _fg); \ + _s3SetBg (s3, 0); \ + _s3SetWriteMask(s3,mask); \ + _s3SetMix (s3, FSS_FRGDCOL | s3alu[alu], BSS_BKGDCOL|MIX_OR); \ + _s3SetPixelControl (s3, MIXSEL_EXPBLT); \ + DRAW_DEBUG((DEBUG_SET," done")); \ +} + +#define _s3SetOpaqueStipple(s3,alu,mask,_fg,_bg) {\ + DRAW_DEBUG ((DEBUG_SET,"set opaque stipple 0x%x 0x%x %d 0x%x", _fg, _bg, alu, mask)); \ + _s3WaitSlots(s3,5); \ + _s3SetFg (s3, _fg); \ + _s3SetBg (s3, _bg); \ + _s3SetWriteMask(s3,mask); \ + _s3SetMix (s3, FSS_FRGDCOL | s3alu[alu], BSS_BKGDCOL|s3alu[alu]); \ + _s3SetPixelControl (s3, MIXSEL_EXPBLT); \ + DRAW_DEBUG((DEBUG_SET," done")); \ +} + +#define _s3PatRect(s3,px,py,x,y,w,h) {\ + DRAW_DEBUG ((DEBUG_RENDER, "pat rect %d,%d %dx%d", x,y,w,h)); \ + _s3WaitSlots(s3, 4); \ + _s3SetCur (s3, px, py); \ + _s3SetStep (s3, x, y); \ + _s3SetPcnt (s3, (w)-1, (h)-1); \ + _s3SetCmd (s3, CMD_PATBLT|INC_X|INC_Y|DRAW|PLANAR|WRTDATA); \ + DRAW_DEBUG((DEBUG_RENDER," done")); \ +} + +#define _s3SetBlt(s3,alu,mask) { \ + DRAW_DEBUG ((DEBUG_SET,"set blt %d 0x%x", alu, mask)); \ + _s3WaitSlots(s3,3); \ + _s3SetPixelControl (s3, MIXSEL_FRGDMIX); \ + _s3SetMix(s3, FSS_BITBLT | s3alu[alu], BSS_BITBLT | s3alu[alu]); \ + _s3SetWriteMask(s3, mask); \ + DRAW_DEBUG((DEBUG_SET," done")); \ +} + +#define _s3Blt(s3,_sx,_sy,_dx,_dy,_w,_h,_dir) { \ + DRAW_DEBUG ((DEBUG_RENDER, "blt %d,%d -> %d,%d %dx%d 0x%x", \ + _sx,_sy,_dx,_dy,_w,_h,_dir)); \ + _s3WaitSlots(s3,4); \ + _s3SetCur(s3,_sx,_sy); \ + _s3SetStep(s3,_dx,_dy); \ + _s3SetPcnt(s3,(_w)-1,(_h)-1); \ + _s3SetCmd (s3, CMD_BITBLT | (_dir) | DRAW | WRTDATA); \ + DRAW_DEBUG((DEBUG_RENDER," done")); \ +} + +#define _s3SetOpaquePlaneBlt(s3,alu,mask,_fg,_bg) {\ + DRAW_DEBUG ((DEBUG_SET,"set opaque plane blt 0x%x 0x%x %d 0x%x", \ + _fg, _bg, alu, mask)); \ + /* _s3WaitSlots(s3, 5); */ \ + _s3WaitIdleEmpty (s3); \ + _s3SetFg(s3,_fg); \ + _s3SetBg(s3,_bg); \ + _s3SetWriteMask(s3,mask); \ + _s3SetMix(s3,FSS_FRGDCOL|s3alu[alu], BSS_BKGDCOL|s3alu[alu]); \ + _s3SetPixelControl(s3,MIXSEL_EXPPC); \ + DRAW_DEBUG((DEBUG_SET," done")); \ +} + +#define _s3SetTransparentPlaneBlt(s3,alu,mask,_fg) {\ + DRAW_DEBUG ((DEBUG_SET,"set transparent plane blt 0x%x %d 0x%x", \ + _fg, alu, mask)); \ + /*_s3WaitSlots(s3, 4); */ \ + _s3WaitIdleEmpty (s3); \ + _s3SetFg(s3,_fg); \ + _s3SetWriteMask(s3,mask); \ + _s3SetMix(s3,FSS_FRGDCOL|s3alu[alu], BSS_BKGDCOL|MIX_DST); \ + _s3SetPixelControl(s3,MIXSEL_EXPPC); \ + DRAW_DEBUG((DEBUG_SET," done")); \ +} + +/* Across the plane blt */ +#define _s3PlaneBlt(s3,x,y,w,h) {\ + DRAW_DEBUG ((DEBUG_RENDER, "plane blt %d,%d %dx%d", x,y,w,h)); \ + _s3WaitSlots(s3, 4); \ + _s3SetPixelControl(s3,MIXSEL_EXPPC); \ + _s3SetCur(s3, x, y); \ + _s3SetPcnt (s3, (w)-1, (h)-1); \ + _s3SetCmd (s3, \ + CMD_RECT| /* Fill rectangle */ \ + BYTSEQ| /* LSB byte order */ \ + _32BIT| /* 32 bit data on 32 bit boundaries */ \ + PCDATA| /* Data from CPU */ \ + INC_X|INC_Y| /* X and Y both increasing */ \ + DRAW| /* Draw, not move */ \ + PLANAR| /* multi pixel */ \ + WRTDATA); \ + DRAW_DEBUG((DEBUG_RENDER," done")); \ +} + +#define _s3SetClip(s3,pbox) {\ + DRAW_DEBUG ((DEBUG_SET, "set clip %dx%d -> %dx%d ", \ + pbox->x1, pbox->y1, pbox->x2, pbox->y2)); \ + _s3WaitSlots(s3, 2); \ + _s3SetScissorsTl(s3,(pbox)->x1, (pbox)->y1); \ + _s3SetScissorsBr(s3,(pbox)->x2 - 1, (pbox)->y2 - 1); \ + DRAW_DEBUG((DEBUG_SET," done")); \ +} + +#define _s3ResetClip(s3,pScreen) { \ + DRAW_DEBUG ((DEBUG_SET, "reset clip")); \ + _s3WaitSlots(s3, 2); \ + _s3SetScissorsTl(s3,0,0); \ + _s3SetScissorsBr(s3,pScreen->width - 1, pScreen->height - 1); \ + DRAW_DEBUG((DEBUG_SET," done")); \ +} + +RegionPtr +s3CopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, + int srcx, int srcy, int width, int height, int dstx, int dsty); + +RegionPtr +s3CopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, + int srcx, int srcy, int width, int height, + int dstx, int dsty, unsigned long bitPlane); + +void +s3PushPixels (GCPtr pGC, PixmapPtr pBitmap, + DrawablePtr pDrawable, + int w, int h, int x, int y); + +void +s3FillBoxSolid (DrawablePtr pDrawable, int nBox, BoxPtr pBox, + unsigned long pixel, int alu, unsigned long planemask); + +void +s3FillBoxPattern (DrawablePtr pDrawable, int nBox, BoxPtr pBox, + int alu, unsigned long planemask, s3PatternPtr pPattern); + +void +s3PolyFillRect (DrawablePtr pDrawable, GCPtr pGC, + int nrectFill, xRectangle *prectInit); + +void +s3FillSpans (DrawablePtr pDrawable, GCPtr pGC, int n, + DDXPointPtr ppt, int *pwidth, int fSorted); + +void +s3PolyFillArcSolid (DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs); + +void +s3FillPoly (DrawablePtr pDrawable, GCPtr pGC, int shape, + int mode, int count, DDXPointPtr ptsIn); + +void +s3PolyGlyphBlt (DrawablePtr pDrawable, + GCPtr pGC, + int xInit, int y, + unsigned int nglyphInit, + CharInfoPtr *ppciInit, + pointer pglyphBase); + +void +s3ImageGlyphBlt (DrawablePtr pDrawable, + GCPtr pGC, + int x, int y, + unsigned int nglyph, + CharInfoPtr *ppci, + pointer pglyphBase); + +void +s3ImageTEGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, + int xInit, int y, + unsigned int nglyphInit, + CharInfoPtr *ppciInit, + pointer pglyphBase); + +void +s3PolyTEGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, + int x, int y, + unsigned int nglyph, CharInfoPtr *ppci, + pointer pglyphBase); + +void +s3Polylines (DrawablePtr pDrawable, GCPtr pGC, + int mode, int nptInit, DDXPointPtr pptInit); + +void +s3PolySegment (DrawablePtr pDrawable, GCPtr pGC, + int nsegInit, xSegment *pSegInit); + +void +s3FillBoxSolid (DrawablePtr pDrawable, int nBox, BoxPtr pBox, + unsigned long pixel, int alu, unsigned long planemask); + +void s3ValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable); + +void +s3CheckGCFill (GCPtr pGC); + +void +s3MoveGCFill (GCPtr pGC); + +void +s3SyncProc (DrawablePtr pDrawable); + +#endif --- xorg-server-1.4.2.orig/hw/kdrive/savage/s3reg.h +++ xorg-server-1.4.2/hw/kdrive/savage/s3reg.h @@ -0,0 +1,227 @@ +/* + * Copyright 1999 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 _S3REG_H_ +#define _S3REG_H_ + +#include "vga.h" + +#define S3_SR 0 +#define S3_NSR 0x70 +#define S3_GR (S3_SR+S3_NSR) +#define S3_NGR 0x09 +#define S3_AR (S3_GR+S3_NGR) +#define S3_NAR 0x15 +#define S3_CR (S3_AR+S3_NAR) +#define S3_NCR 0xc0 +#define S3_DAC (S3_CR+S3_NCR) +#define S3_NDAC 4 +#define S3_MISC_OUT (S3_DAC + S3_NDAC) +#define S3_INPUT_STATUS_1 (S3_MISC_OUT+1) +#define S3_NREG (S3_INPUT_STATUS_1+1) + +extern VgaReg s3_h_total[]; +extern VgaReg s3_h_display_end[]; +extern VgaReg s3_h_blank_start[]; +extern VgaReg s3_h_blank_end[]; +extern VgaReg s3_display_skew[]; +extern VgaReg s3_h_sync_start[]; +extern VgaReg s3_h_sync_end[]; +extern VgaReg s3_h_skew[]; +extern VgaReg s3_v_total[]; +extern VgaReg s3_preset_row_scan[]; +extern VgaReg s3_max_scan_line[]; +extern VgaReg s3_start_address[]; +extern VgaReg s3_v_retrace_start[]; +extern VgaReg s3_v_retrace_end[]; +extern VgaReg s3_clear_v_retrace_int[]; +extern VgaReg s3_disable_v_retrace_int[]; +extern VgaReg s3_lock_crtc[]; +extern VgaReg s3_v_display_end[]; +extern VgaReg s3_screen_offset[]; +extern VgaReg s3_count_by_4_mode[]; +extern VgaReg s3_doubleword_mode[]; +extern VgaReg s3_v_blank_start[]; +extern VgaReg s3_v_blank_end[]; +extern VgaReg s3_2bk_cga[]; +extern VgaReg s3_4bk_hga[]; +extern VgaReg s3_v_total_double[]; +extern VgaReg s3_address_16k_wrap[]; +extern VgaReg s3_word_mode[]; +extern VgaReg s3_byte_mode[]; +extern VgaReg s3_hardware_reset[]; +extern VgaReg s3_line_compare[]; +extern VgaReg s3_delay_primary_load[]; +extern VgaReg s3_device_id[]; +extern VgaReg s3_revision[]; +extern VgaReg s3_enable_vga_16bit[]; +extern VgaReg s3_enhanced_memory_mapping[]; +extern VgaReg s3_enable_sff[]; +extern VgaReg s3_lock_dac_writes[]; +extern VgaReg s3_border_select[]; +extern VgaReg s3_lock_palette[]; +extern VgaReg s3_lock_vert[]; +extern VgaReg s3_lock_horz[]; +extern VgaReg s3_io_disable[]; +extern VgaReg s3_mem_size[]; +extern VgaReg s3_register_lock_1 []; +extern VgaReg s3_register_lock_2 []; +extern VgaReg s3_refresh_control[]; +extern VgaReg s3_enable_256[]; +extern VgaReg s3_disable_pci_read_bursts[]; +extern VgaReg s3_h_start_fifo_fetch[]; +extern VgaReg s3_enable_2d_access[]; +extern VgaReg s3_interlace[]; +extern VgaReg s3_old_screen_off_8[]; +extern VgaReg s3_h_counter_double_mode[]; +extern VgaReg s3_cursor_enable[]; +extern VgaReg s3_cursor_right[]; +extern VgaReg s3_cursor_xhigh[]; +extern VgaReg s3_cursor_xlow[]; +extern VgaReg s3_cursor_yhigh[]; +extern VgaReg s3_cursor_ylow[]; +extern VgaReg s3_cursor_fg[]; +extern VgaReg s3_cursor_bg[]; +extern VgaReg s3_cursor_address[]; +extern VgaReg s3_cursor_xoff[]; +extern VgaReg s3_cursor_yoff[]; +extern VgaReg s3_ge_screen_width[]; +extern VgaReg s3_pixel_length[]; +extern VgaReg s3_big_endian_linear[]; +extern VgaReg s3_mmio_select[]; +extern VgaReg s3_mmio_window[]; +extern VgaReg s3_swap_nibbles[]; +extern VgaReg s3_cursor_ms_x11[]; +extern VgaReg s3_linear_window_size[]; +extern VgaReg s3_enable_linear[]; +extern VgaReg s3_h_blank_extend[]; +extern VgaReg s3_h_sync_extend[]; +extern VgaReg s3_sdclk_skew[]; +extern VgaReg s3_delay_blank[]; +extern VgaReg s3_delay_h_enable[]; +extern VgaReg s3_enable_2d_3d[]; +extern VgaReg s3_pci_disconnect_enable[]; +extern VgaReg s3_primary_load_control[]; +extern VgaReg s3_secondary_load_control[]; +extern VgaReg s3_pci_retry_enable[]; +extern VgaReg s3_streams_mode[]; +extern VgaReg s3_color_mode[]; +extern VgaReg s3_primary_stream_definition[]; +extern VgaReg s3_primary_stream_timeout[]; +extern VgaReg s3_master_control_unit_timeout[]; +extern VgaReg s3_command_buffer_timeout[]; +extern VgaReg s3_lpb_timeout[]; +extern VgaReg s3_cpu_timeout[]; +extern VgaReg s3_2d_graphics_engine_timeout[]; +extern VgaReg s3_fifo_drain_delay[]; +extern VgaReg s3_fifo_fetch_timing[]; +extern VgaReg s3_dac_power_up_time[]; +extern VgaReg s3_dac_power_saving_disable[]; +extern VgaReg s3_flat_panel_output_control_1[]; +extern VgaReg s3_streams_fifo_delay[]; +extern VgaReg s3_flat_panel_output_control_2[]; +extern VgaReg s3_enable_l1_parameter[]; +extern VgaReg s3_primary_stream_l1[]; + +extern VgaReg s3_dot_clock_8[]; +extern VgaReg s3_screen_off[]; +extern VgaReg s3_enable_write_plane[]; +extern VgaReg s3_extended_memory_access[]; +extern VgaReg s3_sequential_addressing_mode[]; +extern VgaReg s3_select_chain_4_mode[]; + +extern VgaReg s3_unlock_extended_sequencer[]; +extern VgaReg s3_linear_addressing_control[]; +extern VgaReg s3_disable_io_ports[]; +extern VgaReg s3_hsync_control[]; +extern VgaReg s3_vsync_control[]; +extern VgaReg s3_mclk_n[]; +extern VgaReg s3_mclk_r[]; +extern VgaReg s3_mclk_m[]; +extern VgaReg s3_dclk_n[]; +extern VgaReg s3_dclk_r[]; +extern VgaReg s3_dclk_m[]; +extern VgaReg s3_mclk_load[]; +extern VgaReg s3_dclk_load[]; +extern VgaReg s3_dclk_over_2[]; +extern VgaReg s3_clock_load_imm[]; +extern VgaReg s3_dclk_invert[]; +extern VgaReg s3_enable_clock_double[]; +extern VgaReg s3_dclk_double_15_16_invert[]; +extern VgaReg s3_enable_gamma_correction[]; +extern VgaReg s3_enable_8_bit_luts[]; +extern VgaReg s3_dclk_control[]; +extern VgaReg s3_eclk_n[]; +extern VgaReg s3_eclk_r[]; +extern VgaReg s3_eclk_m[]; +extern VgaReg s3_vga_dclk_n[]; +extern VgaReg s3_vga_dclk_r[]; +extern VgaReg s3_vga_dclk_m1[]; +extern VgaReg s3_vga_dclk_m2[]; +extern VgaReg s3_vga_clk_select[]; +extern VgaReg s3_select_graphics_mode[]; +extern VgaReg s3_enable_blinking[]; +extern VgaReg s3_border_color[]; + +extern VgaReg s3_io_addr_select[]; +extern VgaReg s3_enable_ram[]; +extern VgaReg s3_clock_select[]; +extern VgaReg s3_horz_sync_neg[]; +extern VgaReg s3_vert_sync_neg[]; + +extern VgaReg s3_display_mode_inactive[]; +extern VgaReg s3_vertical_sync_active[]; + +extern VgaReg s3_dac_mask[]; +extern VgaReg s3_dac_read_index[]; +extern VgaReg s3_dac_write_index[]; +extern VgaReg s3_dac_data[]; + +#define s3Get(sv,r) VgaGet(&(sv)->card, (r)) +#define s3GetImm(sv,r) VgaGetImm(&(sv)->card, (r)) +#define s3Set(sv,r,v) VgaSet(&(sv)->card, (r), (v)) +#define s3SetImm(sv,r,v) VgaSetImm(&(sv)->card, (r), (v)) + +typedef struct _s3Vga { + VgaCard card; + VgaValue values[S3_NREG]; + VGA32 save_lock_crtc; + VGA32 save_register_lock_1; + VGA32 save_register_lock_2; + VGA32 save_unlock_extended_sequencer; + VGA32 save_lock_dac_writes; + VGA32 save_lock_horz; + VGA32 save_lock_vert; + VGA32 save_dot_clock_8; +} S3Vga; + +void +s3RegInit (S3Vga *s3vga, VGAVOL8 *mmio); + +void +s3Save (S3Vga *s3vga); + +void +s3Reset (S3Vga *s3vga); + +#endif /* _S3REG_H_ */ --- xorg-server-1.4.2.orig/hw/kdrive/savage/s3cmap.c +++ xorg-server-1.4.2/hw/kdrive/savage/s3cmap.c @@ -0,0 +1,122 @@ +/* + * Copyright 1999 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_CONFIG_H +#include +#endif +#include "s3.h" + +void +s3GetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs) +{ + KdScreenPriv(pScreen); + s3CardInfo(pScreenPriv); + S3Vga *s3vga = &s3c->s3vga; + + while (ndef--) + { + s3SetImm (s3vga, s3_dac_read_index, pdefs->pixel); + pdefs->red = s3GetImm (s3vga, s3_dac_data) << 8; + pdefs->green = s3GetImm (s3vga, s3_dac_data) << 8; + pdefs->blue = s3GetImm (s3vga, s3_dac_data) << 8; + pdefs++; + } +} + +#ifndef S3_TRIO +#define Shift(v,d) ((d) < 0 ? ((v) >> (-d)) : ((v) << (d))) + +void +s3SetTrueChromaKey (ScreenPtr pScreen, int pfb, xColorItem *pdef) +{ + FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen); + KdScreenPriv(pScreen); + s3ScreenInfo(pScreenPriv); + int fb, ma; + CARD32 key; + int r, g, b; + + for (ma = 0; s3s->fbmap[ma] >= 0; ma++) + { + fb = s3s->fbmap[ma]; + if (fb != pfb && pScreenPriv->screen->fb[fb].redMask) + { + r = KdComputeCmapShift (pScreenPriv->screen->fb[fb].redMask); + g = KdComputeCmapShift (pScreenPriv->screen->fb[fb].greenMask); + b = KdComputeCmapShift (pScreenPriv->screen->fb[fb].blueMask); + key = ((Shift(pdef->red,r) & pScreenPriv->screen->fb[fb].redMask) | + (Shift(pdef->green,g) & pScreenPriv->screen->fb[fb].greenMask) | + (Shift(pdef->blue,b) & pScreenPriv->screen->fb[fb].blueMask)); + if (pScrPriv->layer[fb].key != key) + { + pScrPriv->layer[fb].key = key; + (*pScrPriv->PaintKey) (&pScrPriv->layer[fb].u.run.pixmap->drawable, + &pScrPriv->layer[pfb].u.run.region, + pScrPriv->layer[fb].key, fb); + } + } + } +} +#endif + +void +s3PutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs) +{ + KdScreenPriv(pScreen); + s3CardInfo(pScreenPriv); + s3ScreenInfo(pScreenPriv); + S3Vga *s3vga = &s3c->s3vga; + xColorItem *chroma = 0; + CARD32 key; + +#if 0 + _s3WaitVRetrace (s3vga); +#else + S3Ptr s3 = s3c->s3; + _s3WaitVRetraceFast(s3); +#endif +#ifndef S3_TRIO + if (pScreenPriv->screen->fb[1].depth) + { + FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen); + key = pScrPriv->layer[fb].key; + } +#endif + else + key = ~0; + while (ndef--) + { + if (pdefs->pixel == key) + chroma = pdefs; + s3SetImm (s3vga, s3_dac_write_index, pdefs->pixel); + s3SetImm (s3vga, s3_dac_data, pdefs->red >> 8); + s3SetImm (s3vga, s3_dac_data, pdefs->green >> 8); + s3SetImm (s3vga, s3_dac_data, pdefs->blue >> 8); + pdefs++; + } +#ifndef S3_TRIO + if (chroma && !pScreenPriv->closed) + s3SetTrueChromaKey (pScreen, fb, chroma); +#endif +} + --- xorg-server-1.4.2.orig/hw/kdrive/vxworks/vxkbd.c +++ xorg-server-1.4.2/hw/kdrive/vxworks/vxkbd.c @@ -0,0 +1,263 @@ +/* + * Copyright © 1999 Network Computing Devices, Inc. All rights reserved. + * + * Author: Keith Packard + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "kdrive.h" +#include "kkeymap.h" +#include +#include + +#define VXWORKS_WIDTH 2 + +KeySym VxWorksKeymap[] = { +/*7 f1 */ XK_F1, NoSymbol, +/*8 escape */ XK_Escape, NoSymbol, + NoSymbol, NoSymbol, + NoSymbol, NoSymbol, + NoSymbol, NoSymbol, + NoSymbol, NoSymbol, +/*13 tab */ XK_Tab, NoSymbol, +/*14 ` */ XK_grave, XK_asciitilde, +/*15 f2 */ XK_F2, NoSymbol, + NoSymbol, NoSymbol, +/*17 lctrl */ XK_Control_L, NoSymbol, +/*18 lshift */ XK_Shift_L, NoSymbol, + NoSymbol, NoSymbol, +/*20 lock */ XK_Caps_Lock, NoSymbol, +/*21 q */ XK_Q, NoSymbol, +/*22 1 */ XK_1, XK_exclam, +/*23 f3 */ XK_F3, NoSymbol, + NoSymbol, NoSymbol, +/*25 lalt */ XK_Meta_L, XK_Alt_L, +/*26 z */ XK_Z, NoSymbol, +/*27 s */ XK_S, NoSymbol, +/*28 a */ XK_A, NoSymbol, +/*29 w */ XK_W, NoSymbol, +/*30 2 */ XK_2, XK_at, +/*31 f4 */ XK_F4, NoSymbol, + NoSymbol, NoSymbol, +/*33 c */ XK_C, NoSymbol, +/*34 x */ XK_X, NoSymbol, +/*35 d */ XK_D, NoSymbol, +/*36 e */ XK_E, NoSymbol, +/*37 4 */ XK_4, XK_dollar, +/*38 3 */ XK_3, XK_numbersign, +/*39 f5 */ XK_F5, NoSymbol, + NoSymbol, NoSymbol, +/*41 space */ XK_space, NoSymbol, +/*42 v */ XK_V, NoSymbol, +/*43 f */ XK_F, NoSymbol, +/*44 t */ XK_T, NoSymbol, +/*45 r */ XK_R, NoSymbol, +/*46 5 */ XK_5, XK_percent, +/*47 f6 */ XK_F6, NoSymbol, + NoSymbol, NoSymbol, +/*49 n */ XK_N, NoSymbol, +/*50 b */ XK_B, NoSymbol, +/*51 h */ XK_H, NoSymbol, +/*52 g */ XK_G, NoSymbol, +/*53 y */ XK_Y, NoSymbol, +/*54 6 */ XK_6, XK_asciicircum, +/*55 f7 */ XK_F7, NoSymbol, + NoSymbol, NoSymbol, +/*57 ralt */ XK_Meta_R, XK_Alt_R, +/*58 m */ XK_M, NoSymbol, +/*59 j */ XK_J, NoSymbol, +/*60 u */ XK_U, NoSymbol, +/*61 7 */ XK_7, XK_ampersand, +/*62 8 */ XK_8, XK_asterisk, +/*63 f8 */ XK_F8, NoSymbol, + NoSymbol, NoSymbol, +/*65 , */ XK_comma, XK_less, +/*66 k */ XK_K, NoSymbol, +/*67 i */ XK_I, NoSymbol, +/*68 o */ XK_O, NoSymbol, +/*69 0 */ XK_0, XK_parenright, +/*70 9 */ XK_9, XK_parenleft, +/*71 f9 */ XK_F9, NoSymbol, + NoSymbol, NoSymbol, +/*73 . */ XK_period, XK_greater, +/*74 / */ XK_slash, XK_question, +/*75 l */ XK_L, NoSymbol, +/*76 ; */ XK_semicolon, XK_colon, +/*77 p */ XK_P, NoSymbol, +/*78 - */ XK_minus, XK_underscore, +/*79 f10 */ XK_F10, NoSymbol, + NoSymbol, NoSymbol, + NoSymbol, NoSymbol, +/*82 ' */ XK_apostrophe, XK_quotedbl, + NoSymbol, NoSymbol, +/*84 [ */ XK_bracketleft, XK_braceleft, +/*85 = */ XK_equal, XK_plus, +/*86 f11 */ XK_F11, NoSymbol, +/*87 sysrq */ XK_Sys_Req, XK_Print, +/*88 rctrl */ XK_Control_R, NoSymbol, +/*89 rshift */ XK_Shift_R, NoSymbol, +/*90 enter */ XK_Return, NoSymbol, +/*91 ] */ XK_bracketright, XK_braceright, +/*92 \ */ XK_backslash, XK_bar, + NoSymbol, NoSymbol, +/*94 f12 */ XK_F12, NoSymbol, +/*95 scrolllock*/ XK_Scroll_Lock, NoSymbol, +/*96 down */ XK_Down, NoSymbol, +/*97 left */ XK_Left, NoSymbol, +/*98 pause */ XK_Break, XK_Pause, +/*99 up */ XK_Up, NoSymbol, +/*100 delete */ XK_Delete, NoSymbol, +/*101 end */ XK_End, NoSymbol, +/*102 bs */ XK_BackSpace, NoSymbol, +/*103 insert */ XK_Insert, NoSymbol, + NoSymbol, NoSymbol, +/*105 np 1 */ XK_KP_End, XK_KP_1, +/*106 right */ XK_Right, NoSymbol, +/*107 np 4 */ XK_KP_Left, XK_KP_4, +/*108 np 7 */ XK_KP_Home, XK_KP_7, +/*109 pgdn */ XK_Page_Down, NoSymbol, +/*110 home */ XK_Home, NoSymbol, +/*111 pgup */ XK_Page_Up, NoSymbol, +/*112 np 0 */ XK_KP_Insert, XK_KP_0, +/*113 np . */ XK_KP_Delete, XK_KP_Decimal, +/*114 np 2 */ XK_KP_Down, XK_KP_2, +/*115 np 5 */ XK_KP_5, NoSymbol, +/*116 np 6 */ XK_KP_Right, XK_KP_6, +/*117 np 8 */ XK_KP_Up, XK_KP_8, +/*118 numlock */ XK_Num_Lock, NoSymbol, +/*119 np / */ XK_KP_Divide, NoSymbol, + NoSymbol, NoSymbol, +/*121 np enter */ XK_KP_Enter, NoSymbol, +/*122 np 3 */ XK_KP_Page_Down, XK_KP_3, + NoSymbol, NoSymbol, +/*124 np + */ XK_KP_Add, NoSymbol, +/*125 np 9 */ XK_KP_Page_Up, XK_KP_9, +/*126 np * */ XK_KP_Multiply, NoSymbol, + NoSymbol, NoSymbol, + NoSymbol, NoSymbol, + NoSymbol, NoSymbol, + NoSymbol, NoSymbol, + NoSymbol, NoSymbol, +/*132 np - */ XK_KP_Subtract, NoSymbol, + NoSymbol, NoSymbol, + NoSymbol, NoSymbol, + NoSymbol, NoSymbol, + NoSymbol, NoSymbol, + NoSymbol, NoSymbol, + NoSymbol, NoSymbol, +/*139 lwin */ XK_Super_L, NoSymbol, +/*140 rwin */ XK_Super_R, NoSymbol, +/*141 menu */ XK_Menu, NoSymbol, +}; + +void +VxWorksKeyboardLoad (void) +{ + KeySym *k; + + kdMinScanCode = 7; + kdKeymapWidth = VXWORKS_WIDTH; + kdMaxScanCode = 141; + memcpy (kdKeymap, VxWorksKeymap, sizeof (VxWorksKeymap)); +} + +static int kbdFd = -1; + +#include +#include +#include + +extern KeyboardCtrl defaultKeyboardControl; + +static void +VxWorksSetAutorepeat (unsigned char *repeats, Bool on) +{ + int i; + unsigned char mask; + int scan_code; + int key_code; + unsigned char realkc; + + if (on) + { + realkc = 1; + ioctl (kbdFd, KBD_ALL_REPEAT, &realkc); + for (scan_code = 7; scan_code <= 141; scan_code++) + { + key_code = scan_code + 1; + i = key_code >> 3; + mask = 1 << (key_code & 7); + if ((repeats[i] & mask) == 0) + { + realkc = scan_code; + ioctl (kbdFd, KBD_NO_REPEAT, &realkc); + } + } + } + else + { + realkc = 0; + ioctl (kbdFd, KBD_ALL_REPEAT, &realkc); + } +} + +int +VxWorksKeyboardInit (void) +{ + + kbdFd = open ("/dev/kbd", O_RDONLY, 0); + if (kbdFd < 0) + ErrorF ("keyboard open failure %d\n", errno); + VxWorksSetAutorepeat (defaultKeyboardControl.autoRepeats, TRUE); + return -1; +} + +void +VxWorksKeyboardFini (int fd) +{ + if (kbdFd >= 0) + { + close (kbdFd); + kbdFd = -1; + } +} + +void +VxWorksKeyboardRead (int fd) +{ +} + +void +VxWorksKeyboardLeds (int leds) +{ + DeviceIntPtr pKeyboard = (DeviceIntPtr) LookupKeyboardDevice (); + KeyboardCtrl *ctrl = &pKeyboard->kbdfeed->ctrl; + led_ioctl_info led_info; + int i; + + VxWorksSetAutorepeat (ctrl->autoRepeats, ctrl->autoRepeat); + for (i = 0; i < 3; i++) + { + led_info.bit_n = 1 << i; + led_info.OFF_or_ON = (leds & (1 << i)) != 0; + led_info.reversed = 0; + ioctl (kbdFd, KBD_SET_LED, &led_info); + } +} + +void +VxWorksKeyboardBell (int volume, int frequency, int duration) +{ +} + +KdKeyboardFuncs VxWorksKeyboardFuncs = { + VxWorksKeyboardLoad, + VxWorksKeyboardInit, + VxWorksKeyboardRead, + VxWorksKeyboardLeds, + VxWorksKeyboardBell, + VxWorksKeyboardFini, + 3, +}; --- xorg-server-1.4.2.orig/hw/kdrive/vxworks/vxworks.c +++ xorg-server-1.4.2/hw/kdrive/vxworks/vxworks.c @@ -0,0 +1,42 @@ +/* + * Copyright © 1999 Network Computing Devices, Inc. All rights reserved. + * + * Author: Keith Packard + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "kdrive.h" +#include + +Bool +VxWorksSpecialKey (KeySym sym) +{ + switch (sym) { + case XK_Sys_Req: + download(1, "setup", 0); + return TRUE; + case XK_Break: + download(1, "launcher", 0); + return TRUE; + } + return FALSE; +} + +void +KdOsAddInputDrivers (void) +{ + KdAddPointerDriver(&VxWorksMouseDriver); + KdAddPointerDriver(&VxWorksKeyboardDriver); +} + +KdOsFuncs VxWorksFuncs = { + .SpecialKey = VxWorksSpecialKey, +}; + +void +OsVendorInit (void) +{ + KdOsInit (&VxWorksFuncs); +} --- xorg-server-1.4.2.orig/hw/kdrive/vxworks/vxmouse.c +++ xorg-server-1.4.2/hw/kdrive/vxworks/vxmouse.c @@ -0,0 +1,122 @@ +/* + * Copyright © 1999 Network Computing Devices, Inc. All rights reserved. + * + * Author: Keith Packard + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#define NEED_EVENTS +#include +#include +#include "inputstr.h" +#include "scrnintstr.h" +#include "kdrive.h" +#include "Xpoll.h" +#include +#include + +static unsigned long mouseState; + +#define BUTTON1 0x01 +#define BUTTON2 0x02 +#define BUTTON3 0x04 + +#include + +static int mouseFd = -1; + +static eventqueue *eventQueue; + +void +VxMouseRead (int mousePort) +{ + Event ev; + int dx, dy; + unsigned long flags; + unsigned long mask; + int n; + + while (eventQueue->head != eventQueue->tail) + { + ev = *eventQueue->head; + if (eventQueue->head >= &eventQueue->events[eventQueue->size-1]) + eventQueue->head = &eventQueue->events[0]; + else + eventQueue->head++; + switch (ev.e_type) { + case E_BUTTON: + switch (ev.e_device) { + case E_MOUSE: + switch (ev.e_key) { + case BUTTON1: + mask = KD_BUTTON_1; + break; + case BUTTON2: + mask = KD_BUTTON_2; + break; + case BUTTON3: + mask = KD_BUTTON_3; + break; + default: + mask = 0; + break; + } + if (ev.e_direction == E_KBUP) + mouseState &= ~mask; + else + mouseState |= mask; + KdEnqueueMouseEvent (mouseState | KD_MOUSE_DELTA, 0, 0); + break; + case E_DKB: + KdEnqueueKeyboardEvent (ev.e_key, ev.e_direction == E_KBUP); + break; + } + break; + case E_MMOTION: + KdEnqueueMouseEvent (mouseState | KD_MOUSE_DELTA, + ev.e_x, ev.e_y); + break; + } + } +} + +int +VxMouseInit (void) +{ + int mousePort; + unsigned long ev_size; + + mouseState = 0; + mousePort = open ("/dev/xdev", O_RDONLY, 0); + if (mousePort < 0) + ErrorF ("event port open failure %d\n", errno); + mouseFd = open ("/dev/mouse", O_RDONLY, 0); + if (mouseFd < 0) + ErrorF ("mouse open failure %d\n", errno); + if (eventQueue == 0) + { + ioctl (mousePort, EVENT_QUEUE_SMSIZE, &ev_size); + eventQueue = (eventqueue *) smem_get ("event", ev_size, (SM_READ|SM_WRITE)); + } + return mousePort; +} + +void +VxMouseFini (int mousePort) +{ + if (mousePort >= 0) + close (mousePort); + if (mouseFd >= 0) + { + close (mouseFd); + mouseFd = -1; + } +} + +KdMouseFuncs VxWorksMouseFuncs = { + VxMouseInit, + VxMouseRead, + VxMouseFini +}; --- xorg-server-1.4.2.orig/hw/kdrive/neomagic/Makefile.in +++ xorg-server-1.4.2/hw/kdrive/neomagic/Makefile.in @@ -152,7 +152,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -286,10 +286,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/kdrive/ipaq/ipaq.c +++ xorg-server-1.4.2/hw/kdrive/ipaq/ipaq.c @@ -0,0 +1,70 @@ +/* + * 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. + * + * Adapted from ts300.c by Alan Hourihane + * For the Compaq IPAQ handheld, with the HP VGA Out Card (F1252A). + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "pcmcia.h" + +extern KdCardFuncs pcmciaFuncs; + +void +InitCard (char *name) +{ + KdCardAttr attr; + if (name && !strcmp(name, "pcmcia")) + KdCardInfoAdd (&pcmciaFuncs, &attr, 0); + else + KdCardInfoAdd (&fbdevFuncs, &attr, 0); +} + +void +InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) +{ + KdInitOutput (pScreenInfo, argc, argv); +} + +void +InitInput (int argc, char **argv) +{ + KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs); +#ifdef TOUCHSCREEN + KdAddMouseDriver (&TsFuncs); +#endif +} + +extern pcmciaDisplayModeRec pcmciaDefaultModes[]; + +void +ddxUseMsg (void) +{ + KdUseMsg(); +} + +int +ddxProcessArgument (int argc, char **argv, int i) +{ + return KdProcessArgument (argc, argv, i); +} --- xorg-server-1.4.2.orig/hw/kdrive/trident/tridentstub.c +++ xorg-server-1.4.2/hw/kdrive/trident/tridentstub.c @@ -0,0 +1,94 @@ +/* + * Copyright 1999 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_CONFIG_H +#include +#endif +#include "trident.h" + +extern int trident_clk, trident_mclk; + +void +InitCard (char *name) +{ + KdCardAttr attr; + + if (LinuxFindPci (0x1023, 0x9525, 0, &attr)) + KdCardInfoAdd (&tridentFuncs, &attr, 0); +} + +void +InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) +{ + KdInitOutput (pScreenInfo, argc, argv); +} + +void +InitInput (int argc, char **argv) +{ + KdOsAddInputDrivers (); + KdInitInput (); +} + +void +ddxUseMsg (void) +{ +#if 0 + ErrorF("\nTrident Driver Options:\n"); + ErrorF("-clk XXX: what's this?\n"); + ErrorF("-mclk XXX: what's this?\n"); +#endif + KdUseMsg(); +#ifdef VESA + vesaUseMsg() +#endif +} + +int +ddxProcessArgument (int argc, char **argv, int i) +{ + int ret; + + if (!strcmp (argv[i], "-clk")) + { + if (i+1 < argc) + trident_clk = atoi (argv[i+1]); + else + UseMsg (); + return 2; + } + if (!strcmp (argv[i], "-mclk")) + { + if (i+1 < argc) + trident_mclk = atoi (argv[i+1]); + else + UseMsg (); + return 2; + } + +#ifdef VESA + if (!(ret = vesaProcessArgument (argc, argv, i))) +#endif + ret = KdProcessArgument(argc, argv, i); + return ret; +} --- xorg-server-1.4.2.orig/hw/kdrive/trident/tridentdraw.c +++ xorg-server-1.4.2/hw/kdrive/trident/tridentdraw.c @@ -0,0 +1,496 @@ +/* + * 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_CONFIG_H +#include +#endif +#include "trident.h" +#include "tridentdraw.h" + +#include "Xmd.h" +#include "gcstruct.h" +#include "scrnintstr.h" +#include "pixmapstr.h" +#include "regionstr.h" +#include "mistruct.h" +#include "fontstruct.h" +#include "dixfontstr.h" +#include "fb.h" +#include "migc.h" +#include "miline.h" +#include "picturestr.h" + +CARD8 tridentRop[16] = { + /* GXclear */ 0x00, /* 0 */ + /* GXand */ 0x88, /* src AND dst */ + /* GXandReverse */ 0x44, /* src AND NOT dst */ + /* GXcopy */ 0xcc, /* src */ + /* GXandInverted*/ 0x22, /* NOT src AND dst */ + /* GXnoop */ 0xaa, /* dst */ + /* GXxor */ 0x66, /* src XOR dst */ + /* GXor */ 0xee, /* src OR dst */ + /* GXnor */ 0x11, /* NOT src AND NOT dst */ + /* GXequiv */ 0x99, /* NOT src XOR dst */ + /* GXinvert */ 0x55, /* NOT dst */ + /* GXorReverse */ 0xdd, /* src OR NOT dst */ + /* GXcopyInverted*/ 0x33, /* NOT src */ + /* GXorInverted */ 0xbb, /* NOT src OR dst */ + /* GXnand */ 0x77, /* NOT src OR NOT dst */ + /* GXset */ 0xff, /* 1 */ +}; + +#define tridentFillPix(bpp,pixel) {\ + if (bpp == 8) \ + { \ + pixel = pixel & 0xff; \ + pixel = pixel | pixel << 8; \ + } \ + if (bpp <= 16) \ + { \ + pixel = pixel & 0xffff; \ + pixel = pixel | pixel << 16; \ + } \ +} + +static Cop *cop; +static CARD32 cmd; + +Bool +tridentPrepareSolid (DrawablePtr pDrawable, + int alu, + Pixel pm, + Pixel fg) +{ + FbBits depthMask = FbFullMask(pDrawable->depth); + + if ((pm & depthMask) != depthMask) + return FALSE; + else + { + KdScreenPriv(pDrawable->pScreen); + tridentCardInfo(pScreenPriv); + cop = tridentc->cop; + + tridentFillPix(pDrawable->bitsPerPixel,fg); + _tridentInit(cop,tridentc); + _tridentSetSolidRect(cop,fg,alu,cmd); + return TRUE; + } +} + +void +tridentSolid (int x1, int y1, int x2, int y2) +{ + _tridentRect (cop, x1, y1, x2 - 1, y2 - 1, cmd); +} + +void +tridentDoneSolid (void) +{ +} + +Bool +tridentPrepareCopy (DrawablePtr pSrcDrawable, + DrawablePtr pDstDrawable, + int dx, + int dy, + int alu, + Pixel pm) +{ + FbBits depthMask = FbFullMask(pDstDrawable->depth); + + if ((pm & depthMask) == depthMask) + { + KdScreenPriv(pDstDrawable->pScreen); + tridentCardInfo(pScreenPriv); + cop = tridentc->cop; + _tridentInit(cop,tridentc); + cop->multi = COP_MULTI_PATTERN; + cop->multi = COP_MULTI_ROP | tridentRop[alu]; + cmd = COP_OP_BLT | COP_SCL_OPAQUE | COP_OP_ROP | COP_OP_FB; + if (dx < 0 || dy < 0) + cmd |= COP_X_REVERSE; + return TRUE; + } + else + return FALSE; +} + +void +tridentCopy (int srcX, + int srcY, + int dstX, + int dstY, + int w, + int h) +{ + if (cmd & COP_X_REVERSE) + { + cop->src_start_xy = TRI_XY (srcX + w - 1, srcY + h - 1); + cop->src_end_xy = TRI_XY (srcX, srcY); + cop->dst_start_xy = TRI_XY (dstX + w - 1, dstY + h - 1); + cop->dst_end_xy = TRI_XY (dstX, dstY); + } + else + { + cop->src_start_xy = TRI_XY (srcX, srcY); + cop->src_end_xy = TRI_XY (srcX + w - 1, srcY + h - 1); + cop->dst_start_xy = TRI_XY (dstX, dstY); + cop->dst_end_xy = TRI_XY (dstX + w - 1, dstY + h - 1); + } + _tridentWaitDone (cop); + cop->command = cmd; +} + +void +tridentDoneCopy (void) +{ +} + +void +tridentComposite (CARD8 op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) +{ + SetupTrident (pDst->pDrawable->pScreen); + tridentScreenInfo(pScreenPriv); + RegionRec region; + int n; + BoxPtr pbox; + CARD32 rgb; + CARD8 *msk, *mskLine; + FbBits *mskBits; + FbStride mskStride; + int mskBpp; + int mskXoff, mskYoff; + CARD32 *src, *srcLine; + CARD32 *off, *offLine; + FbBits *srcBits; + FbStride srcStride; + int srcXoff, srcYoff; + FbStride offStride; + int srcBpp; + int x_msk, y_msk, x_src, y_src, x_dst, y_dst; + int x2; + int w, h, w_this, h_this, w_remain; + CARD32 *off_screen; + int off_size = tridents->off_screen_size >> 2; + int off_width, off_height; + int stride = pScreenPriv->screen->fb[0].pixelStride; + int mskExtra; + CARD32 off_screen_offset = tridents->off_screen - tridents->screen; + int mode; + +#define MODE_NONE 0 +#define MODE_IMAGE 1 +#define MODE_MASK 2 + + rgb = *((CARD32 *) ((PixmapPtr) (pSrc->pDrawable))->devPrivate.ptr); + if (pMask && + !pMask->repeat && + pMask->format == PICT_a8 && + op == PictOpOver && + pSrc->repeat && + pSrc->pDrawable->width == 1 && + pSrc->pDrawable->height == 1 && + PICT_FORMAT_BPP(pSrc->format) == 32 && + (PICT_FORMAT_A(pSrc->format) == 0 || + (rgb & 0xff000000) == 0xff000000) && + pDst->pDrawable->bitsPerPixel == 32 && + pDst->pDrawable->type == DRAWABLE_WINDOW) + { + mode = MODE_MASK; + } + else if (!pMask && + op == PictOpOver && + !pSrc->repeat && + PICT_FORMAT_A(pSrc->format) == 8 && + PICT_FORMAT_BPP(pSrc->format) == 32 && + pDst->pDrawable->bitsPerPixel == 32 && + pDst->pDrawable->type == DRAWABLE_WINDOW) + { + mode = MODE_IMAGE; + } + else + mode = MODE_NONE; + + if (mode != MODE_NONE) + { + xDst += pDst->pDrawable->x; + yDst += pDst->pDrawable->y; + xSrc += pSrc->pDrawable->x; + ySrc += pSrc->pDrawable->y; + + fbGetDrawable (pSrc->pDrawable, srcBits, srcStride, srcBpp, srcXoff, srcYoff); + + if (pMask) + { + xMask += pMask->pDrawable->x; + yMask += pMask->pDrawable->y; + fbGetDrawable (pMask->pDrawable, mskBits, mskStride, mskBpp, mskXoff, mskYoff); + mskStride = mskStride * sizeof (FbBits) / sizeof (CARD8); + } + + if (!miComputeCompositeRegion (®ion, + pSrc, + pMask, + pDst, + xSrc, + ySrc, + xMask, + yMask, + xDst, + yDst, + width, + height)) + return; + + _tridentInit(cop,tridentc); + + cop->multi = COP_MULTI_PATTERN; + cop->src_offset = off_screen_offset; + + if (mode == MODE_IMAGE) + { + cop->multi = (COP_MULTI_ALPHA | + COP_ALPHA_BLEND_ENABLE | + COP_ALPHA_WRITE_ENABLE | + 0x7 << 16 | + COP_ALPHA_DST_BLEND_1_SRC_A | + COP_ALPHA_SRC_BLEND_1); + } + else + { + rgb &= 0xffffff; + cop->multi = (COP_MULTI_ALPHA | + COP_ALPHA_BLEND_ENABLE | + COP_ALPHA_WRITE_ENABLE | + 0x7 << 16 | + COP_ALPHA_DST_BLEND_1_SRC_A | + COP_ALPHA_SRC_BLEND_SRC_A); + } + + n = REGION_NUM_RECTS (®ion); + pbox = REGION_RECTS (®ion); + + while (n--) + { + h = pbox->y2 - pbox->y1; + w = pbox->x2 - pbox->x1; + + offStride = (w + 7) & ~7; + off_height = off_size / offStride; + if (off_height > h) + off_height = h; + + cop->multi = COP_MULTI_STRIDE | (stride << 16) | offStride; + + y_dst = pbox->y1; + y_src = y_dst - yDst + ySrc; + y_msk = y_dst - yDst + yMask; + + x_dst = pbox->x1; + x_src = x_dst - xDst + xSrc; + x_msk = x_dst - xDst + xMask; + + if (mode == MODE_IMAGE) + srcLine = (CARD32 *) srcBits + (y_src - srcYoff) * srcStride + (x_src - srcXoff); + else + mskLine = (CARD8 *) mskBits + (y_msk - mskYoff) * mskStride + (x_msk - mskXoff); + + while (h) + { + h_this = h; + if (h_this > off_height) + h_this = off_height; + h -= h_this; + + offLine = (CARD32 *) tridents->off_screen; + + _tridentWaitDone(cop); + + cop->dst_start_xy = TRI_XY(x_dst, y_dst); + cop->dst_end_xy = TRI_XY(x_dst + w - 1, y_dst + h_this - 1); + cop->src_start_xy = TRI_XY(0,0); + cop->src_end_xy = TRI_XY(w - 1, h_this - 1); + + if (mode == MODE_IMAGE) + { + while (h_this--) + { + w_remain = w; + src = srcLine; + srcLine += srcStride; + off = offLine; + offLine += offStride; + while (w_remain--) + *off++ = *src++; + } + } + else + { + while (h_this--) + { + w_remain = w; + msk = mskLine; + mskLine += mskStride; + off = offLine; + offLine += offStride; + while (w_remain--) + *off++ = rgb | (*msk++ << 24); + } + } + + cop->command = (COP_OP_BLT | + COP_SCL_OPAQUE | + COP_OP_FB); + } + pbox++; + } + cop->src_offset = 0; + + KdMarkSync (pDst->pDrawable->pScreen); + } + else + { + KdCheckComposite (op, + pSrc, + pMask, + pDst, + xSrc, + ySrc, + xMask, + yMask, + xDst, + yDst, + width, + height); + } +} + +KaaScreenPrivRec tridentKaa = { + tridentPrepareSolid, + tridentSolid, + tridentDoneSolid, + + tridentPrepareCopy, + tridentCopy, + tridentDoneCopy, +}; + +Bool +tridentDrawInit (ScreenPtr pScreen) +{ + SetupTrident(pScreen); + tridentScreenInfo(pScreenPriv); + PictureScreenPtr ps = GetPictureScreen(pScreen); + + if (!kaaDrawInit (pScreen, &tridentKaa)) + return FALSE; + + if (ps && tridents->off_screen) + ps->Composite = tridentComposite; + + return TRUE; +} + +void +tridentDrawEnable (ScreenPtr pScreen) +{ + SetupTrident(pScreen); + CARD32 cmd; + CARD32 base; + CARD16 stride; + CARD32 format; + CARD32 alpha; + int tries; + int nwrite; + + stride = pScreenPriv->screen->fb[0].pixelStride; + switch (pScreenPriv->screen->fb[0].bitsPerPixel) { + case 8: + format = COP_DEPTH_8; + break; + case 16: + format = COP_DEPTH_16; + break; + case 24: + format = COP_DEPTH_24_32; + break; + case 32: + format = COP_DEPTH_24_32; + break; + } + /* + * compute a few things which will be set every time the + * accelerator is used; this avoids problems with APM + */ + tridentc->cop_depth = COP_MULTI_DEPTH | format; + tridentc->cop_stride = COP_MULTI_STRIDE | (stride << 16) | (stride); + +#define NUM_TRIES 100000 + for (tries = 0; tries < NUM_TRIES; tries++) + if (!(cop->status & COP_STATUS_BUSY)) + break; + if (cop->status & COP_STATUS_BUSY) + FatalError ("Can't initialize graphics coprocessor"); + cop->multi = COP_MULTI_CLIP_TOP_LEFT; + cop->multi = COP_MULTI_MASK | 0; + cop->src_offset = 0; + cop->dst_offset = 0; + cop->z_offset = 0; + cop->clip_bottom_right = 0x0fff0fff; + + _tridentInit(cop,tridentc); + _tridentSetSolidRect(cop, pScreen->blackPixel, GXcopy, cmd); + _tridentRect (cop, 0, 0, + pScreenPriv->screen->width, pScreenPriv->screen->height, + cmd); + KdMarkSync (pScreen); +} + +void +tridentDrawDisable (ScreenPtr pScreen) +{ +} + +void +tridentDrawFini (ScreenPtr pScreen) +{ +} + +void +tridentDrawSync (ScreenPtr pScreen) +{ + SetupTrident(pScreen); + + _tridentWaitIdleEmpty(cop); +} --- xorg-server-1.4.2.orig/hw/kdrive/trident/tridentdraw.h +++ xorg-server-1.4.2/hw/kdrive/trident/tridentdraw.h @@ -0,0 +1,69 @@ +/* + * 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. + */ + +#ifndef _TRIDENTDRAW_H_ +#define _TRIDENTDRAW_H_ + +#define SetupTrident(s) KdScreenPriv(s); \ + tridentCardInfo(pScreenPriv); \ + Cop *cop = tridentc->cop + +#define TridentAlpha (COP_MULTI_ALPHA|COP_ALPHA_WRITE_ENABLE) + +#define _tridentInit(cop,tridentc) { \ + if ((cop)->status == 0xffffffff) tridentSetMMIO(tridentc); \ + (cop)->multi = (tridentc)->cop_depth; \ + (cop)->multi = (tridentc)->cop_stride; \ + (cop)->multi = TridentAlpha; \ +} \ + +#define _tridentSetSolidRect(cop,pix,alu,cmd) {\ + cop->multi = COP_MULTI_PATTERN; \ + cop->multi = COP_MULTI_ROP | tridentRop[alu]; \ + cop->fg = (pix); \ + cmd = COP_OP_BLT | COP_SCL_OPAQUE | COP_OP_ROP | COP_OP_FG; \ +} + +#define _tridentRect(cop,x1,y1,x2,y2,cmd) { \ + (cop)->dst_start_xy = TRI_XY (x1,y1); \ + (cop)->dst_end_xy = TRI_XY(x2,y2); \ + _tridentWaitDone(cop); \ + (cop)->command = (cmd); \ +} + +#define COP_STATUS_BUSY (COP_STATUS_BE_BUSY | \ + COP_STATUS_DPE_BUSY | \ + COP_STATUS_MI_BUSY) + +#define _tridentWaitDone(cop) { \ + int __q__ = 500000; \ + while (__q__-- && (cop)->status & COP_STATUS_BUSY) \ + ; \ + if (!__q__) \ + (cop)->status = 0; \ +} + +#define _tridentWaitIdleEmpty(cop) _tridentWaitDone(cop) + +#define sourceInvarient(alu) (((alu) & 3) == (((alu) >> 2) & 3)) + +#endif --- xorg-server-1.4.2.orig/hw/kdrive/trident/trident.h +++ xorg-server-1.4.2/hw/kdrive/trident/trident.h @@ -0,0 +1,269 @@ +/* + * 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. + */ + +#ifndef _TRIDENT_H_ +#define _TRIDENT_H_ +#ifdef VESA +#include +#else +#include +#endif + +/* + * offset from ioport beginning + */ + +#ifdef USE_PCI +#define TRIDENT_COP_BASE(c) (c->attr.address[1]) +#define TRIDENT_COP_OFF(c) 0x2100 +#define TRIDENT_COP_SIZE(c) 0x20000 +#else +#define TRIDENT_COP_BASE(c) 0xbf000 +#define TRIDENT_COP_OFF(c) 0x00f00 +#define TRIDENT_COP_SIZE(c) (0x2000) +#endif + +typedef volatile CARD8 VOL8; +typedef volatile CARD16 VOL16; +typedef volatile CARD32 VOL32; + +typedef struct _cop { + VOL32 src_start_xy; /* 0x00 */ + VOL32 src_end_xy; /* 0x04 */ + VOL32 dst_start_xy; /* 0x08 */ + VOL32 dst_end_xy; /* 0x0c */ + VOL32 alpha; /* 0x10 */ + CARD8 pad14[0xc]; /* 0x14 */ + VOL32 multi; /* 0x20 */ + +#define COP_MULTI_CLIP_TOP_LEFT 0x10000000 +#define COP_MULTI_DEPTH 0x40000000 +#define COP_MULTI_COLOR_KEY 0x70000000 +#define COP_MULTI_STYLE 0x50000000 +#define COP_MULTI_PATTERN 0x80000000 +#define COP_MULTI_ROP 0x90000000 +#define COP_MULTI_STRIDE 0x60000000 +#define COP_MULTI_Z 0xa0000000 +#define COP_MULTI_ALPHA 0xb0000000 +#define COP_MULTI_TEXTURE 0xd0000000 +#define COP_MULTI_TEXTURE_BOUND 0xe0000000 +#define COP_MULTI_TEXTURE_ADVANCED 0x20000000 +#define COP_MULTI_MASK 0xf0000000 + +#define COP_DEPTH_8 0x00000000 +#define COP_DEPTH_16 0x00000001 +#define COP_DEPTH_24_32 0x00000002 +#define COP_DEPTH_15 0x00000005 +#define COP_DEPTH_DITHER_DISABLE 0x00000008 + + +#define COP_ALPHA_SRC_BLEND_0 0x00000000 +#define COP_ALPHA_SRC_BLEND_1 0x00000001 +#define COP_ALPHA_SRC_BLEND_SRC_C 0x00000002 +#define COP_ALPHA_SRC_BLEND_1_SRC_C 0x00000003 +#define COP_ALPHA_SRC_BLEND_SRC_A 0x00000004 +#define COP_ALPHA_SRC_BLEND_1_SRC_A 0x00000005 +#define COP_ALPHA_SRC_BLEND_DST_A 0x00000006 +#define COP_ALPHA_SRC_BLEND_1_DST_A 0x00000007 +#define COP_ALPHA_SRC_BLEND_DST_C 0x00000008 +#define COP_ALPHA_SRC_BLEND_1_DST_C 0x00000009 +#define COP_ALPHA_SRC_BLEND_SAT 0x0000000A +#define COP_ALPHA_SRC_BLEND_BG 0x0000000B + +#define COP_ALPHA_DST_BLEND_0 0x00000000 +#define COP_ALPHA_DST_BLEND_1 0x00000010 +#define COP_ALPHA_DST_BLEND_SRC_C 0x00000020 +#define COP_ALPHA_DST_BLEND_1_SRC_C 0x00000030 +#define COP_ALPHA_DST_BLEND_SRC_A 0x00000040 +#define COP_ALPHA_DST_BLEND_1_SRC_A 0x00000050 +#define COP_ALPHA_DST_BLEND_DST_A 0x00000060 +#define COP_ALPHA_DST_BLEND_1_DST_A 0x00000070 +#define COP_ALPHA_DST_BLEND_DST_C 0x00000080 +#define COP_ALPHA_DST_BLEND_1_DST_C 0x00000090 +#define COP_ALPHA_DST_BLEND_OTHER 0x000000A0 + +#define COP_ALPHA_RESULT_ALPHA 0x00100000 +#define COP_ALPHA_DEST_ALPHA 0x00200000 +#define COP_ALPHA_SOURCE_ALPHA 0x00400000 +#define COP_ALPHA_WRITE_ENABLE 0x00800000 +#define COP_ALPHA_TEST_ENABLE 0x01000000 +#define COP_ALPHA_BLEND_ENABLE 0x02000000 +#define COP_ALPHA_DEST_VALUE 0x04000000 +#define COP_ALPHA_SOURCE_VALUE 0x08000000 + + VOL32 command; /* 0x24 */ +#define COP_OP_NULL 0x00000000 +#define COP_OP_LINE 0x20000000 +#define COP_OP_BLT 0x80000000 +#define COP_OP_TEXT 0x90000000 +#define COP_OP_POLY 0xb0000000 +#define COP_OP_POLY2 0xe0000000 +#define COP_SCL_EXPAND 0x00800000 +#define COP_SCL_OPAQUE 0x00400000 +#define COP_SCL_REVERSE 0x00200000 +#define COP_SCL_MONO_OFF 0x001c0000 +#define COP_LIT_TEXTURE 0x00004000 +#define COP_BILINEAR 0x00002000 +#define COP_OP_ZBUF 0x00000800 +#define COP_OP_ROP 0x00000400 +#define COP_OP_FG 0x00000200 +#define COP_OP_FB 0x00000080 +#define COP_X_REVERSE 0x00000004 +#define COP_CLIP 0x00000001 + VOL32 texture_format; /* 0x28 */ + CARD8 pad2c[0x4]; /* 0x2c */ + + VOL32 clip_bottom_right; /* 0x30 */ + VOL32 dataIII; /* 0x34 */ + VOL32 dataIV; /* 0x38 */ + CARD8 pad3c[0x8]; /* 0x3c */ + + VOL32 fg; /* 0x44 */ + VOL32 bg; /* 0x48 */ + CARD8 pad4c[0x4]; /* 0x4c */ + + VOL32 pattern_fg; /* 0x50 */ + VOL32 pattern_bg; /* 0x54 */ + CARD8 pad58[0xc]; /* 0x58 */ + + VOL32 status; /* 0x64 */ +#define COP_STATUS_BE_BUSY 0x80000000 +#define COP_STATUS_DPE_BUSY 0x20000000 +#define COP_STATUS_MI_BUSY 0x10000000 +#define COP_STATUS_FIFO_BUSY 0x08000000 +#define COP_STATUS_WB_BUSY 0x00800000 +#define COP_STATUS_Z_FAILED 0x00400000 +#define COP_STATUS_EFFECTIVE 0x00200000 +#define COP_STATUS_LEFT_VIEW 0x00080000 + + CARD8 pad68[0x4]; /* 0x68 */ + + VOL32 src_offset; /* 0x6c */ + VOL32 z_offset; /* 0x70 */ + CARD8 pad74[0x4]; /* 0x74 */ + + VOL32 display_offset; /* 0x78 */ + VOL32 dst_offset; /* 0x7c */ + CARD8 pad80[0x34]; /* 0x80 */ + + VOL32 semaphore; /* 0xb4 */ +} Cop; + +#define TRI_XY(x,y) ((y) << 16 | (x)) + +typedef struct _tridentSave { + CARD8 reg_3c4_0e; /* config port value */ + CARD8 reg_3d4_36; + CARD8 reg_3d4_39; + CARD8 reg_3d4_62; /* GE setup */ + CARD8 reg_3ce_21; /* DPMS */ + CARD8 reg_3c2; /* clock config */ + CARD8 reg_3c4_16; /* MCLKLow */ + CARD8 reg_3c4_17; /* MCLKHigh */ + CARD8 reg_3c4_18; /* ClockLow */ + CARD8 reg_3c4_19; /* ClockHigh */ +} TridentSave; + +typedef struct _tridentCardInfo { +#ifdef VESA + VesaCardPrivRec vesa; +#else + FbdevPriv fb; +#endif + CARD8 *cop_base; + Cop *cop; + CARD32 *window; + CARD32 cop_depth; + CARD32 cop_stride; + Bool mmio; + TridentSave save; +} TridentCardInfo; + +#define getTridentCardInfo(kd) ((TridentCardInfo *) ((kd)->card->driver)) +#define tridentCardInfo(kd) TridentCardInfo *tridentc = getTridentCardInfo(kd) + +typedef struct _tridentCursor { + int width, height; + int xhot, yhot; + Bool has_cursor; + CursorPtr pCursor; + Pixel source, mask; +} TridentCursor; + +#define TRIDENT_CURSOR_WIDTH 64 +#define TRIDENT_CURSOR_HEIGHT 64 + +typedef struct _tridentScreenInfo { +#ifdef VESA + VesaScreenPrivRec vesa; +#else + FbdevScrPriv fbdev; +#endif + CARD8 *cursor_base; + CARD8 *screen; + CARD8 *off_screen; + int off_screen_size; + TridentCursor cursor; +} TridentScreenInfo; + +#define getTridentScreenInfo(kd) ((TridentScreenInfo *) ((kd)->screen->driver)) +#define tridentScreenInfo(kd) TridentScreenInfo *tridents = getTridentScreenInfo(kd) + +Bool +tridentDrawInit (ScreenPtr pScreen); + +void +tridentDrawEnable (ScreenPtr pScreen); + +void +tridentDrawSync (ScreenPtr pScreen); + +void +tridentDrawDisable (ScreenPtr pScreen); + +void +tridentDrawFini (ScreenPtr pScreen); + +CARD8 +tridentReadIndex (TridentCardInfo *tridentc, CARD16 port, CARD8 index); + +void +tridentWriteIndex (TridentCardInfo *tridentc, CARD16 port, CARD8 index, CARD8 value); + +Bool +tridentCursorInit (ScreenPtr pScreen); + +void +tridentCursorEnable (ScreenPtr pScreen); + +void +tridentCursorDisable (ScreenPtr pScreen); + +void +tridentCursorFini (ScreenPtr pScreen); + +void +tridentRecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef); + +extern KdCardFuncs tridentFuncs; + +#endif /* _TRIDENT_H_ */ --- xorg-server-1.4.2.orig/hw/kdrive/trident/tridentcurs.c +++ xorg-server-1.4.2/hw/kdrive/trident/tridentcurs.c @@ -0,0 +1,389 @@ +/* + * 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_CONFIG_H +#include +#endif +#include "trident.h" +#include "cursorstr.h" + +#define SetupCursor(s) KdScreenPriv(s); \ + tridentCardInfo(pScreenPriv); \ + tridentScreenInfo(pScreenPriv); \ + TridentCursor *pCurPriv = &tridents->cursor + +static void +_tridentMoveCursor (ScreenPtr pScreen, int x, int y) +{ + SetupCursor(pScreen); + CARD8 xlow, xhigh, ylow, yhigh; + CARD8 xoff, yoff; + + x -= pCurPriv->xhot; + xoff = 0; + if (x < 0) + { + xoff = -x; + x = 0; + } + y -= pCurPriv->yhot; + yoff = 0; + if (y < 0) + { + yoff = -y; + y = 0; + } + xlow = (CARD8) x; + xhigh = (CARD8) (x >> 8); + ylow = (CARD8) y; + yhigh = (CARD8) (y >> 8); + + + /* This is the recommended order to move the cursor */ + + tridentWriteIndex (tridentc, 0x3d4, 0x41, xhigh); + tridentWriteIndex (tridentc, 0x3d4, 0x40, xlow); + tridentWriteIndex (tridentc, 0x3d4, 0x42, ylow); + tridentWriteIndex (tridentc, 0x3d4, 0x46, xoff); + tridentWriteIndex (tridentc, 0x3d4, 0x47, yoff); + tridentWriteIndex (tridentc, 0x3d4, 0x43, yhigh); +} + +static void +tridentMoveCursor (ScreenPtr pScreen, int x, int y) +{ + SetupCursor (pScreen); + + if (!pCurPriv->has_cursor) + return; + + if (!pScreenPriv->enabled) + return; + + _tridentMoveCursor (pScreen, x, y); +} + +static void +tridentAllocCursorColors (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + CursorPtr pCursor = pCurPriv->pCursor; + + KdAllocateCursorPixels (pScreen, 0, pCursor, + &pCurPriv->source, &pCurPriv->mask); + switch (pScreenPriv->screen->fb[0].bitsPerPixel) { + case 4: + pCurPriv->source |= pCurPriv->source << 4; + pCurPriv->mask |= pCurPriv->mask << 4; + case 8: + pCurPriv->source |= pCurPriv->source << 8; + pCurPriv->mask |= pCurPriv->mask << 8; + case 16: + pCurPriv->source |= pCurPriv->source << 16; + pCurPriv->mask |= pCurPriv->mask << 16; + } +} + +static void +tridentSetCursorColors (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + CursorPtr pCursor = pCurPriv->pCursor; + CARD32 fg, bg; + + fg = pCurPriv->source; + bg = pCurPriv->mask; + tridentWriteIndex (tridentc, 0x3d4, 0x48, fg); + tridentWriteIndex (tridentc, 0x3d4, 0x49, fg >> 8); + tridentWriteIndex (tridentc, 0x3d4, 0x4a, fg >> 16); + + tridentWriteIndex (tridentc, 0x3d4, 0x4c, bg); + tridentWriteIndex (tridentc, 0x3d4, 0x4d, bg >> 8); + tridentWriteIndex (tridentc, 0x3d4, 0x4e, bg >> 16); +} + +void +tridentRecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef) +{ + SetupCursor (pScreen); + CursorPtr pCursor = pCurPriv->pCursor; + xColorItem sourceColor, maskColor; + + if (!pCurPriv->has_cursor || !pCursor) + return; + + if (!pScreenPriv->enabled) + return; + + if (pdef) + { + while (ndef) + { + if (pdef->pixel == pCurPriv->source || + pdef->pixel == pCurPriv->mask) + break; + ndef--; + } + if (!ndef) + return; + } + tridentAllocCursorColors (pScreen); + tridentSetCursorColors (pScreen); +} + +#define InvertBits32(v) { \ + v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \ + v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \ + v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \ +} + +static void +tridentLoadCursor (ScreenPtr pScreen, int x, int y) +{ + SetupCursor(pScreen); + CursorPtr pCursor = pCurPriv->pCursor; + CursorBitsPtr bits = pCursor->bits; + int w, h; + CARD32 *ram, *msk, *mskLine, *src, *srcLine; + int i, j; + int cursor_address; + int lwsrc; + unsigned char ramdac_control_; + CARD32 offset; + + /* + * Allocate new colors + */ + tridentAllocCursorColors (pScreen); + + pCurPriv->pCursor = pCursor; + pCurPriv->xhot = pCursor->bits->xhot; + pCurPriv->yhot = pCursor->bits->yhot; + + /* + * Stick new image into cursor memory + */ + ram = (CARD32 *) tridents->cursor_base; + mskLine = (CARD32 *) bits->mask; + srcLine = (CARD32 *) bits->source; + + h = bits->height; + if (h > TRIDENT_CURSOR_HEIGHT) + h = TRIDENT_CURSOR_HEIGHT; + + lwsrc = BitmapBytePad(bits->width) / 4; /* words per line */ + + for (i = 0; i < TRIDENT_CURSOR_HEIGHT; i++) { + msk = mskLine; + src = srcLine; + mskLine += lwsrc; + srcLine += lwsrc; + for (j = 0; j < TRIDENT_CURSOR_WIDTH / 32; j++) { + + CARD32 m, s; + +#if 1 + if (i < h && j < lwsrc) + { + m = *msk++; + s = *src++; + InvertBits32(m); + InvertBits32(s); + } + else + { + m = 0; + s = 0; + } +#endif + *ram++ = m; + *ram++ = s; + } + } + + /* Set address for cursor bits */ + offset = tridents->cursor_base - (CARD8 *) tridents->screen; + offset >>= 10; + tridentWriteIndex (tridentc, 0x3d4, 0x44, (CARD8) (offset & 0xff)); + tridentWriteIndex (tridentc, 0x3d4, 0x45, (CARD8) (offset >> 8)); + + /* Set new color */ + tridentSetCursorColors (pScreen); + + /* Enable the cursor */ + tridentWriteIndex (tridentc, 0x3d4, 0x50, 0xc1); + + /* Move to new position */ + tridentMoveCursor (pScreen, x, y); +} + +static void +tridentUnloadCursor (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + /* Disable cursor */ + tridentWriteIndex (tridentc, 0x3d4, 0x50, 0); +} + +static Bool +tridentRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) +{ + SetupCursor(pScreen); + + if (!pScreenPriv->enabled) + return TRUE; + + /* miRecolorCursor does this */ + if (pCurPriv->pCursor == pCursor) + { + if (pCursor) + { + int x, y; + + miPointerPosition (&x, &y); + tridentLoadCursor (pScreen, x, y); + } + } + return TRUE; +} + +static Bool +tridentUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) +{ + return TRUE; +} + +static void +tridentSetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y) +{ + SetupCursor(pScreen); + + pCurPriv->pCursor = pCursor; + + if (!pScreenPriv->enabled) + return; + + if (pCursor) + tridentLoadCursor (pScreen, x, y); + else + tridentUnloadCursor (pScreen); +} + +miPointerSpriteFuncRec tridentPointerSpriteFuncs = { + tridentRealizeCursor, + tridentUnrealizeCursor, + tridentSetCursor, + tridentMoveCursor, +}; + +static void +tridentQueryBestSize (int class, + unsigned short *pwidth, unsigned short *pheight, + ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + switch (class) + { + case CursorShape: + if (*pwidth > pCurPriv->width) + *pwidth = pCurPriv->width; + if (*pheight > pCurPriv->height) + *pheight = pCurPriv->height; + if (*pwidth > pScreen->width) + *pwidth = pScreen->width; + if (*pheight > pScreen->height) + *pheight = pScreen->height; + break; + default: + fbQueryBestSize (class, pwidth, pheight, pScreen); + break; + } +} + +Bool +tridentCursorInit (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + if (!tridents->cursor_base) + { + pCurPriv->has_cursor = FALSE; + return FALSE; + } + + pCurPriv->width = TRIDENT_CURSOR_WIDTH; + pCurPriv->height= TRIDENT_CURSOR_HEIGHT; + pScreen->QueryBestSize = tridentQueryBestSize; + miPointerInitialize (pScreen, + &tridentPointerSpriteFuncs, + &kdPointerScreenFuncs, + FALSE); + pCurPriv->has_cursor = TRUE; + pCurPriv->pCursor = NULL; + return TRUE; +} + +void +tridentCursorEnable (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + if (pCurPriv->has_cursor) + { + if (pCurPriv->pCursor) + { + int x, y; + + miPointerPosition (&x, &y); + tridentLoadCursor (pScreen, x, y); + } + else + tridentUnloadCursor (pScreen); + } +} + +void +tridentCursorDisable (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + if (!pScreenPriv->enabled) + return; + + if (pCurPriv->has_cursor) + { + if (pCurPriv->pCursor) + { + tridentUnloadCursor (pScreen); + } + } +} + +void +tridentCursorFini (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + pCurPriv->pCursor = NULL; +} --- xorg-server-1.4.2.orig/hw/kdrive/trident/trident.c +++ xorg-server-1.4.2/hw/kdrive/trident/trident.c @@ -0,0 +1,612 @@ +/* + * 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_CONFIG_H +#include +#endif +#include "trident.h" +#include + +#undef TRI_DEBUG + +int trident_clk = 0; +int trident_mclk = 0; + +#define CLOCK 14318 /* KHz */ +#define CLK_N(a,b) (a & 0xff) +#define CLK_M(a,b) ((b) & 0x3f) +#define CLK_K(a,b) (((b) >> 6) & 3) +#define CLK_FREQ(a,b) (((CLK_N(a,b) + 8) * CLOCK) / ((CLK_M(a,b)+2) << CLK_K(a,b))) + +Bool +tridentCardInit (KdCardInfo *card) +{ + int k; + char *pixels; + TridentCardInfo *tridentc; + CARD8 r39; + + tridentc = (TridentCardInfo *) xalloc (sizeof (TridentCardInfo)); + if (!tridentc) + return FALSE; + + iopl (3); + tridentc->cop_base = (CARD8 *) KdMapDevice (TRIDENT_COP_BASE(card), + TRIDENT_COP_SIZE(card)); + + if (tridentc->cop_base) + { + KdSetMappedMode (TRIDENT_COP_BASE(card), + TRIDENT_COP_SIZE(card), + KD_MAPPED_MODE_REGISTERS); + } + tridentc->cop = (Cop *) (tridentc->cop_base + TRIDENT_COP_OFF(card)); + tridentc->mmio = FALSE; + r39 = tridentReadIndex (tridentc, 0x3d4, 0x39); + if (r39 & 1) + { + tridentc->mmio = TRUE; + r39 = tridentReadIndex (tridentc, 0x3d4, 0x39); + if ((r39 & 1) == 0) + { + ErrorF ("Trident: inconsisent IO mapping values\n"); + return FALSE; + } + } + +#ifdef VESA + if (!vesaInitialize (card, &tridentc->vesa)) +#else + if (!fbdevInitialize (card, &tridentc->fb)) +#endif + { + xfree (tridentc); + return FALSE; + } + +#ifdef USE_PCI + tridentc->window = (CARD32 *) (tridentc->cop_base + 0x10000); +#else + tridentc->window = 0; +#endif + card->driver = tridentc; + + return TRUE; +} + +Bool +tridentScreenInit (KdScreenInfo *screen) +{ + TridentCardInfo *tridentc = screen->card->driver; + TridentScreenInfo *tridents; + int screen_size, memory; + + tridents = (TridentScreenInfo *) xalloc (sizeof (TridentScreenInfo)); + if (!tridents) + return FALSE; + memset (tridents, '\0', sizeof (TridentScreenInfo)); +#ifdef VESA + if (!vesaScreenInitialize (screen, &tridents->vesa)) +#else + if (!fbdevScreenInitialize (screen, &tridents->fbdev)) +#endif + { + xfree (tridents); + return FALSE; + } + if (!tridentc->cop) + screen->dumb = TRUE; +#ifdef VESA + if (tridents->vesa.mapping != VESA_LINEAR) + screen->dumb = TRUE; + tridents->screen = tridents->vesa.fb; + memory = tridents->vesa.fb_size; +#else + tridents->screen = tridentc->fb.fb; + memory = (2048 + 512) * 1024; +#endif + screen_size = screen->fb[0].byteStride * screen->height; + if (tridents->screen && memory >= screen_size + 2048) + { + memory -= 2048; + tridents->cursor_base = tridents->screen + memory - 2048; + } + else + tridents->cursor_base = 0; + memory -= screen_size; + if (memory > screen->fb[0].byteStride) + { + tridents->off_screen = tridents->screen + screen_size; + tridents->off_screen_size = memory; + } + else + { + tridents->off_screen = 0; + tridents->off_screen_size = 0; + } + screen->driver = tridents; + return TRUE; +} + +Bool +tridentInitScreen (ScreenPtr pScreen) +{ +#ifdef VESA + return vesaInitScreen (pScreen); +#else + return fbdevInitScreen (pScreen); +#endif +} + +Bool +tridentFinishInitScreen (ScreenPtr pScreen) +{ +#ifdef VESA + return vesaFinishInitScreen (pScreen); +#endif +} + +CARD8 +tridentReadIndex (TridentCardInfo *tridentc, CARD16 port, CARD8 index) +{ + CARD8 value; + + if (tridentc->mmio) + { + tridentc->cop_base[port] = index; + value = tridentc->cop_base[port+1]; + } + else + { + outb (index, port); + value = inb (port+1); + } + return value; +} + +void +tridentWriteIndex (TridentCardInfo *tridentc, CARD16 port, CARD8 index, CARD8 value) +{ + if (tridentc->mmio) + { + tridentc->cop_base[port] = index; + tridentc->cop_base[port+1] = value; + } + else + { + outb (index, port); + outb (value, port+1); + } +} + +CARD8 +tridentReadReg (TridentCardInfo *tridentc, CARD16 port) +{ + CARD8 value; + + if (tridentc->mmio) + { + value = tridentc->cop_base[port]; + } + else + { + value = inb (port); + } + return value; +} + +void +tridentWriteReg (TridentCardInfo *tridentc, CARD16 port, CARD8 value) +{ + if (tridentc->mmio) + { + tridentc->cop_base[port] = value; + } + else + { + outb (value, port); + } +} + + +void +tridentPause () +{ + struct timeval tv; + + tv.tv_sec = 0; + tv.tv_usec = 50 * 1000; + select (1, 0, 0, 0, &tv); +} + +void +tridentPreserve (KdCardInfo *card) +{ + TridentCardInfo *tridentc = card->driver; + +#ifdef VESA + vesaPreserve(card); +#else + fbdevPreserve (card); +#endif + tridentPause (); + tridentc->save.reg_3c4_0e = tridentReadIndex (tridentc, 0x3c4, 0x0e); + tridentc->save.reg_3d4_36 = tridentReadIndex (tridentc, 0x3d4, 0x36); + tridentc->save.reg_3d4_39 = tridentReadIndex (tridentc, 0x3d4, 0x39); + tridentc->save.reg_3d4_62 = tridentReadIndex (tridentc, 0x3d4, 0x62); + tridentc->save.reg_3ce_21 = tridentReadIndex (tridentc, 0x3ce, 0x21); + tridentc->save.reg_3c2 = tridentReadReg (tridentc, 0x3cc); + tridentc->save.reg_3c4_16 = tridentReadIndex (tridentc, 0x3c4, 0x16); + tridentc->save.reg_3c4_17 = tridentReadIndex (tridentc, 0x3c4, 0x17); + tridentc->save.reg_3c4_18 = tridentReadIndex (tridentc, 0x3c4, 0x18); + tridentc->save.reg_3c4_19 = tridentReadIndex (tridentc, 0x3c4, 0x19); + ErrorF ("clk low 0x%x high 0x%x freq %d\n", + tridentc->save.reg_3c4_18, + tridentc->save.reg_3c4_19, + CLK_FREQ(tridentc->save.reg_3c4_18, + tridentc->save.reg_3c4_19)); +#ifdef TRI_DEBUG + fprintf (stderr, "3c4 0e: %02x\n", tridentc->save.reg_3c4_0e); + fprintf (stderr, "3d4 36: %02x\n", tridentc->save.reg_3d4_36); + fprintf (stderr, "3d4 39: %02x\n", tridentc->save.reg_3d4_39); + fprintf (stderr, "3d4 62: %02x\n", tridentc->save.reg_3d4_62); + fprintf (stderr, "3ce 21: %02x\n", tridentc->save.reg_3ce_21); + fflush (stderr); +#endif + tridentPause (); +} + +void +tridentSetCLK(int clock, CARD8 *a, CARD8 *b) +{ + int powerup[4] = { 1,2,4,8 }; + int clock_diff = 750; + int freq, ffreq; + int m, n, k; + int p, q, r, s; + int startn, endn; + int endm, endk; + + p = q = r = s = 0; + + startn = 64; + endn = 255; + endm = 63; + endk = 3; + + freq = clock; + + for (k=0;k<=endk;k++) + for (n=startn;n<=endn;n++) + for (m=1;m<=endm;m++) + { + ffreq = ( ( ((n + 8) * CLOCK) / ((m + 2) * powerup[k]) )); + if ((ffreq > freq - clock_diff) && (ffreq < freq + clock_diff)) + { + clock_diff = (freq > ffreq) ? freq - ffreq : ffreq - freq; + p = n; q = m; r = k; s = ffreq; + } + } + + ErrorF ("ffreq %d clock %d\n", s, clock); + if (s == 0) + { + FatalError("Unable to set programmable clock.\n" + "Frequency %d is not a valid clock.\n" + "Please modify XF86Config for a new clock.\n", + freq); + } + + /* N is all 8bits */ + *a = p; + /* M is first 6bits, with K last 2bits */ + *b = (q & 0x3F) | (r << 6); +} + +void +tridentSetMCLK(int clock, CARD8 *a, CARD8 *b) +{ + int powerup[4] = { 1,2,4,8 }; + int clock_diff = 750; + int freq, ffreq; + int m,n,k; + int p, q, r, s; + int startn, endn; + int endm, endk; + + p = q = r = s = 0; + + startn = 64; + endn = 255; + endm = 63; + endk = 3; + + freq = clock; + + for (k=0;k<=endk;k++) + for (n=startn;n<=endn;n++) + for (m=1;m<=endm;m++) { + ffreq = ((((n+8)*CLOCK)/((m+2)*powerup[k]))); + if ((ffreq > freq - clock_diff) && (ffreq < freq + clock_diff)) + { + clock_diff = (freq > ffreq) ? freq - ffreq : ffreq - freq; + p = n; q = m; r = k; s = ffreq; + } + } + + if (s == 0) + { + FatalError("Unable to set memory clock.\n" + "Frequency %d is not a valid clock.\n" + "Please modify XF86Config for a new clock.\n", + freq); + } + + /* N is all 8bits */ + *a = p; + /* M is first 6bits, with K last 2bits */ + *b = (q & 0x3F) | (r << 6); +} + +void +tridentSetMMIO (TridentCardInfo *tridentc) +{ + int tries; + CARD8 v; + +#ifdef TRI_DEBUG + fprintf (stderr, "Set MMIO\n"); +#endif + /* enable config port writes */ + for (tries = 0; tries < 3; tries++) + { + /* enable direct read when GE busy, enable PCI retries */ + tridentWriteIndex (tridentc, 0x3d4, 0x62, + tridentc->save.reg_3d4_62 | 0x70); + /* make sure the chip is in new mode */ + tridentReadIndex (tridentc, 0x3c4, 0xb); + /* enable access to upper registers */ + tridentWriteIndex (tridentc, 0x3c4, 0xe, + tridentc->save.reg_3c4_0e | 0x80); + v = tridentReadIndex (tridentc, 0x3c4, 0xe); + if (!(v & 0x80)) + { + fprintf (stderr, "Trident GE not enabled 0x%x\n", v); + continue; + } + /* enable screen */ + tridentWriteIndex (tridentc, 0x3ce, 0x21, 0x80); +#ifdef USE_PCI + /* enable burst r/w, enable memory mapped ports */ + tridentWriteIndex (tridentc, 0x3d4, 0x39, 7); + tridentc->mmio = TRUE; + /* reset GE, enable GE, set GE to pci 1 */ + tridentWriteIndex (tridentc, 0x3d4, 0x36, 0x90); +#else + /* enable burst r/w, disable memory mapped ports */ + tridentWriteIndex (tridentc, 0x3d4, 0x39, 0x6); + /* reset GE, enable GE, set GE to 0xbff00 */ + tridentWriteIndex (tridentc, 0x3d4, 0x36, 0x92); +#endif + /* set clock */ + if (trident_clk) + { + CARD8 a, b; + + a = tridentReadIndex (tridentc, 0x3c4, 0x18); + b = tridentReadIndex (tridentc, 0x3c4, 0x19); + ErrorF ("old clock 0x%x 0x%x %d\n", + a, b, CLK_FREQ(a,b)); + tridentSetCLK (trident_clk, &a, &b); + ErrorF ("clk %d-> 0x%x 0x%x %d\n", trident_clk, a, b, + CLK_FREQ(a,b)); +#if 1 + tridentWriteIndex (tridentc, 0x3c4, 0x18, a); + tridentWriteIndex (tridentc, 0x3c4, 0x19, b); +#endif + } + if (trident_mclk) + { + CARD8 a, b; + + tridentSetMCLK (trident_mclk, &a, &b); + ErrorF ("mclk %d -> 0x%x 0x%x\n", trident_mclk, a, b); +#if 0 + tridentWriteIndex (tridentc, 0x3c4, 0x16, a); + tridentWriteIndex (tridentc, 0x3c4, 0x17, b); +#endif + } + if (trident_clk || trident_mclk) + { + CARD8 mode; + + mode = tridentReadReg (tridentc, 0x3cc); + ErrorF ("old mode 0x%x\n", mode); + mode = (mode & 0xf3) | 0x08; + ErrorF ("new mode 0x%x\n", mode); +#if 1 + tridentWriteReg (tridentc, 0x3c2, mode); +#endif + } +#ifdef TRI_DEBUG + fprintf (stderr, "0x36: 0x%02x\n", + tridentReadIndex (tridentc, 0x3d4, 0x36)); +#endif + if (tridentc->cop->status != 0xffffffff) + break; + } +#ifdef TRI_DEBUG + fprintf (stderr, "COP status 0x%x\n", tridentc->cop->status); +#endif + if (tridentc->cop->status == 0xffffffff) + FatalError ("Trident COP not visible\n"); +} + +void +tridentResetMMIO (TridentCardInfo *tridentc) +{ +#ifdef TRI_DEBUG + fprintf (stderr, "Reset MMIO\n"); +#endif + tridentPause (); +#if 0 + tridentWriteIndex (tridentc, 0x3c4, 0x16, tridentc->save.reg_3c4_16); + tridentWriteIndex (tridentc, 0x3c4, 0x17, tridentc->save.reg_3c4_17); +#endif + tridentWriteIndex (tridentc, 0x3c4, 0x18, tridentc->save.reg_3c4_18); + tridentWriteIndex (tridentc, 0x3c4, 0x19, tridentc->save.reg_3c4_19); + tridentWriteReg (tridentc, 0x3c2, tridentc->save.reg_3c2); + tridentPause (); + tridentWriteIndex (tridentc, 0x3ce, 0x21, tridentc->save.reg_3ce_21); + tridentPause (); + tridentWriteIndex (tridentc, 0x3d4, 0x62, tridentc->save.reg_3d4_62); + tridentWriteIndex (tridentc, 0x3d4, 0x39, tridentc->save.reg_3d4_39); + tridentc->mmio = FALSE; + tridentWriteIndex (tridentc, 0x3d4, 0x36, tridentc->save.reg_3d4_36); + tridentWriteIndex (tridentc, 0x3c4, 0x0e, tridentc->save.reg_3c4_0e); + tridentPause (); +} + +Bool +tridentEnable (ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + TridentCardInfo *tridentc = pScreenPriv->card->driver; + +#ifdef VESA + if (!vesaEnable (pScreen)) + return FALSE; +#else + if (!fbdevEnable (pScreen)) + return FALSE; +#endif + tridentSetMMIO (tridentc); + return TRUE; +} + +void +tridentDisable (ScreenPtr pScreen) +{ +#ifdef VESA + vesaDisable (pScreen); +#else + fbdevDisable (pScreen); +#endif +} + +const CARD8 tridentDPMSModes[4] = { + 0x80, /* KD_DPMS_NORMAL */ + 0x8c, /* KD_DPMS_STANDBY */ + 0x8c, /* KD_DPMS_STANDBY */ + 0x8c, /* KD_DPMS_STANDBY */ +/* 0xb0, /* KD_DPMS_SUSPEND */ +/* 0xbc, /* KD_DPMS_POWERDOWN */ +}; + +Bool +tridentDPMS (ScreenPtr pScreen, int mode) +{ + KdScreenPriv(pScreen); + TridentCardInfo *tridentc = pScreenPriv->card->driver; + + tridentWriteIndex (tridentc, 0x3ce, 0x21, tridentDPMSModes[mode]); + tridentPause (); + return TRUE; +} + +void +tridentRestore (KdCardInfo *card) +{ + TridentCardInfo *tridentc = card->driver; + + tridentResetMMIO (tridentc); +#ifdef VESA + vesaRestore (card); +#else + fbdevRestore (card); +#endif +} + +void +tridentScreenFini (KdScreenInfo *screen) +{ + TridentScreenInfo *tridents = (TridentScreenInfo *) screen->driver; + +#ifdef VESA + vesaScreenFini (screen); +#endif + xfree (tridents); + screen->driver = 0; +} + +void +tridentCardFini (KdCardInfo *card) +{ + TridentCardInfo *tridentc = card->driver; + + if (tridentc->cop_base) + { + KdUnmapDevice ((void *) tridentc->cop_base, TRIDENT_COP_SIZE(card)); + KdResetMappedMode (TRIDENT_COP_BASE(card), + TRIDENT_COP_SIZE(card), + KD_MAPPED_MODE_REGISTERS); + } +#ifdef VESA + vesaCardFini (card); +#else + fbdevCardFini (card); +#endif +} + +KdCardFuncs tridentFuncs = { + tridentCardInit, /* cardinit */ + tridentScreenInit, /* scrinit */ + tridentInitScreen, /* initScreen */ + tridentPreserve, /* preserve */ + tridentEnable, /* enable */ + tridentDPMS, /* dpms */ + tridentDisable, /* disable */ + tridentRestore, /* restore */ + tridentScreenFini, /* scrfini */ + tridentCardFini, /* cardfini */ + + tridentCursorInit, /* initCursor */ + tridentCursorEnable, /* enableCursor */ + tridentCursorDisable, /* disableCursor */ + tridentCursorFini, /* finiCursor */ + tridentRecolorCursor, /* recolorCursor */ + + tridentDrawInit, /* initAccel */ + tridentDrawEnable, /* enableAccel */ + tridentDrawSync, /* syncAccel */ + tridentDrawDisable, /* disableAccel */ + tridentDrawFini, /* finiAccel */ + +#ifdef VESA + vesaGetColors, /* getColors */ + vesaPutColors, /* putColors */ +#else + fbdevGetColors, /* getColors */ + fbdevPutColors, /* putColors */ +#endif + tridentFinishInitScreen /* finishInitScreen */ +}; --- xorg-server-1.4.2.orig/hw/kdrive/i810/Makefile.in +++ xorg-server-1.4.2/hw/kdrive/i810/Makefile.in @@ -152,7 +152,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -286,10 +286,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/kdrive/mga/Makefile.in +++ xorg-server-1.4.2/hw/kdrive/mga/Makefile.in @@ -152,7 +152,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -286,10 +286,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/kdrive/vesa/Xvesa.man +++ xorg-server-1.4.2/hw/kdrive/vesa/Xvesa.man @@ -0,0 +1,105 @@ +.\" $RCSId: xc/programs/Xserver/hw/kdrive/vesa/Xvesa.man,v 1.5 2001/01/24 00:06:10 dawes Exp $ +.TH Xvesa 1 __vendorversion__ +.SH NAME +Xvesa \- VESA Bios Extensions tiny X server +.SH SYNOPSIS +.B Xvesa +.RI [ :display ] +.RI [ option ...] +.SH DESCRIPTION +.B Xvesa +is a generic X server for Linux on the x86 platform. +.B Xvesa +doesn't know about any particular hardware, and sets the video mode by +running the video BIOS in VM86 mode. +.B Xvesa +can use both standard VGA BIOS modes and any modes advertised by a +VESA BIOS if available. + +.B Xvesa +runs untrusted code with full privileges, and is therefore a fairly +insecure X server. +.B Run at your own risk. +.SH OPTIONS +In addition to the normal KDrive server's options (see Xkdrive(1)), +.B Xvesa +accepts the following command line switches: +.TP 8 +.B -mode \fIn\fB +specifies the VESA video mode to use. If mode +.I n +is not supported by your BIOS and hardware, +.B Xvesa +will fail, hang your system, damage your hardware, or cause a global +thermonuclear war; you are on your own. This option overrides any +.B -screen +options. +.TP 8 +.B -listmodes +list all supported video modes. If +.B -force +was specified before +.BR -listmodes , +lists all the modes that your BIOS claims to support, even those that +the +.B Xvesa +server won't be able to use. +.TP 8 +.B -force +disable some sanity checks and use the specified mode even if the +BIOS claims not to support it. +.TP 8 +.B -shadow +use a shadow framebuffer even if it is not strictly necessary. This +may dramatically improve performance on some hardware. +.TP 8 +.B -nolinear +don't use a linear framebuffer even if one is available. You don't +want to use this option. +.TP 8 +.B -swaprgb +pass RGB values in the order that works on broken BIOSes. Use this if +the colours are wrong in PseudoColor and 16 colour modes. +.TP 8 +.B -map-holes +use a contiguous (hole-less) memory map. This fixes a segmentation +violation with some rare BIOSes that violate the VESA specification, +but may cause slightly higher memory usage on systems that overcommit +memory. +.TP 8 +.B -force-text +ignore saved video mode and switch back to regular 25x80 text mode +on server exit or VT switch. +.TP 8 +.B -verbose +emit diagnostic messages during BIOS initialization and teardown. +.SH KEYBOARD +Multiple key presses recognized directly by +.B Xvesa +are: +.TP 8 +.B Ctrl+Alt+Backspace +Immediately kill the server. +.TP 8 +.B Ctrl+Alt+F1...F12 +Switch to virtual console 1 through 12. +.SH BUGS +.B Xvesa +opens all IO ports and runs your VESA BIOS, which may be assumed to be +buggy. Allowing your users to run +.B Xvesa +is probably a security hole. + +.B Xvesa +records the current BIOS mode when it starts and restores that mode on +termination; if the video card has been reprogrammed by another application, +the display will almost certainly be trashed. The alternative of saving and +restoring the complete video card state has proven unreliable on most video +cards. +.SH SEE ALSO +X(__miscmansuffix__), Xserver(1), Xkdrive(1), xdm(1), xinit(1). +.SH AUTHORS +The VESA driver was written by Juliusz Chroboczek who didn't realise +what he was doing until it was too late. Keith Packard then added +support for standard VGA BIOS modes and is especially proud of 320x200 +16 colour mode. --- xorg-server-1.4.2.orig/hw/kdrive/vesa/Makefile.in +++ xorg-server-1.4.2/hw/kdrive/vesa/Makefile.in @@ -151,7 +151,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -285,10 +285,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/kdrive/trio/s3stub.c +++ xorg-server-1.4.2/hw/kdrive/trio/s3stub.c @@ -0,0 +1,66 @@ +/* + * Copyright 1999 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_CONFIG_H +#include +#endif +#include "s3.h" + +void +InitCard (char *name) +{ + KdCardAttr attr; + CARD32 count; + + count = 0; + while (LinuxFindPci (0x5333, 0x8904, count, &attr)) + { + KdCardInfoAdd (&s3Funcs, &attr, 0); + count++; + } +} + +void +InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) +{ + KdInitOutput (pScreenInfo, argc, argv); +} + +void +InitInput (int argc, char **argv) +{ + KdOsAddInputDrivers (); + KdInitInput (); +} + +void +ddxUseMsg (void) +{ + KdUseMsg(); +} + +int +ddxProcessArgument (int argc, char **argv, int i) +{ + return KdProcessArgument (argc, argv, i); +} --- xorg-server-1.4.2.orig/hw/kdrive/trio/s3.c +++ xorg-server-1.4.2/hw/kdrive/trio/s3.c @@ -0,0 +1,1013 @@ +/* + * 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_CONFIG_H +#include +#endif +#include "s3.h" + +#define REGISTERS_OFFSET (0x1000000) +#define PACKED_OFFSET (0x8100) + + +CARD8 +_s3ReadIndexRegister (volatile CARD8 *base, CARD8 index) +{ + CARD8 ret; + *base = index; + ret = *(base + 1); + DRAW_DEBUG ((DEBUG_CRTC, " 0x%3x 0x%02x -> 0x%02x", + ((int) base) & 0xfff, index, ret)); + return ret; +} + +void +_s3WriteIndexRegister (volatile CARD8 *base, CARD8 index, CARD8 value) +{ + DRAW_DEBUG ((DEBUG_CRTC, " 0x%3x 0x%02x <- 0x%02x", + ((int) base) & 0xfff, index, value)); + *base = index; + *(base + 1) = value; +} + +/* + * Map the S3 card and detect its configuration. Do not touch the card + */ + +static void +_s3LoadCrtc (S3Ptr s3, S3Crtc *crtc) +{ + crtc->h_total_0_7 = GetCrtc (s3, 0x00); + crtc->h_display_end_0_7 = GetCrtc (s3, 0x01); + crtc->h_blank_start_0_7 = GetCrtc (s3, 0x02); + crtc->_h_blank_end = GetCrtc (s3, 0x03); + crtc->h_sync_start_0_7 = GetCrtc (s3, 0x04); + crtc->_h_sync_end = GetCrtc (s3, 0x05); + crtc->v_total_0_7 = GetCrtc (s3, 0x06); + crtc->crtc_overflow = GetCrtc (s3, 0x07); + crtc->preset_row_scan = GetCrtc (s3, 0x08); + crtc->_max_scan_line = GetCrtc (s3, 0x09); + + crtc->start_address_8_15 = GetCrtc (s3, 0x0c); + crtc->start_address_0_7 = GetCrtc (s3, 0x0d); + + crtc->v_retrace_start_0_7 = GetCrtc (s3, 0x10); + crtc->_v_retrace_end = GetCrtc (s3, 0x11); + crtc->v_display_end_0_7 = GetCrtc (s3, 0x12); + crtc->screen_off_0_7 = GetCrtc (s3, 0x13); + + crtc->v_blank_start_0_7 = GetCrtc (s3, 0x15); + crtc->v_blank_end_0_7 = GetCrtc (s3, 0x16); + + crtc->line_compare_0_7 = GetCrtc (s3, 0x18); + + crtc->memory_configuration = GetCrtc (s3, 0x31); + + crtc->misc_1 = GetCrtc (s3, 0x3a); + crtc->h_start_fifo_fetch_0_7 = GetCrtc (s3, 0x3b); + + crtc->mode_control = GetCrtc (s3, 0x42); + + crtc->hardware_cursor_mode = GetCrtc (s3, 0x45); + crtc->cursor_address_8_15 = GetCrtc (s3, 0x4C); + crtc->cursor_address_0_7 = GetCrtc (s3, 0x4D); + + crtc->extended_system_control_1 = GetCrtc (s3, 0x50); + crtc->extended_system_control_2 = GetCrtc (s3, 0x51); + + crtc->extended_memory_control = GetCrtc (s3, 0x53); + + crtc->extended_ramdac_control = GetCrtc (s3, 0x55); + + crtc->extended_horizontal_overflow = GetCrtc (s3, 0x5d); + crtc->extended_vertical_overflow = GetCrtc (s3, 0x5e); + + crtc->l_parm_0_7 = GetCrtc (s3, 0x62); + + crtc->extended_misc_control = GetCrtc (s3, 0x65); + + crtc->extended_misc_control_2 = GetCrtc (s3, 0x67); + + crtc->configuration_3 = GetCrtc (s3, 0x68); + + crtc->extended_system_control_3 = GetCrtc (s3, 0x69); + + crtc->extended_bios_5 = GetCrtc (s3, 0x6d); + + crtc->extended_sequencer_b = GetSrtc (s3, 0x0b); + crtc->extended_sequencer_d = GetSrtc (s3, 0x0d); + crtc->dclk_value_low = GetSrtc (s3, 0x12); + crtc->dclk_value_high = GetSrtc (s3, 0x13); + crtc->control_2 = GetSrtc (s3, 0x15); + crtc->ramdac_control = GetSrtc (s3, 0x18); + +/* combine values */ + + switch (crtc_ge_screen_width(crtc)) { + case 0: + if (crtc->enable_two_page) + crtc->ge_screen_pitch = 2048; + else + crtc->ge_screen_pitch = 1024; + break; + case 1: + crtc->ge_screen_pitch = 640; + break; + case 2: + /* ignore magic 1600x1200x4 mode */ + crtc->ge_screen_pitch = 800; + break; + case 3: + crtc->ge_screen_pitch = 1280; + break; + case 4: + crtc->ge_screen_pitch = 1152; + break; + case 5: + crtc->ge_screen_pitch = 0; /* reserved */ + break; + case 6: + crtc->ge_screen_pitch = 1600; + break; + case 7: + crtc->ge_screen_pitch = 0; /* reserved */ + break; + } + switch (crtc->pixel_length) { + case 0: + crtc->bits_per_pixel = 8; + crtc->pixel_width = (crtc_h_display_end(crtc) + 1) * 8; + break; + case 1: + crtc->bits_per_pixel = 16; + crtc->pixel_width = (crtc_h_display_end(crtc) + 1) * 4; + break; + case 3: + crtc->bits_per_pixel = 32; + crtc->pixel_width = (crtc_h_display_end(crtc) + 1) * 8; + break; + } + crtc->double_pixel_mode = 0; + switch (crtc->color_mode) { + case 0x0: + crtc->depth = 8; break; + case 0x1: + crtc->depth = 8; crtc->double_pixel_mode = 1; break; + case 0x3: + crtc->depth = 15; break; + case 0x5: + crtc->depth = 16; break; + case 0x7: + crtc->depth = 24; break; /* unused */ + case 0xd: + crtc->depth = 24; break; + } +} + +static void +_s3SetBlank (S3Ptr s3, Bool blank) +{ + CARD8 clock_mode; + + DRAW_DEBUG ((DEBUG_S3INIT, "3c4 at 0x%x\n", &s3->crt_vga_3c4)); + clock_mode = _s3ReadIndexRegister (&s3->crt_vga_3c4, 0x01); + if (blank) + clock_mode |= 0x20; + else + clock_mode &= ~0x20; + _s3WaitVRetrace (s3); + _s3WriteIndexRegister (&s3->crt_vga_3c4, 0x01, clock_mode); + DRAW_DEBUG ((DEBUG_S3INIT, "blank is set to 0x%x", clock_mode)); +} + +static void +_s3SetDepth (S3Ptr s3, S3Crtc *crtc) +{ + CARD8 save_3c2; + _s3SetBlank (s3, TRUE); + PutCrtc(s3, 0x38, 0x48); + PutCrtc(s3, 0x39, 0xA0); + PutCrtc(s3, 0x00, crtc->h_total_0_7); + PutCrtc(s3, 0x01, crtc->h_display_end_0_7); + PutCrtc(s3, 0x02, crtc->h_blank_start_0_7); + PutCrtc(s3, 0x03, crtc->_h_blank_end); + PutCrtc(s3, 0x04, crtc->h_sync_start_0_7); + PutCrtc(s3, 0x05, crtc->_h_sync_end); + PutCrtc(s3, 0x06, crtc->v_total_0_7); + PutCrtc(s3, 0x07, crtc->crtc_overflow); + PutCrtc(s3, 0x09, crtc->_max_scan_line); + PutCrtc(s3, 0x0c, crtc->start_address_8_15); + PutCrtc(s3, 0x0d, crtc->start_address_0_7); + PutCrtc(s3, 0x10, crtc->v_retrace_start_0_7); + PutCrtc(s3, 0x11, crtc->_v_retrace_end); + PutCrtc(s3, 0x12, crtc->v_display_end_0_7); + PutCrtc(s3, 0x13, crtc->screen_off_0_7); + PutCrtc(s3, 0x15, crtc->v_blank_start_0_7); + PutCrtc(s3, 0x16, crtc->v_blank_end_0_7); + PutCrtc(s3, 0x18, crtc->line_compare_0_7); + PutCrtc(s3, 0x31, crtc->memory_configuration); + PutCrtc(s3, 0x3a, crtc->misc_1); + PutCrtc(s3, 0x3b, crtc->h_start_fifo_fetch_0_7); + PutCrtc(s3, 0x42, crtc->mode_control); + PutCrtc(s3, 0x45, crtc->hardware_cursor_mode); + PutCrtc(s3, 0x4c, crtc->cursor_address_8_15); + PutCrtc(s3, 0x4d, crtc->cursor_address_0_7); + PutCrtc(s3, 0x50, crtc->extended_system_control_1); + PutCrtc(s3, 0x51, crtc->extended_system_control_2); + PutCrtc(s3, 0x53, crtc->extended_memory_control); + PutCrtc(s3, 0x55, crtc->extended_ramdac_control); + PutCrtc(s3, 0x5d, crtc->extended_horizontal_overflow); + PutCrtc(s3, 0x5e, crtc->extended_vertical_overflow); + PutCrtc(s3, 0x62, crtc->l_parm_0_7); + PutCrtc(s3, 0x65, crtc->extended_misc_control); + PutCrtc(s3, 0x67, crtc->extended_misc_control_2); + PutCrtc(s3, 0x68, crtc->configuration_3); + PutCrtc(s3, 0x69, crtc->extended_system_control_3); + PutCrtc(s3, 0x6d, crtc->extended_bios_5); + PutCrtc(s3, 0x39, 0x00); + PutCrtc(s3, 0x38, 0x00); + PutSrtc(s3, 0x0b, crtc->extended_sequencer_b); + PutSrtc(s3, 0x0d, crtc->extended_sequencer_d); + /* + * Move new dclk/mclk values into PLL + */ + save_3c2 = s3->crt_vga_3cc; + DRAW_DEBUG ((DEBUG_S3INIT, "save_3c2 0x%x", save_3c2)); + s3->crt_vga_3c2 = save_3c2 | 0x0c; + + PutSrtc(s3, 0x12, crtc->dclk_value_low); + PutSrtc(s3, 0x13, crtc->dclk_value_high); + + DRAW_DEBUG ((DEBUG_S3INIT, "Set PLL load enable, frobbing clk_load...")); + crtc->dfrq_en = 1; + PutSrtc(s3, 0x15, crtc->control_2); + PutSrtc(s3, 0x18, crtc->ramdac_control); + + DRAW_DEBUG ((DEBUG_S3INIT, "Clk load frobbed, restoring 3c2 to 0x%x", save_3c2)); + s3->crt_vga_3c2 = save_3c2; + + DRAW_DEBUG ((DEBUG_S3INIT, "Enabling display")); + _s3SetBlank (s3, FALSE); +} + +void +_s3RestoreCrtc (S3Ptr s3, S3Crtc *crtc) +{ + _s3SetDepth (s3, crtc); +} + +s3Reset (S3CardInfo *s3c) +{ + S3Ptr s3 = s3c->s3; + S3Save *save = &s3c->save; + CARD8 *cursor_base; + + LockS3 (s3c); + + _s3UnlockExt (s3); + + _s3RestoreCrtc (s3, &save->crtc); + + /* set foreground */ + /* Reset cursor color stack pointers */ + (void) GetCrtc(s3, 0x45); + PutCrtc(s3, 0x4a, save->cursor_fg); + /* XXX for deeper screens? */ + + /* set background */ + /* Reset cursor color stack pointers */ + (void) GetCrtc(s3, 0x45); + PutCrtc(s3, 0x4b, save->cursor_bg); + + _s3LockExt (s3); + + /* graphics engine state */ + s3->alt_mix = save->alt_mix; + s3->write_mask = save->write_mask; + s3->fg = save->fg; + s3->bg = save->bg; + /* XXX should save and restore real values? */ + s3->scissors_tl = 0x00000000; + s3->scissors_br = 0x0fff0fff; + + _s3WriteIndexRegister (&s3->crt_vga_3c4, 0x01, save->clock_mode); + PutCrtc(s3, 0x39, save->lock2); + PutCrtc(s3, 0x38, save->lock1); + + UnlockS3 (s3c); +} + +void +s3Save (S3CardInfo *s3c) +{ + S3Ptr s3 = s3c->s3; + S3Save *save = &s3c->save; + S3Crtc newCrtc; + CARD8 t1, t2; + CARD8 *cursor_base; + + LockS3 (s3c); + + save->alt_mix = s3->alt_mix; + save->write_mask = s3->write_mask; + save->fg = s3->fg; + save->bg = s3->bg; + + save->lock1 = GetCrtc(s3, 0x38); + save->lock2 = GetCrtc(s3, 0x39); + save->clock_mode = _s3ReadIndexRegister (&s3->crt_vga_3c4, 0x01); + + _s3UnlockExt (s3); + save->cursor_fg = GetCrtc(s3, 0x4a); + save->cursor_bg = GetCrtc(s3, 0x4b); + + _s3LoadCrtc (s3, &save->crtc); + + _s3LockExt (s3); + + UnlockS3 (s3c); +} +Bool +s3CardInit (KdCardInfo *card) +{ + S3CardInfo *s3c; + S3Ptr s3; + int size; + CARD8 *registers; + CARD32 s3Address = card->attr.address[0]; + CARD8 *temp_buffer; + + DRAW_DEBUG ((DEBUG_S3INIT, "s3CardInit")); + s3c = (S3CardInfo *) xalloc (sizeof (S3CardInfo)); + if (!s3c) + { + DRAW_DEBUG ((DEBUG_FAILURE, "can't alloc s3 card info")); + goto bail0; + } + + memset (s3c, '\0', sizeof (S3CardInfo)); + + card->driver = s3c; + + fprintf (stderr, "S3 at 0x%x\n", s3Address); + registers = KdMapDevice (s3Address + REGISTERS_OFFSET, + sizeof (S3) + PACKED_OFFSET); + if (!registers) + { + ErrorF ("Can't map s3 device\n"); + goto bail2; + } + s3 = (S3Ptr) (registers + PACKED_OFFSET); + s3c->registers = registers; + s3c->s3 = s3; + + s3->crt_vga_3c3 = 1; /* wake up part from deep sleep */ + s3->crt_vga_3c2 = 0x01 | 0x02 | 0x0c; + + s3->crt_vga_3c4 = 0x58; + s3->crt_vga_3c5 = 0x10 | 0x3; + + /* + * Can't trust S3 register value for frame buffer amount, must compute + */ + temp_buffer = KdMapDevice (s3Address, 4096 * 1024); + + s3c->memory = KdFrameBufferSize (temp_buffer, 4096 * 1024); + + DRAW_DEBUG ((DEBUG_S3INIT, "Detected frame buffer %d", s3c->memory)); + + KdUnmapDevice (temp_buffer, 4096 * 1024); + + if (!s3c->memory) + { + ErrorF ("Can't detect s3 frame buffer\n"); + goto bail3; + } + + s3c->frameBuffer = KdMapDevice (s3Address, s3c->memory); + if (!s3c->frameBuffer) + { + ErrorF ("Can't map s3 frame buffer\n"); + goto bail3; + } + + card->driver = s3c; + + return TRUE; +bail3: + KdUnmapDevice ((void *) s3, sizeof (S3)); +bail2: +bail1: + xfree (s3c); +bail0: + return FALSE; +} + +Bool +s3ModeSupported (KdScreenInfo *screen, + const KdMonitorTiming *t) +{ + if (t->horizontal != 1600 && + t->horizontal != 1280 && + t->horizontal != 1152 && + t->horizontal != 1024 && + t->horizontal != 800 && + t->horizontal != 640) + return FALSE; + if (t->clock > S3_MAX_CLOCK * 2) + return FALSE; + return TRUE; +} + +Bool +s3ModeUsable (KdScreenInfo *screen) +{ + KdCardInfo *card = screen->card; + S3CardInfo *s3c = (S3CardInfo *) card->driver; + int screen_size; + int pixel_width; + int byte_width; + + if (screen->fb[0].depth >= 24) + { + screen->fb[0].depth = 24; + screen->fb[0].bitsPerPixel = 32; + } + else if (screen->fb[0].depth >= 16) + { + screen->fb[0].depth = 16; + screen->fb[0].bitsPerPixel = 16; + } + else if (screen->fb[0].depth >= 15) + { + screen->fb[0].depth = 15; + screen->fb[0].bitsPerPixel = 16; + } + else + { + screen->fb[0].depth = 8; + screen->fb[0].bitsPerPixel = 8; + } + + byte_width = screen->width * (screen->fb[0].bitsPerPixel >> 3); + pixel_width = screen->width; + screen->fb[0].pixelStride = pixel_width; + screen->fb[0].byteStride = byte_width; + + screen_size = byte_width * screen->height; + + return screen_size <= s3c->memory; +} + +Bool +s3ScreenInit (KdScreenInfo *screen) +{ + KdCardInfo *card = screen->card; + S3CardInfo *s3c = (S3CardInfo *) card->driver; + S3ScreenInfo *s3s; + int screen_size; + int memory; + int requested_memory; + int v_total, h_total; + int byte_width; + int pixel_width; + int m, n, r; + int i; + const KdMonitorTiming *t; + + DRAW_DEBUG ((DEBUG_S3INIT, "s3ScreenInit")); + s3s = (S3ScreenInfo *) xalloc (sizeof (S3ScreenInfo)); + if (!s3s) + return FALSE; + + memset (s3s, '\0', sizeof (S3ScreenInfo)); + + if (!screen->width || !screen->height) + { + screen->width = 800; + screen->height = 600; + screen->rate = 72; + } + if (!screen->fb[0].depth) + screen->fb[0].depth = 8; + + DRAW_DEBUG ((DEBUG_S3INIT, "Requested parameters %dx%dx%d", + screen->width, screen->height, screen->rate)); + t = KdFindMode (screen, s3ModeSupported); + screen->rate = t->rate; + screen->width = t->horizontal; + screen->height = t->vertical; + s3GetClock (t->clock, &m, &n, &r, 127, 31, 3); +#if 0 + fprintf (stderr, "computed %d,%d,%d (%d) provided %d,%d,%d (%d)\n", + m, n, r, S3_CLOCK(m,n,r), + t->dac_m, t->dac_n, t->dac_r, + S3_CLOCK(t->dac_m, t->dac_n, t->dac_r)); +#endif + /* + * Can only operate in pixel-doubled mode at 8 bits per pixel + */ + if (screen->fb[0].depth > 8 && S3_CLOCK(m,n,r) > S3_MAX_CLOCK) + screen->fb[0].depth = 8; + + if (!KdTuneMode (screen, s3ModeUsable, s3ModeSupported)) + { + xfree (s3s); + return FALSE; + } + + memory = s3c->memory - screen_size; + + /* + * Stick frame buffer at start of memory + */ + screen->fb[0].frameBuffer = s3c->frameBuffer; + + /* + * Stick cursor at end of memory + */ + if (memory >= 2048) + { + s3s->cursor_base = s3c->frameBuffer + (s3c->memory - 2048); + memory -= 2048; + } + else + s3s->cursor_base = 0; + + /* + * Use remaining memory for off-screen storage, but only use + * one piece (either right or bottom). + */ + if (memory >= byte_width * S3_TILE_SIZE) + { + s3s->fb[0].offscreen = s3c->frameBuffer + screen_size; + s3s->fb[0].offscreen_x = 0; + s3s->fb[0].offscreen_y = screen_size / byte_width; + s3s->fb[0].offscreen_width = pixel_width; + s3s->fb[0].offscreen_height = memory / byte_width; + memory -= s3s->fb[0].offscreen_height * byte_width; + } + else if (pixel_width - screen->width >= S3_TILE_SIZE) + { + s3s->fb[0].offscreen = s3c->frameBuffer + screen->width; + s3s->fb[0].offscreen_x = screen->width; + s3s->fb[0].offscreen_y = 0; + s3s->fb[0].offscreen_width = pixel_width - screen->width; + s3s->fb[0].offscreen_height = screen->height; + } + else + s3s->fb[0].offscreen = 0; + + DRAW_DEBUG ((DEBUG_S3INIT, "depth %d bits %d", screen->fb[0].depth, screen->fb[0].bitsPerPixel)); + + DRAW_DEBUG ((DEBUG_S3INIT, "Screen size %dx%d memory %d", + screen->width, screen->height, s3c->memory)); + DRAW_DEBUG ((DEBUG_S3INIT, "frame buffer 0x%x cursor 0x%x offscreen 0x%x", + s3c->frameBuffer, s3s->cursor_base, s3s->offscreen)); + DRAW_DEBUG ((DEBUG_S3INIT, "offscreen %dx%d+%d+%d", + s3s->offscreen_width, s3s->offscreen_height, + s3s->offscreen_x, s3s->offscreen_y)); + + switch (screen->fb[0].depth) { + case 8: + screen->fb[0].visuals = ((1 << StaticGray) | + (1 << GrayScale) | + (1 << StaticColor) | + (1 << PseudoColor) | + (1 << TrueColor) | + (1 << DirectColor)); + screen->fb[0].blueMask = 0x00; + screen->fb[0].greenMask = 0x00; + screen->fb[0].redMask = 0x00; + break; + case 15: + screen->fb[0].visuals = (1 << TrueColor); + screen->fb[0].blueMask = 0x001f; + screen->fb[0].greenMask = 0x03e0; + screen->fb[0].redMask = 0x7c00; + break; + case 16: + screen->fb[0].visuals = (1 << TrueColor); + screen->fb[0].blueMask = 0x001f; + screen->fb[0].greenMask = 0x07e0; + screen->fb[0].redMask = 0xf800; + break; + case 24: + screen->fb[0].visuals = (1 << TrueColor); + screen->fb[0].blueMask = 0x0000ff; + screen->fb[0].greenMask = 0x00ff00; + screen->fb[0].redMask = 0xff0000; + break; + } + + screen->driver = s3s; + + return TRUE; +} + +void +s3Preserve (KdCardInfo *card) +{ + S3CardInfo *s3c = card->driver; + + s3Save (s3c); +} + +/* + * Enable the card for rendering. Manipulate the initial settings + * of the card here. + */ +Bool +s3Enable (ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + KdCardInfo *card = pScreenPriv->card; + KdScreenInfo *screen = pScreenPriv->screen; + s3CardInfo (pScreenPriv); + s3ScreenInfo (pScreenPriv); + + S3Crtc crtcR, *crtc; + int hactive, hblank, hfp, hbp; + int vactive, vblank, vfp, vbp; + int hsize; + + int h_total; + int h_display_end; + int h_blank_start; + int h_blank_end; + int h_sync_start; + int h_sync_end; + int h_screen_off; + int h_start_fifo_fetch; + + int v_total; + int v_retrace_start; + int v_retrace_end; + int v_display_end; + int v_blank_start; + int v_blank_end; + + int h_adjust; + int h_sync_extend_; + int h_blank_extend_; + int i; + CARD16 cursor_address; + const KdMonitorTiming *t; + int m, n, r; + + DRAW_DEBUG ((DEBUG_S3INIT, "s3Enable")); + + DRAW_DEBUG ((DEBUG_S3INIT, "requested bpp %d current %d", + pScreenPriv->bitsPerPixel, s3c->save.crtc.bits_per_pixel)); + + t = KdFindMode (screen, s3ModeSupported); + + hfp = t->hfp; + hbp = t->hbp; + hblank = t->hblank; + hactive = t->horizontal; + + vfp = t->vfp; + vbp = t->vbp; + vblank = t->vblank; + vactive = t->vertical; + + crtcR = s3c->save.crtc; + crtc = &crtcR; + + s3GetClock (t->clock, &m, &n, &r, 127, 31, 3); + crtc->dclk_pll_m_trio = m; + crtc->dclk_pll_n_trio = n; + crtc->dclk_pll_r_trio = r; + + crtc->alt_refresh_count = 0x02; + crtc->enable_alt_refresh = 1; + crtc->enable_256_or_more = 1; + + DRAW_DEBUG ((DEBUG_S3INIT, "memory_bus_size %d\n", crtc->memory_bus_size)); + crtc->memory_bus_size = 1; + + crtc->dclk_over_2 = 0; + crtc->dclk_invert = 0; + crtc->enable_clock_double = 0; + crtc->delay_blank = 0; + crtc->extended_bios_5 = 0; + /* + * Compute character lengths for horizontal timing values + */ + switch (screen->fb[0].bitsPerPixel) { + case 8: + hactive = screen->width / 8; + hblank /= 8; + hfp /= 8; + hbp /= 8; + h_screen_off = hactive; + crtc->pixel_length = 0; + crtc->color_mode = 0; + /* + * Set up for double-pixel mode, switch color modes, + * divide the dclk and delay h blank by 2 dclks + */ + if (S3_CLOCK(crtc->dclk_pll_m_trio, crtc->dclk_pll_n_trio, + crtc->dclk_pll_r_trio) > S3_MAX_CLOCK) + { + DRAW_DEBUG ((DEBUG_S3INIT, "S3 clock %g > 80MHz, using pixel double mode", + S3_CLOCK(crtc->dclk_pll_m_trio, crtc->dclk_pll_n_trio, + crtc->dclk_pll_r_trio))); + crtc->color_mode = 1; + crtc->dclk_over_2 = 1; + crtc->enable_clock_double = 1; + crtc->delay_blank = 2; + crtc->extended_bios_5 = 2; + } + h_adjust = 1; + break; + case 16: + hactive = screen->width / 4; + hblank /= 4; + hfp /= 4; + hbp /= 4; + h_screen_off = hactive; + crtc->pixel_length = 1; + crtc->extended_bios_5 = 2; + if (crtc->depth == 15) + crtc->color_mode = 3; + else + crtc->color_mode = 5; + h_adjust = 2; + break; + case 32: + hactive = screen->width / 8; + hblank /= 8; + hfp /= 8; + hbp /= 8; + h_screen_off = hactive * 4; + crtc->pixel_length = 3; + crtc->color_mode = 0xd; + h_adjust = 1; + break; + } + + /* + * X server starts frame buffer at top of memory + */ + DRAW_DEBUG ((DEBUG_S3INIT, "Old start address 0x%x\n", + crtc_start_address (crtc))); + crtc_set_start_address (crtc, 0); + + /* + * Compute horizontal register values from timings + */ + h_total = hactive + hblank - 5; + h_display_end = hactive - 1; + h_blank_start = h_display_end; + h_blank_end = h_blank_start + hblank - h_adjust; + h_sync_start = hactive + hfp + h_adjust; + h_sync_end = h_sync_start + hblank - hbp - hfp; + h_start_fifo_fetch = h_total - 5; + + DRAW_DEBUG ((DEBUG_S3INIT, "blank_end 0x%x sync_end 0x%x sync_start 0x%x\n", + h_blank_end, h_sync_end, h_sync_start)); + + if (h_blank_end - h_blank_start > 0x40) + h_blank_extend_ = 1; + else + h_blank_extend_ = 0; + + if (h_sync_end - h_sync_start > 0x20) + h_sync_extend_ = 1; + else + h_sync_extend_ = 0; + + DRAW_DEBUG ((DEBUG_S3INIT, "blank_end 0x%x sync_end 0x%x extend %d\n", + h_blank_end, h_sync_end, h_sync_extend_)); + + crtc_set_h_total(crtc, h_total); + crtc_set_h_display_end (crtc, h_display_end); + crtc_set_h_blank_start (crtc, h_blank_start); + crtc_set_h_blank_end (crtc, h_blank_end); + crtc_set_h_sync_start (crtc, h_sync_start); + crtc_set_h_sync_end (crtc, h_sync_end); + crtc_set_screen_off (crtc, h_screen_off); + crtc_set_h_start_fifo_fetch (crtc, h_start_fifo_fetch); + crtc->h_sync_extend = h_sync_extend_; + crtc->h_blank_extend = h_blank_extend_; + + + v_total = vactive + vblank - 2; + v_retrace_start = vactive + vfp - 1; + v_retrace_end = v_retrace_start + vblank - vbp - 1; + v_display_end = vactive - 1; + v_blank_start = vactive - 1; + v_blank_end = v_blank_start + vblank - 1; + + crtc_set_v_total(crtc, v_total); + crtc_set_v_retrace_start (crtc, v_retrace_start); + crtc->v_retrace_end_0_3 = v_retrace_end; + crtc_set_v_display_end (crtc, v_display_end); + crtc_set_v_blank_start (crtc, v_blank_start); + crtc->v_blank_end_0_7 = v_blank_end; + + /* + * Set cursor + */ + if (!screen->softCursor) + { + cursor_address = (s3s->cursor_base - screen->fb[0].frameBuffer) / 1024; + + crtc->cursor_address_0_7 = cursor_address; + crtc->cursor_address_8_15 = cursor_address >> 8; + crtc->hardware_cursor_ms_x11 = 0; + crtc->hardware_cursor_enable = 1; + } + else + crtc->hardware_cursor_enable = 0; + + /* + * Set accelerator + */ + switch (screen->width) { + case 640: crtc_set_ge_screen_width(crtc,1); break; + case 800: crtc_set_ge_screen_width(crtc,2); break; + case 1024: crtc_set_ge_screen_width(crtc,0); break; + case 1152: crtc_set_ge_screen_width(crtc,4); break; + case 1280: crtc_set_ge_screen_width(crtc,3); break; + case 1600: crtc_set_ge_screen_width(crtc,6); break; + } + + /* + * Set depth values + */ + crtc->bits_per_pixel = screen->fb[0].bitsPerPixel; + crtc->depth = screen->fb[0].depth; + + crtc->l_parm_0_7 = screen->width / 4; /* Undocumented. */ + + crtc->disable_v_retrace_int = 1; /* don't let retrace interrupt */ + + DRAW_DEBUG ((DEBUG_S3INIT, "new h total %d display_end %d", + crtc_h_total(crtc), + crtc_h_display_end(crtc))); + DRAW_DEBUG ((DEBUG_S3INIT, " sync_start %d sync_end %d (%d)", + crtc_h_sync_start(crtc), + crtc_h_sync_end(crtc), h_sync_end)); + + DRAW_DEBUG ((DEBUG_S3INIT, " blank_start %d blank_end %d", + crtc_h_blank_start(crtc), + crtc_h_blank_end(crtc))); + + DRAW_DEBUG ((DEBUG_S3INIT, " screen_off %d start_fifo %d", + crtc_screen_off(crtc), crtc_h_start_fifo_fetch(crtc))); + + DRAW_DEBUG ((DEBUG_S3INIT, " active %d blank %d fp %d bp %d", + hactive, hblank, hfp, hbp)); + + DRAW_DEBUG ((DEBUG_S3INIT, "new v total %d display_end %d", + crtc_v_total(crtc), + crtc_v_display_end(crtc))); + DRAW_DEBUG ((DEBUG_S3INIT, " retrace_start %d retrace_end %d (%d)", + crtc_v_retrace_start(crtc), + crtc->v_retrace_end, + v_retrace_end)); + DRAW_DEBUG ((DEBUG_S3INIT, " blank_start %d blank_end %d", + crtc_v_blank_start(crtc), + crtc->v_blank_end_0_7)); + + DRAW_DEBUG ((DEBUG_S3INIT, " active %d blank %d fp %d bp %d", + vactive, vblank, vfp, vbp)); + + /* + * Set DPMS to normal + */ + crtc->hsync_control = 0; + crtc->vsync_control = 0; + + LockS3 (s3c); + _s3SetDepth (s3c->s3, crtc); + UnlockS3 (s3c); + return TRUE; +} + +void +s3Disable (ScreenPtr pScreen) +{ +} + +void +s3Restore (KdCardInfo *card) +{ + S3CardInfo *s3c = card->driver; + + s3Reset (s3c); +} + +void +_s3SetSync (S3CardInfo *s3c, int hsync, int vsync) +{ + /* this abuses the macros defined to access the crtc structure */ + union extended_sequencer_d_u _extended_sequencer_d_u; + S3Ptr s3 = s3c->s3; + + extended_sequencer_d = s3c->save.crtc.extended_sequencer_d; + hsync_control = hsync; + vsync_control = vsync; + PutSrtc (s3, 0x0d, extended_sequencer_d); +} + +Bool +s3DPMS (ScreenPtr pScreen, int mode) +{ + KdScreenPriv(pScreen); + s3CardInfo(pScreenPriv); + + switch (mode) { + case KD_DPMS_NORMAL: + _s3SetSync (s3c, 0, 0); + _s3SetBlank (s3c->s3, FALSE); + break; + case KD_DPMS_STANDBY: + _s3SetBlank (s3c->s3, TRUE); + _s3SetSync (s3c, 1, 0); + break; + case KD_DPMS_SUSPEND: + _s3SetBlank (s3c->s3, TRUE); + _s3SetSync (s3c, 0, 1); + break; + case KD_DPMS_POWERDOWN: + _s3SetBlank (s3c->s3, TRUE); + _s3SetSync (s3c, 1, 1); + break; + } + return TRUE; +} + +void +s3ScreenFini (KdScreenInfo *screen) +{ + S3ScreenInfo *s3s = (S3ScreenInfo *) screen->driver; + + xfree (s3s); + screen->driver = 0; +} + +void +s3CardFini (KdCardInfo *card) +{ + S3CardInfo *s3c = (S3CardInfo *) card->driver; + + KdUnmapDevice (s3c->frameBuffer, s3c->memory); + KdUnmapDevice (s3c->registers, sizeof (S3) + PACKED_OFFSET); +/* DeleteCriticalSection (&s3c->lock); */ + xfree (s3c); + card->driver = 0; +} + +KdCardFuncs s3Funcs = { + s3CardInit, + s3ScreenInit, + 0, + s3Preserve, + s3Enable, + s3DPMS, + s3Disable, + s3Restore, + s3ScreenFini, + s3CardFini, + s3CursorInit, + s3CursorEnable, + s3CursorDisable, + s3CursorFini, + s3RecolorCursor, + s3DrawInit, + s3DrawEnable, + s3DrawSync, + s3DrawDisable, + s3DrawFini, + s3GetColors, + s3PutColors, +}; + +void +S3InitCard (KdCardAttr *attr) +{ + KdCardInfoAdd (&s3Funcs, attr, 0); +} --- xorg-server-1.4.2.orig/hw/kdrive/trio/s3curs.c +++ xorg-server-1.4.2/hw/kdrive/trio/s3curs.c @@ -0,0 +1,408 @@ +/* + * 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_CONFIG_H +#include +#endif +#include "s3.h" +#include "s3draw.h" +#include "cursorstr.h" + +#define SetupCursor(s) KdScreenPriv(s); \ + s3CardInfo(pScreenPriv); \ + s3ScreenInfo(pScreenPriv); \ + S3Ptr s3 = s3c->s3; \ + S3Cursor *pCurPriv = &s3s->cursor + +static void +_s3MoveCursor (ScreenPtr pScreen, int x, int y) +{ + SetupCursor(pScreen); + CARD8 xlow, xhigh, ylow, yhigh; + CARD8 xoff, yoff; + + x -= pCurPriv->xhot; + xoff = 0; + if (x < 0) + { + xoff = -x; + x = 0; + } + y -= pCurPriv->yhot; + yoff = 0; + if (y < 0) + { + yoff = -y; + y = 0; + } + xlow = (CARD8) x; + xhigh = (CARD8) (x >> 8); + ylow = (CARD8) y; + yhigh = (CARD8) (y >> 8); + + + /* This is the recommended order to move the cursor */ + + _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x46, xhigh); + _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x47, xlow); + _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x49, ylow); + _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x4e, xoff); + _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x4f, yoff); + _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x48, yhigh); +} + +static void +s3MoveCursor (ScreenPtr pScreen, int x, int y) +{ + SetupCursor (pScreen); + + if (!pCurPriv->has_cursor) + return; + + if (!pScreenPriv->enabled) + return; + + LockS3(s3c); + _s3UnlockExt(s3); + _s3MoveCursor (pScreen, x, y); + _s3LockExt(s3); + UnlockS3(s3c); +} + +static void +s3AllocCursorColors (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + CursorPtr pCursor = pCurPriv->pCursor; + xColorItem sourceColor, maskColor; + + KdAllocateCursorPixels (pScreen, 0, pCursor, + &pCurPriv->source, &pCurPriv->mask); + switch (pScreenPriv->screen->fb[0].bitsPerPixel) { + case 4: + pCurPriv->source |= pCurPriv->source << 4; + pCurPriv->mask |= pCurPriv->mask << 4; + case 8: + pCurPriv->source |= pCurPriv->source << 8; + pCurPriv->mask |= pCurPriv->mask << 8; + case 16: + pCurPriv->source |= pCurPriv->source << 16; + pCurPriv->mask |= pCurPriv->mask << 16; + } +} + +static void +_s3SetCursorColors (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + /* set foreground */ + /* Reset cursor color stack pointers */ + (void) _s3ReadIndexRegister(&s3->crt_vga_3d4, 0x45); + _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x4a, pCurPriv->source); + _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x4a, pCurPriv->source >> 8); + _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x4a, pCurPriv->source >> 16); + + /* set background */ + /* Reset cursor color stack pointers */ + (void) _s3ReadIndexRegister(&s3->crt_vga_3d4, 0x45); + _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x4b, pCurPriv->mask); + _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x4b, pCurPriv->mask >> 8); + _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x4b, pCurPriv->mask >> 16); +} + +void +s3RecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef) +{ + SetupCursor (pScreen); + CursorPtr pCursor = pCurPriv->pCursor; + xColorItem sourceColor, maskColor; + + if (!pCurPriv->has_cursor || !pCursor) + return; + + if (!pScreenPriv->enabled) + return; + + if (pdef) + { + while (ndef) + { + if (pdef->pixel == pCurPriv->source || + pdef->pixel == pCurPriv->mask) + break; + ndef--; + } + if (!ndef) + return; + } + s3AllocCursorColors (pScreen); + LockS3 (s3c); + _s3UnlockExt(s3); + _s3SetCursorColors (pScreen); + _s3LockExt (s3); + UnlockS3 (s3c); +} + +static void +s3LoadCursor (ScreenPtr pScreen, int x, int y) +{ + SetupCursor(pScreen); + CursorPtr pCursor = pCurPriv->pCursor; + CursorBitsPtr bits = pCursor->bits; + int w, h; + unsigned char r[2], g[2], b[2]; + unsigned long *ram; + unsigned long *msk, *mskLine, *src, *srcLine; + unsigned long and, xor; + int i, j; + int cursor_address; + int wsrc; + unsigned char ramdac_control_; + + /* + * Allocate new colors + */ + s3AllocCursorColors (pScreen); + + pCurPriv->pCursor = pCursor; + pCurPriv->xhot = pCursor->bits->xhot; + pCurPriv->yhot = pCursor->bits->yhot; + + /* + * Stick new image into cursor memory + */ + ram = (unsigned long *) s3s->cursor_base; + mskLine = (unsigned long *) bits->mask; + srcLine = (unsigned long *) bits->source; + + h = bits->height; + if (h > S3_CURSOR_HEIGHT) + h = S3_CURSOR_HEIGHT; + + wsrc = BitmapBytePad(bits->width) / 4; /* ulongs per line */ + + for (i = 0; i < S3_CURSOR_HEIGHT; i++) + { + msk = mskLine; + src = srcLine; + mskLine += wsrc; + srcLine += wsrc; + for (j = 0; j < S3_CURSOR_WIDTH / 32; j++) { + + unsigned long m, s; + + if (i < h && j < wsrc) + { + m = *msk++; + s = *src++; + xor = m & s; + and = ~m; + } + else + { + and = 0xffffffff; + xor = 0x00000000; + } + + S3AdjustBits32(and); + S3AdjustBits32(xor); + *ram++ = (and & 0xffff) | (xor << 16); + *ram++ = (and >> 16) | (xor & 0xffff0000); + } + } + + _s3WaitIdle (s3); + _s3UnlockExt (s3); + + /* Set new color */ + _s3SetCursorColors (pScreen); + + /* Enable the cursor */ + _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x45, 0x01); + + /* Wait for VRetrace to make sure the position is read */ + _s3WaitVRetrace (s3); + + /* Move to new position */ + _s3MoveCursor (pScreen, x, y); + + _s3LockExt (s3); + UnlockS3(s3c); +} + +static void +s3UnloadCursor (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + LockS3 (s3c); + _s3UnlockExt(s3); + + /* Disable cursor */ + _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x45, 0); + + _s3LockExt(s3); + UnlockS3 (s3c); +} + +static Bool +s3RealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) +{ + SetupCursor(pScreen); + + if (!pScreenPriv->enabled) + return TRUE; + + /* miRecolorCursor does this */ + if (pCurPriv->pCursor == pCursor) + { + if (pCursor) + { + int x, y; + + miPointerPosition (&x, &y); + s3LoadCursor (pScreen, x, y); + } + } + return TRUE; +} + +static Bool +s3UnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) +{ + return TRUE; +} + +static void +s3SetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y) +{ + SetupCursor(pScreen); + + pCurPriv->pCursor = pCursor; + + if (!pScreenPriv->enabled) + return; + + if (pCursor) + s3LoadCursor (pScreen, x, y); + else + s3UnloadCursor (pScreen); +} + +miPointerSpriteFuncRec s3PointerSpriteFuncs = { + s3RealizeCursor, + s3UnrealizeCursor, + s3SetCursor, + s3MoveCursor, +}; + +static void +s3QueryBestSize (int class, + unsigned short *pwidth, unsigned short *pheight, + ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + switch (class) + { + case CursorShape: + if (*pwidth > pCurPriv->width) + *pwidth = pCurPriv->width; + if (*pheight > pCurPriv->height) + *pheight = pCurPriv->height; + if (*pwidth > pScreen->width) + *pwidth = pScreen->width; + if (*pheight > pScreen->height) + *pheight = pScreen->height; + break; + default: + fbQueryBestSize (class, pwidth, pheight, pScreen); + break; + } +} + +Bool +s3CursorInit (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + if (!s3s->cursor_base) + { + pCurPriv->has_cursor = FALSE; + return FALSE; + } + + pCurPriv->width = S3_CURSOR_WIDTH; + pCurPriv->height= S3_CURSOR_HEIGHT; + pScreen->QueryBestSize = s3QueryBestSize; + miPointerInitialize (pScreen, + &s3PointerSpriteFuncs, + &kdPointerScreenFuncs, + FALSE); + pCurPriv->has_cursor = TRUE; + pCurPriv->pCursor = NULL; + return TRUE; +} + +void +s3CursorEnable (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + if (pCurPriv->has_cursor) + { + if (pCurPriv->pCursor) + { + int x, y; + + miPointerPosition (&x, &y); + s3LoadCursor (pScreen, x, y); + } + else + s3UnloadCursor (pScreen); + } +} + +void +s3CursorDisable (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + if (!pScreenPriv->enabled) + return; + + if (pCurPriv->has_cursor) + { + if (pCurPriv->pCursor) + { + s3UnloadCursor (pScreen); + } + } +} + +void +s3CursorFini (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + pCurPriv->pCursor = NULL; +} --- xorg-server-1.4.2.orig/hw/kdrive/trio/s3.h +++ xorg-server-1.4.2/hw/kdrive/trio/s3.h @@ -0,0 +1,1200 @@ +/* + * 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. + */ + +#ifndef _S3_H_ +#define _S3_H_ + +#include "kdrive.h" + +#define PLATFORM 300 + +#define DRAW_DEBUG(a) + +#define DEBUG_S3INIT (DEBUG_ACCEL) +#define DEBUG_CRTC (DEBUG_ACCEL+1) +#define DEBUG_PATTERN (DEBUG_ACCEL+2) +#define DEBUG_RECT (DEBUG_ACCEL+3) +#define DEBUG_PAINT_WINDOW (DEBUG_ACCEL+4) +#define DEBUG_SET (DEBUG_ACCEL+5) +#define DEBUG_RENDER (DEBUG_ACCEL+6) +#define DEBUG_REGISTERS (DEBUG_ACCEL+7) +#define DEBUG_ARCS (DEBUG_ACCEL+8) +#define DEBUG_TEXT (DEBUG_ACCEL+9) +#define DEBUG_POLYGON (DEBUG_ACCEL+10) +#define DEBUG_CLIP (DEBUG_ACCEL+11) + +/* VESA Approved Register Definitions */ + +/* + * Linear Addressing 000 0000 - 0ff ffff (16m) + * Image data transfer 100 0000 - 100 7fff (32k) + * PCI config 100 8000 - 100 8043 + * Packed enhanced regs 100 8100 - 100 814a + * Streams regs 100 8180 - 100 81ff + * Current Y pos 100 82e8 + * CRT VGA 3b? regs 100 83b0 - 100 83bf + * CRT VGA 3c? regs 100 83c0 - 100 83cf + * CRT VGA 3d? regs 100 83d0 - 100 83df + * Subsystem status (42e8h) 100 8504 + * Advanced function (42e8h) 100 850c + * Enhanced regs 100 86e8 - 100 eeea + * Local peripheral bus 100 ff00 - 100 ff5c + * + * We don't care about the image transfer or PCI regs, so + * this structure starts at the packed enhanced regs + */ + +typedef volatile CARD32 VOL32; +typedef volatile CARD16 VOL16; +typedef volatile CARD8 VOL8; + +typedef volatile struct _s3 { + VOL32 alt_curxy; /* 8100 */ + VOL32 _pad0; /* 8104 */ + VOL32 alt_step; /* 8108 */ + VOL32 _pad1; /* 810c */ + VOL32 err_term; /* 8110 */ + VOL32 _pad2; /* 8114 */ + VOL32 cmd_gp_stat; /* 8118 */ + VOL32 short_stroke; /* 811c */ + VOL32 bg; /* 8120 */ + VOL32 fg; /* 8124 */ + VOL32 write_mask; /* 8128 */ + VOL32 read_mask; /* 812c */ + VOL32 color_cmp; /* 8130 */ + VOL32 alt_mix; /* 8134 */ + VOL32 scissors_tl; /* 8138 */ + VOL32 scissors_br; /* 813c */ + VOL32 pix_cntl_mult_misc2; /* 8140 */ + VOL32 mult_misc_read_sel; /* 8144 */ + VOL32 alt_pcnt; /* 8148 min_axis_pcnt, maj_axis_pcnt */ + VOL8 _pad3[0x19c]; /* 814c */ + VOL16 cur_y; /* 82e8 */ + VOL8 _pad4[0xc6]; /* 82ea */ + + VOL8 crt_vga_3b0; /* 83b0 */ + VOL8 crt_vga_3b1; /* 83b1 */ + VOL8 crt_vga_3b2; /* 83b2 */ + VOL8 crt_vga_3b3; /* 83b3 */ + VOL8 crt_vga_3b4; /* 83b4 */ + VOL8 crt_vga_3b5; /* 83b5 */ + VOL8 crt_vga_3b6; /* 83b6 */ + VOL8 crt_vga_3b7; /* 83b7 */ + VOL8 crt_vga_3b8; /* 83b8 */ + VOL8 crt_vga_3b9; /* 83b9 */ + VOL8 crt_vga_3ba; /* 83ba */ + VOL8 crt_vga_3bb; /* 83bb */ + VOL8 crt_vga_3bc; /* 83bc */ + VOL8 crt_vga_3bd; /* 83bd */ + VOL8 crt_vga_3be; /* 83be */ + VOL8 crt_vga_3bf; /* 83bf */ + + VOL8 crt_vga_3c0; /* 83c0 */ + VOL8 crt_vga_3c1; /* 83c1 */ + VOL8 crt_vga_3c2; /* 83c2 */ + VOL8 crt_vga_3c3; /* 83c3 */ + VOL8 crt_vga_3c4; /* 83c4 */ + VOL8 crt_vga_3c5; /* 83c5 */ + VOL8 crt_vga_dac_ad_mk; /* 83c6 */ + VOL8 crt_vga_dac_rd_ad; /* 83c7 */ + VOL8 crt_vga_dac_wt_ad; /* 83c8 */ + VOL8 crt_vga_dac_data; /* 83c9 */ + VOL8 crt_vga_3ca; /* 83ca */ + VOL8 crt_vga_3cb; /* 83cb */ + VOL8 crt_vga_3cc; /* 83cc */ + VOL8 crt_vga_3cd; /* 83cd */ + VOL8 crt_vga_3ce; /* 83ce */ + VOL8 crt_vga_3cf; /* 83cf */ + + VOL8 crt_vga_3d0; /* 83d0 */ + VOL8 crt_vga_3d1; /* 83d1 */ + VOL8 crt_vga_3d2; /* 83d2 */ + VOL8 crt_vga_3d3; /* 83d3 */ + VOL8 crt_vga_3d4; /* 83d4 */ + VOL8 crt_vga_3d5; /* 83d5 */ + VOL8 crt_vga_3d6; /* 83d6 */ + VOL8 crt_vga_3d7; /* 83d7 */ + VOL8 crt_vga_3d8; /* 83d8 */ + VOL8 crt_vga_3d9; /* 83d9 */ + VOL8 crt_vga_status_1; /* 83da */ + VOL8 crt_vga_3db; /* 83db */ + VOL8 crt_vga_3dc; /* 83dc */ + VOL8 crt_vga_3dd; /* 83dd */ + VOL8 crt_vga_3de; /* 83de */ + VOL8 crt_vga_3df; /* 83df */ + + VOL8 _pad5[0x124]; /* 83e0 */ + VOL16 subsys_status; /* 8504 */ + VOL8 _pad6[0x6]; /* 8506 */ + VOL16 adv_control; /* 850c */ + VOL8 _pad7[0x1da]; /* 850e */ + VOL16 cur_x; /* 86e8 */ + VOL8 _pad8[0x3fe]; /* 86ea */ + VOL16 desty_axstp; /* 8ae8 */ + VOL8 _pad9[0x3fe]; /* 8aea */ + VOL16 destx_diastp; /* 8ee8 */ + VOL8 _pad10[0x3fe]; /* 8eea */ + VOL16 enh_err_term; /* 92e8 */ + VOL8 _pad11[0x3fe]; /* 92ea */ + VOL16 maj_axis_pcnt; /* 96e8 */ + VOL8 _pad12[0x3fe]; /* 96ea */ + VOL16 enh_cmd_gp_stat; /* 9ae8 */ + VOL8 _pad13[0x3fe]; /* 9aea */ + VOL16 enh_short_stroke; /* 9ee8 */ + VOL8 _pad14[0x3fe]; /* 9eea */ + VOL16 enh_bg; /* a2e8 */ + VOL8 _pad15[0x3fe]; /* a2ea */ + VOL16 enh_fg; /* a6e8 */ + VOL8 _pad16[0x3fe]; /* a6ea */ + VOL16 enh_wrt_mask; /* aae8 */ + VOL8 _pad17[0x3fe]; /* aaea */ + VOL16 enh_rd_mask; /* aee8 */ + VOL8 _pad18[0x3fe]; /* aeea */ + VOL16 enh_color_cmp; /* b2e8 */ + VOL8 _pad19[0x3fe]; /* b2ea */ + VOL16 enh_bg_mix; /* b6e8 */ + VOL8 _pad20[0x3fe]; /* b6ea */ + VOL16 enh_fg_mix; /* bae8 */ + VOL8 _pad21[0x3fe]; /* baea */ + VOL16 enh_rd_reg_dt; /* bee8 */ + VOL8 _pad22[0x23fe]; /* beea */ + VOL32 pix_trans; /* e2e8 */ +} S3, *S3Ptr; + +#define VGA_STATUS_1_DTM 0x01 +#define VGA_STATUS_1_VSY 0x08 + +#define DAC_MASK 0x03c6 +#define DAC_R_INDEX 0x03c7 +#define DAC_W_INDEX 0x03c8 +#define DAC_DATA 0x03c9 +#define DISP_STAT 0x02e8 +#define H_TOTAL 0x02e8 +#define H_DISP 0x06e8 +#define H_SYNC_STRT 0x0ae8 +#define H_SYNC_WID 0x0ee8 +#define V_TOTAL 0x12e8 +#define V_DISP 0x16e8 +#define V_SYNC_STRT 0x1ae8 +#define V_SYNC_WID 0x1ee8 +#define DISP_CNTL 0x22e8 +#define ADVFUNC_CNTL 0x4ae8 +#define SUBSYS_STAT 0x42e8 +#define SUBSYS_CNTL 0x42e8 +#define ROM_PAGE_SEL 0x46e8 +#define CUR_Y 0x82e8 +#define CUR_X 0x86e8 +#define DESTY_AXSTP 0x8ae8 +#define DESTX_DIASTP 0x8ee8 +#define ERR_TERM 0x92e8 +#define MAJ_AXIS_PCNT 0x96e8 +#define GP_STAT 0x9ae8 +#define CMD 0x9ae8 +#define SHORT_STROKE 0x9ee8 +#define BKGD_COLOR 0xa2e8 +#define FRGD_COLOR 0xa6e8 +#define WRT_MASK 0xaae8 +#define RD_MASK 0xaee8 +#define COLOR_CMP 0xb2e8 +#define BKGD_MIX 0xb6e8 +#define FRGD_MIX 0xbae8 +#define MULTIFUNC_CNTL 0xbee8 +#define MIN_AXIS_PCNT 0x0000 +#define SCISSORS_T 0x1000 +#define SCISSORS_L 0x2000 +#define SCISSORS_B 0x3000 +#define SCISSORS_R 0x4000 +#define MEM_CNTL 0x5000 +#define PATTERN_L 0x8000 +#define PATTERN_H 0x9000 +#define PIX_CNTL 0xa000 +#define CONTROL_MISC2 0xd000 +#define PIX_TRANS 0xe2e8 + +/* Advanced Function Control Regsiter */ +#define CLKSEL 0x0004 +#define DISABPASSTHRU 0x0001 + +/* Graphics Processor Status Register */ + +#define GPNSLOT 13 + +#define GPBUSY_1 0x0080 +#define GPBUSY_2 0x0040 +#define GPBUSY_3 0x0020 +#define GPBUSY_4 0x0010 +#define GPBUSY_5 0x0008 +#define GPBUSY_6 0x0004 +#define GPBUSY_7 0x0002 +#define GPBUSY_8 0x0001 +#define GPBUSY_9 0x8000 +#define GPBUSY_10 0x4000 +#define GPBUSY_11 0x2000 +#define GPBUSY_12 0x1000 +#define GPBUSY_13 0x0800 + +#define GPEMPTY 0x0400 +#define GPBUSY 0x0200 +#define DATDRDY 0x0100 + +/* Command Register */ +#define CMD_NOP 0x0000 +#define CMD_LINE 0x2000 +#define CMD_RECT 0x4000 +#define CMD_RECTV1 0x6000 +#define CMD_RECTV2 0x8000 +#define CMD_LINEAF 0xa000 +#define CMD_BITBLT 0xc000 +#define CMD_PATBLT 0xe000 +#define CMD_OP_MSK 0xe000 +#define BYTSEQ 0x1000 +#define _32BITNOPAD 0x0600 +#define _32BIT 0x0400 +#define _16BIT 0x0200 +#define _8BIT 0x0000 +#define PCDATA 0x0100 +#define INC_Y 0x0080 +#define YMAJAXIS 0x0040 +#define INC_X 0x0020 +#define DRAW 0x0010 +#define LINETYPE 0x0008 +#define LASTPIX 0x0004 /* Draw last pixel in line */ +#define PLANAR 0x0002 +#define WRTDATA 0x0001 + +/* Background Mix Register */ +#define BSS_BKGDCOL 0x0000 +#define BSS_FRGDCOL 0x0020 +#define BSS_PCDATA 0x0040 +#define BSS_BITBLT 0x0060 + +/* Foreground Mix Register */ +#define FSS_BKGDCOL 0x0000 +#define FSS_FRGDCOL 0x0020 +#define FSS_PCDATA 0x0040 +#define FSS_BITBLT 0x0060 + +/* The Mixes */ +#define MIX_MASK 0x001f + +#define MIX_NOT_DST 0x0000 +#define MIX_0 0x0001 +#define MIX_1 0x0002 +#define MIX_DST 0x0003 +#define MIX_NOT_SRC 0x0004 +#define MIX_XOR 0x0005 +#define MIX_XNOR 0x0006 +#define MIX_SRC 0x0007 +#define MIX_NAND 0x0008 +#define MIX_NOT_SRC_OR_DST 0x0009 +#define MIX_SRC_OR_NOT_DST 0x000a +#define MIX_OR 0x000b +#define MIX_AND 0x000c +#define MIX_SRC_AND_NOT_DST 0x000d +#define MIX_NOT_SRC_AND_DST 0x000e +#define MIX_NOR 0x000f + +#define MIX_MIN 0x0010 +#define MIX_DST_MINUS_SRC 0x0011 +#define MIX_SRC_MINUS_DST 0x0012 +#define MIX_PLUS 0x0013 +#define MIX_MAX 0x0014 +#define MIX_HALF__DST_MINUS_SRC 0x0015 +#define MIX_HALF__SRC_MINUS_DST 0x0016 +#define MIX_AVERAGE 0x0017 +#define MIX_DST_MINUS_SRC_SAT 0x0018 +#define MIX_SRC_MINUS_DST_SAT 0x001a +#define MIX_HALF__DST_MINUS_SRC_SAT 0x001c +#define MIX_HALF__SRC_MINUS_DST_SAT 0x001e +#define MIX_AVERAGE_SAT 0x001f + +/* Pixel Control Register */ +#define MIXSEL_FRGDMIX 0x0000 +#define MIXSEL_PATT 0x0040 +#define MIXSEL_EXPPC 0x0080 +#define MIXSEL_EXPBLT 0x00c0 +#define COLCMPOP_F 0x0000 +#define COLCMPOP_T 0x0008 +#define COLCMPOP_GE 0x0010 +#define COLCMPOP_LT 0x0018 +#define COLCMPOP_NE 0x0020 +#define COLCMPOP_EQ 0x0028 +#define COLCMPOP_LE 0x0030 +#define COLCMPOP_GT 0x0038 +#define PLANEMODE 0x0004 + +#define FIFO_SLOTS 13 + +#define GPSLOT(n) (1 << ((n) > 8 ? (15 - ((n) - 9)) : (8 - (n)))) + +/* Wait for n slots to become available */ +#if 0 +#define _s3WaitSlots(s3,n) { \ + DRAW_DEBUG ((DEBUG_CRTC, "_s3WaitSlots 0x%x %d", (s3)->cmd_gp_stat, n)); \ + while (((s3)->cmd_gp_stat & GPSLOT(n)) != 0); \ + DRAW_DEBUG ((DEBUG_CRTC, " s3 0x%x %d slots ready", (s3)->cmd_gp_stat, n)); \ +} +#else +/* let PCI retries solve this problem */ +#define _s3WaitSlots(s3,n) +#endif + +/* Wait until queue is empty */ +#define _s3WaitEmpty(s3) { \ + DRAW_DEBUG ((DEBUG_CRTC, "_s3WaitEmpty 0x%x", (s3)->cmd_gp_stat)); \ + while (!((s3)->cmd_gp_stat & GPEMPTY)) ; \ + DRAW_DEBUG ((DEBUG_CRTC, " s3 empty")); \ +} + +/* Wait until GP is idle and queue is empty */ +#define _s3WaitIdleEmpty(s3) { \ + DRAW_DEBUG ((DEBUG_CRTC, "_s3WaitIdleEmpty 0x%x", (s3)->cmd_gp_stat)); \ + while (((s3)->cmd_gp_stat & (GPBUSY|GPEMPTY)) != GPEMPTY) ; \ + DRAW_DEBUG ((DEBUG_CRTC, " s3 idle empty")); \ +} + +/* Wait until GP is idle */ +#define _s3WaitIdle(s3) { \ + DRAW_DEBUG ((DEBUG_CRTC, "_s3WaitIdle 0x%x", (s3)->cmd_gp_stat)); \ + while ((s3)->cmd_gp_stat & GPBUSY) ; \ + DRAW_DEBUG ((DEBUG_CRTC, " s3 idle")); \ +} + +typedef struct _s3Cursor { + int width, height; + int xhot, yhot; + Bool has_cursor; + CursorPtr pCursor; + Pixel source, mask; +} S3Cursor; + +typedef struct _s3PatternCache { + int id; + int x, y; +} S3PatternCache; + +typedef struct _s3Patterns { + S3PatternCache *cache; + int ncache; + int last_used; + int last_id; +} S3Patterns; + +typedef struct _crtc { + CARD8 h_total_0_7; /* CR0 */ + CARD8 h_display_end_0_7; /* CR1 */ + CARD8 h_blank_start_0_7; /* CR2 */ + union { + struct { + CARD8 _h_blank_end_0_4 : 5; + CARD8 _display_skew : 2; + CARD8 : 1; + } _h_blank_end_s; + CARD8 __h_blank_end; /* CR3 */ + } _h_blank_end_u; +#define h_blank_end_0_4 _h_blank_end_u._h_blank_end_s._h_blank_end_0_4 +#define display_skew _h_blank_end_u._h_blank_end_s._display_skew +#define _h_blank_end _h_blank_end_u.__h_blank_end + + CARD8 h_sync_start_0_7; /* CR4 */ + + union { + struct { + CARD8 _h_sync_end_0_4 : 5; + CARD8 _horizontal_skew : 2; + CARD8 _h_blank_end_5 : 1; + } _h_sync_end_s; + CARD8 __h_sync_end; /* CR5 */ + } _h_sync_end_u; + +#define h_sync_end_0_4 _h_sync_end_u._h_sync_end_s._h_sync_end_0_4 +#define horizontal_skew _h_sync_end_u._h_sync_end_s._horizontal_skew +#define h_blank_end_5 _h_sync_end_u._h_sync_end_s._h_blank_end_5 +#define _h_sync_end _h_sync_end_u.__h_sync_end + + CARD8 v_total_0_7; /* CR6 */ + + union { + struct { + CARD8 _v_total_8 : 1; + CARD8 _v_display_end_8 : 1; + CARD8 _v_retrace_start_8 : 1; + CARD8 _v_blank_start_8 : 1; + CARD8 _line_compare_8 : 1; + CARD8 _v_total_9 : 1; + CARD8 _v_display_end_9 : 1; + CARD8 _v_retrace_start_9 : 1; + } _crtc_overflow_s; + CARD8 _crtc_overflow; /* CR7 */ + } _crtc_overflow_u; + +#define v_total_8 _crtc_overflow_u._crtc_overflow_s._v_total_8 +#define v_display_end_8 _crtc_overflow_u._crtc_overflow_s._v_display_end_8 +#define v_retrace_start_8 _crtc_overflow_u._crtc_overflow_s._v_retrace_start_8 +#define v_blank_start_8 _crtc_overflow_u._crtc_overflow_s._v_blank_start_8 +#define line_compare_8 _crtc_overflow_u._crtc_overflow_s._line_compare_8 +#define v_total_9 _crtc_overflow_u._crtc_overflow_s._v_total_9 +#define v_display_end_9 _crtc_overflow_u._crtc_overflow_s._v_display_end_9 +#define v_retrace_start_9 _crtc_overflow_u._crtc_overflow_s._v_retrace_start_9 +#define crtc_overflow _crtc_overflow_u._crtc_overflow + + CARD8 preset_row_scan; /* CR8 (unused) */ + + union { + struct { + CARD8 _max_scan_line : 5; + CARD8 _v_blank_start_9 : 1; + CARD8 _line_compare_9 : 1; + CARD8 _double_scan : 1; + } _max_scan_line_s; + CARD8 __max_scan_line; /* CR9 */ + } _max_scan_line_u; + +#define max_scan_line _max_scan_line_u._max_scan_line_s._max_scan_line +#define v_blank_start_9 _max_scan_line_u._max_scan_line_s._v_blank_start_9 +#define line_compare_9 _max_scan_line_u._max_scan_line_s._line_compare_9 +#define double_scan _max_scan_line_u._max_scan_line_s._double_scan +#define _max_scan_line _max_scan_line_u.__max_scan_line + + CARD8 cursor_start; + CARD8 cursor_end; + + CARD8 start_address_8_15; /* CRC */ + CARD8 start_address_0_7; /* CRD */ + + CARD8 cursor_loc_high; + CARD8 cursor_loc_low; + + CARD8 v_retrace_start_0_7; /* CR10 */ + union { + struct { + CARD8 _v_retrace_end_0_3 : 4; + CARD8 _clear_v_retrace_int : 1; + CARD8 _disable_v_retrace_int : 1; + CARD8 _refresh_cycle_select : 1; + CARD8 _lock_crtc : 1; + } _v_retrace_end_s; + CARD8 __v_retrace_end; /* CR11 */ + } _v_retrace_end_u; + +#define v_retrace_end_0_3 _v_retrace_end_u._v_retrace_end_s._v_retrace_end_0_3 +#define clear_v_retrace_int _v_retrace_end_u._v_retrace_end_s._clear_v_retrace_int +#define disable_v_retrace_int _v_retrace_end_u._v_retrace_end_s._disable_v_retrace_int +#define refresh_cycle_select _v_retrace_end_u._v_retrace_end_s._refresh_cycle_select +#define lock_crtc _v_retrace_end_u._v_retrace_end_s._lock_crtc +#define _v_retrace_end _v_retrace_end_u.__v_retrace_end + + CARD8 v_display_end_0_7; /* CR12 */ + + CARD8 screen_off_0_7; /* CR13 */ + + union { + struct { + CARD8 _underline_location : 5; + CARD8 _count_by_four : 1; + CARD8 _doubleword_mode : 1; + CARD8 : 1; + } _underline_location_s; + CARD8 __underline_location; /* CR14 (unused) */ + } _underline_location_u; + +#define underline_location _underline_location_u._underline_location_s._underline_location +#define count_by_four _underline_location_u._underline_location_s._count_by_four +#define doubleword_mode _underline_location_u._underline_location_s._doubleword_mode +#define _underline_location _underline_location_u.__underline_location + + CARD8 v_blank_start_0_7; /* CR15 */ + CARD8 v_blank_end_0_7; /* CR16 */ + + union { + struct { + CARD8 _two_bk_cga : 1; + CARD8 _four_bk_cga : 1; + CARD8 _v_total_double : 1; + CARD8 _word_mode : 1; + CARD8 : 1; + CARD8 _address_wrap : 1; + CARD8 _byte_mode : 1; + CARD8 _hardware_reset : 1; + } _crtc_mode_s; + CARD8 _crtc_mode; /* CR17 (unused) */ + } _crtc_mode_u; + + CARD8 line_compare_0_7; /* CR18 (unused) */ + + union { + struct { + CARD8 _enable_base_offset : 1; + CARD8 _enable_two_page : 1; + CARD8 _enable_vga_16_bit : 1; + CARD8 _enhanced_mode_mapping : 1; + CARD8 _old_display_start : 2; + CARD8 _enable_high_speed_text : 1; + CARD8 : 1; + } _memory_configuration_s; + CARD8 _memory_configuration; /* CR31 (unused) */ + } _memory_configuration_u; + +#define memory_configuration _memory_configuration_u._memory_configuration +#define enable_base_offset _memory_configuration_u._memory_configuration_s._enable_base_offset +#define enable_two_page _memory_configuration_u._memory_configuration_s._enable_two_page +#define enable_vga_16_bit _memory_configuration_u._memory_configuration_s._enable_vga_16_bit +#define enhanved_mode_mapping _memory_configuration_u._memory_configuration_s._enhanced_mode_mapping +#define old_display_start _memory_configuration_u._memory_configuration_s._old_display_start +#define enable_high_speed_text _memory_configuration_u._memory_configuration_s._enable_high_speed_text + + union { + struct { + CARD8 _alt_refresh_count : 2; + CARD8 _enable_alt_refresh : 1; + CARD8 _enable_top_memory : 1; + CARD8 _enable_256_or_more : 1; + CARD8 _high_speed_text : 1; + CARD8 : 1; + CARD8 _pci_burst_disabled : 1; + } _misc_1_s; + CARD8 _misc_1; /* CR3A */ + } _misc_1_u; +#define misc_1 _misc_1_u._misc_1 +#define alt_refresh_count _misc_1_u._misc_1_s._alt_refresh_count +#define enable_alt_refresh _misc_1_u._misc_1_s._enable_alt_refresh +#define enable_top_memory _misc_1_u._misc_1_s._enable_top_memory +#define enable_256_or_more _misc_1_u._misc_1_s._enable_256_or_more +#define high_speed_text _misc_1_u._misc_1_s._high_speed_text +#define pci_burst_disabled _misc_1_u._misc_1_s._pci_burst_disabled + + CARD8 h_start_fifo_fetch_0_7; /* CR3B */ + + union { + struct { + CARD8 : 5; + CARD8 interlace : 1; + CARD8 : 2; + } _mode_control_s; + CARD8 _mode_control; /* CR42 */ + } _mode_control_u; + +#define mode_control _mode_control_u._mode_control + + union { + struct { + CARD8 : 2; + CARD8 _old_screen_off_8 : 1; + CARD8 : 4; + CARD8 h_counter_double_mode : 1; + } _extended_mode_s; + CARD8 _extended_mode; /* CR43 (unused) */ + } _extended_mode_u; + +#define extended_mode _extended_mode_u._extended_mode +#define old_screen_off_8 _extended_mode_u._extended_mode_s._old_screen_off_8 + + union { + struct { + CARD8 _hardware_cursor_enable : 1; + CARD8 : 3; + CARD8 _hardware_cursor_right : 1; + CARD8 : 3; + } _hardware_cursor_mode_s; + CARD8 _hardware_cursor_mode; /* CR45 */ + } _hardware_cursor_mode_u; + +#define hardware_cursor_mode _hardware_cursor_mode_u._hardware_cursor_mode +#define hardware_cursor_enable _hardware_cursor_mode_u._hardware_cursor_mode_s._hardware_cursor_enable + + CARD8 cursor_address_8_15; /* CR4C */ + CARD8 cursor_address_0_7; /* CR4D */ + + union { + struct { + CARD8 _ge_screen_width_2 : 1; + CARD8 : 3; + CARD8 _pixel_length : 2; + CARD8 _ge_screen_width_0_1 : 2; + } _extended_system_control_1_s; + CARD8 _extended_system_control_1; /* CR50 */ + } _extended_system_control_1_u; +#define ge_screen_width_2 _extended_system_control_1_u._extended_system_control_1_s._ge_screen_width_2 +#define pixel_length _extended_system_control_1_u._extended_system_control_1_s._pixel_length +#define ge_screen_width_0_1 _extended_system_control_1_u._extended_system_control_1_s._ge_screen_width_0_1 +#define extended_system_control_1 _extended_system_control_1_u._extended_system_control_1 + + union { + struct { + CARD8 : 4; + CARD8 _screen_off_8_9 : 2; + CARD8 : 2; + } _extended_system_control_2_s; + CARD8 _extended_system_control_2; /* CR51 */ + } _extended_system_control_2_u; +#define extended_system_control_2 _extended_system_control_2_u._extended_system_control_2 +#define screen_off_8_9 _extended_system_control_2_u._extended_system_control_2_s._screen_off_8_9 + + union { + struct { + CARD8 : 1; + CARD8 big_endian_linear : 2; + CARD8 mmio_select : 2; + CARD8 mmio_window : 1; + CARD8 swap_nibbles : 1; + CARD8 : 1; + } _extended_memory_control_s; + CARD8 _extended_memory_control; /* CR53 */ + } _extended_memory_control_u; +#define extended_memory_control _extended_memory_control_u._extended_memory_control + + union { + struct { + CARD8 : 2; + CARD8 _enable_gir : 1; + CARD8 : 1; + CARD8 _hardware_cursor_ms_x11 : 1; + CARD8 : 2; + CARD8 _tri_state_off_vclk : 1; + } _extended_ramdac_control_s; + CARD8 _extended_ramdac_control; /* CR55 */ + } _extended_ramdac_control_u; +#define extended_ramdac_control _extended_ramdac_control_u._extended_ramdac_control +#define hardware_cursor_ms_x11 _extended_ramdac_control_u._extended_ramdac_control_s._hardware_cursor_ms_x11 + + + union { + struct { + CARD8 _h_total_8 : 1; + CARD8 _h_display_end_8 : 1; + CARD8 _h_blank_start_8 : 1; + CARD8 _h_blank_extend : 1; /* extend h_blank by 64 */ + CARD8 _h_sync_start_8 : 1; + CARD8 _h_sync_extend : 1; /* extend h_sync by 32 */ + CARD8 _h_start_fifo_fetch_8 : 1; + CARD8 : 1; + } _extended_horizontal_overflow_s; + CARD8 _extended_horizontal_overflow; /* CR5D */ + } _extended_horizontal_overflow_u; +#define extended_horizontal_overflow _extended_horizontal_overflow_u._extended_horizontal_overflow +#define h_total_8 _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_total_8 +#define h_display_end_8 _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_display_end_8 +#define h_blank_start_8 _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_blank_start_8 +#define h_blank_extend _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_blank_extend +#define h_sync_start_8 _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_sync_start_8 +#define h_sync_extend _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_sync_extend +#define h_start_fifo_fetch_8 _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_start_fifo_fetch_8 + + + union { + struct { + CARD8 _v_total_10 : 1; + CARD8 _v_display_end_10 : 1; + CARD8 _v_blank_start_10 : 1; + CARD8 : 1; + CARD8 _v_retrace_start_10 : 1; + CARD8 : 1; + CARD8 _line_compare_10 : 1; + CARD8 : 1; + } _extended_vertical_overflow_s; + CARD8 _extended_vertical_overflow; /* CR5E */ + } _extended_vertical_overflow_u; +#define extended_vertical_overflow _extended_vertical_overflow_u._extended_vertical_overflow +#define v_total_10 _extended_vertical_overflow_u._extended_vertical_overflow_s._v_total_10 +#define v_display_end_10 _extended_vertical_overflow_u._extended_vertical_overflow_s._v_display_end_10 +#define v_blank_start_10 _extended_vertical_overflow_u._extended_vertical_overflow_s._v_blank_start_10 +#define v_retrace_start_10 _extended_vertical_overflow_u._extended_vertical_overflow_s._v_retrace_start_10 +#define line_compare_10 _extended_vertical_overflow_u._extended_vertical_overflow_s._line_compare_10 + + + CARD8 l_parm_0_7; /* CR62 (undocumented) */ + + union { + struct { + CARD8 : 3; + CARD8 _delay_blank : 2; + CARD8 : 3; + } _extended_misc_control_s; + CARD8 _extended_misc_control; /* CR65 */ + } _extended_misc_control_u; +#define extended_misc_control _extended_misc_control_u._extended_misc_control +#define delay_blank _extended_misc_control_u._extended_misc_control_s._delay_blank + + union { + struct { + CARD8 _v_clock_phase : 1; + CARD8 : 3; + CARD8 _color_mode : 4; + } _extended_misc_control_2_s; + CARD8 _extended_misc_control_2; /* CR67 */ + } _extended_misc_control_2_u; + +#define v_clock_phase _extended_misc_control_2_u._extended_misc_control_2_s._v_clock_phase +#define color_mode _extended_misc_control_2_u._extended_misc_control_2_s._color_mode +#define extended_misc_control_2 _extended_misc_control_2_u._extended_misc_control_2 + + + union { + struct { + CARD8 cas_oe_str : 2; + CARD8 ras_low : 1; + CARD8 ras_precharge : 1; + CARD8 : 3; + CARD8 _memory_bus_size : 1; /* 0 = 32, 1 = 32/64 */ + } _configuration_3_s; + CARD8 _configuration_3; /* CR68 */ + } _configuration_3_u; +#define configuration_3 _configuration_3_u._configuration_3 +#define memory_bus_size _configuration_3_u._configuration_3_s._memory_bus_size + + union { + struct { + CARD8 _start_address_16_19 : 4; + CARD8 : 4; + } _extended_system_control_3_s; + CARD8 _extended_system_control_3; /* CR69 */ + } _extended_system_control_3_u; +#define extended_system_control_3 _extended_system_control_3_u._extended_system_control_3 +#define start_address_16_19 _extended_system_control_3_u._extended_system_control_3_s._start_address_16_19 + + CARD8 extended_bios_5; /* CR6D */ + + union { + struct { + CARD8 dot_clock_vclki : 1; /* testing only */ + CARD8 vclki_with_vafc : 1; /* feature connector */ + CARD8 : 1; + CARD8 bpp_24_mode : 1; /* 24 bpp mode */ + CARD8 alt_color_mode : 4; /* feature connector mode */ + } _extended_sequencer_b_s; + CARD8 _extended_sequencer_b; /* SRB */ + } _extended_sequencer_b_u; + +#define extended_sequencer_b _extended_sequencer_b_u._extended_sequencer_b + + union extended_sequencer_d_u { + struct { + CARD8 enable_feature : 1; + CARD8 lpb_feature : 1; + CARD8 : 2; + CARD8 _hsync_control : 2; + CARD8 _vsync_control : 2; + } _extended_sequencer_d_s; + CARD8 _extended_sequencer_d; + } _extended_sequencer_d_u; + +#define extended_sequencer_d _extended_sequencer_d_u._extended_sequencer_d +#define hsync_control _extended_sequencer_d_u._extended_sequencer_d_s._hsync_control +#define vsync_control _extended_sequencer_d_u._extended_sequencer_d_s._vsync_control + + union { + struct { + CARD8 _dclk_pll_n : 5; + CARD8 _dclk_pll_r : 2; + CARD8 : 1; + } _dclk_value_low_s; + CARD8 _dclk_value_low; /* SR12 */ + } _dclk_value_low_u; + +#define dclk_value_low _dclk_value_low_u._dclk_value_low +#define dclk_pll_n_trio _dclk_value_low_u._dclk_value_low_s._dclk_pll_n +#define dclk_pll_r_trio _dclk_value_low_u._dclk_value_low_s._dclk_pll_r + + union { + struct { + CARD8 _dclk_pll_m : 7; + CARD8 : 1; + } _dclk_value_high_s; + CARD8 _dclk_value_high; /* SR13 */ + } _dclk_value_high_u; + +#define dclk_value_high _dclk_value_high_u._dclk_value_high +#define dclk_pll_m_trio _dclk_value_high_u._dclk_value_high_s._dclk_pll_m + + union { + struct { + CARD8 _mfrq_en : 1; + CARD8 _dfrq_en : 1; + CARD8 _mclk_out : 1; + CARD8 _vclk_out : 1; + CARD8 _dclk_over_2 : 1; + CARD8 _clk_load : 1; + CARD8 _dclk_invert : 1; + CARD8 _ena_2_cycle_write : 1; + } _control_2_s; + CARD8 _control_2; /* SR15 */ + } _control_2_u; + +#define control_2 _control_2_u._control_2 +#define mfrq_en _control_2_u._control_2_s._mfrq_en +#define dfrq_en _control_2_u._control_2_s._dfrq_en +#define mclk_out _control_2_u._control_2_s._mclk_out +#define vclk_out _control_2_u._control_2_s._vclk_out +#define dclk_over_2 _control_2_u._control_2_s._dclk_over_2 +#define clk_load _control_2_u._control_2_s._clk_load +#define dclk_invert _control_2_u._control_2_s._dclk_invert +#define ena_2_cycle_write _control_2_u._control_2_s._ena_2_cycle_write + + union { + struct { + CARD8 : 5; + CARD8 _dac_power_down : 1; + CARD8 _lut_write_control : 1; + CARD8 _enable_clock_double : 1; + } _ramdac_control_s; + CARD8 _ramdac_control; /* SR18 */ + } _ramdac_control_u; + +#define ramdac_control _ramdac_control_u._ramdac_control +#define enable_clock_double _ramdac_control_u._ramdac_control_s._enable_clock_double + + union { + struct { + CARD8 _dclk_pll_n : 6; + CARD8 _dclk_pll_r : 2; + } _dclk_value_low_s; + CARD8 _dclk_value_low; /* SR36 */ + } _dclk_value_low_savage_u; + +#define dclk_value_low_savage _dclk_value_low_savage_u._dclk_value_low +#define dclk_pll_n_savage_0_5 _dclk_value_low_savage_u._dclk_value_low_s._dclk_pll_n +#define dclk_pll_r_savage_0_1 _dclk_value_low_savage_u._dclk_value_low_s._dclk_pll_r + + CARD8 dclk_pll_m0_savage_0_7; /* SR37 */ + CARD8 dclk_pll_m1_savage_0_7; /* SR38 */ + + struct { + CARD8 _dclk_pll_m : 8; + } _dclk_value_high_s_savage; + + union { + struct { + CARD8 _dclk_select : 1; + CARD8 : 1; + CARD8 _dclk_pll_r_2 : 1; + CARD8 _dclk_pll_m_8 : 1; + CARD8 _dclk_pll_n_6 : 1; + CARD8 _pce : 1; + CARD8 _ccg : 1; + CARD8 _csp : 1; + } _extended_seq_39_s; + CARD8 _extended_seq_39; /* SR39 */ + } _extended_seq_39_u; + +#define extended_seq_39 _extended_seq_39_u._extended_seq_39 +#define dclk_pll_select_savage _extended_seq_39_u._extended_seq_39_s._dclk_select +#define dclk_pll_r_savage_2 _extended_seq_39_u._extended_seq_39_s._dclk_pll_r_2 +#define dclk_pll_m_savage_8 _extended_seq_39_u._extended_seq_39_s._dclk_pll_m_8 +#define dclk_pll_n_savage_6 _extended_seq_39_u._extended_seq_39_s._dclk_pll_n_6 + + /* computed values */ + CARD16 ge_screen_pitch; + CARD8 bits_per_pixel; + CARD8 depth; + CARD8 double_pixel_mode; + CARD16 pixel_width; +} S3Crtc; + +#define crtc_v_total(crtc) ((crtc)->v_total_0_7 | \ + ((crtc)->v_total_8 << 8) | \ + ((crtc)->v_total_9 << 9) | \ + ((crtc)->v_total_10 << 10)) + +#define crtc_set_v_total(crtc,v) { \ + ((crtc))->v_total_0_7 = (v); \ + ((crtc))->v_total_8 = (v) >> 8; \ + ((crtc))->v_total_9 = (v) >> 9; \ + ((crtc))->v_total_10 = (v) >> 10; \ +} + +#define crtc_v_display_end(crtc) ((crtc)->v_display_end_0_7 | \ + ((crtc)->v_display_end_8 << 8) | \ + ((crtc)->v_display_end_9 << 9) | \ + ((crtc)->v_display_end_10 << 10)) + +#define crtc_set_v_display_end(crtc,v) {\ + ((crtc))->v_display_end_0_7 = (v); \ + ((crtc))->v_display_end_8 = (v) >> 8; \ + ((crtc))->v_display_end_9 = (v) >> 9; \ + ((crtc))->v_display_end_10 = (v) >> 10; \ +} + +#define crtc_v_retrace_start(crtc) ((crtc)->v_retrace_start_0_7 | \ + ((crtc)->v_retrace_start_8 << 8) | \ + ((crtc)->v_retrace_start_9 << 9) | \ + ((crtc)->v_retrace_start_10 << 10)) + +#define crtc_set_v_retrace_start(crtc,v) {\ + ((crtc))->v_retrace_start_0_7 = (v); \ + ((crtc))->v_retrace_start_8 = (v) >> 8; \ + ((crtc))->v_retrace_start_9 = (v) >> 9; \ + ((crtc))->v_retrace_start_10 = (v) >> 10; \ +} + +#define crtc_v_blank_start(crtc) ((crtc)->v_blank_start_0_7 | \ + ((crtc)->v_blank_start_8 << 8) | \ + ((crtc)->v_blank_start_9 << 9) | \ + ((crtc)->v_blank_start_10 << 10)) + +#define crtc_set_v_blank_start(crtc,v) {\ + ((crtc))->v_blank_start_0_7 = (v); \ + ((crtc))->v_blank_start_8 = (v) >> 8; \ + ((crtc))->v_blank_start_9 = (v) >> 9; \ + ((crtc))->v_blank_start_10 = (v) >> 10; \ +} + +#define crtc_h_total(crtc) ((crtc)->h_total_0_7 | \ + ((crtc)->h_total_8 << 8)) + +#define crtc_set_h_total(crtc,v) {\ + ((crtc))->h_total_0_7 = (v); \ + ((crtc))->h_total_8 = (v) >> 8; \ +} + +#define crtc_h_display_end(crtc) ((crtc)->h_display_end_0_7 | \ + ((crtc)->h_display_end_8 << 8)) + +#define crtc_set_h_display_end(crtc,v) {\ + ((crtc))->h_display_end_0_7 = (v); \ + ((crtc))->h_display_end_8 = (v) >> 8; \ +} + +#define crtc_h_blank_start(crtc) ((crtc)->h_blank_start_0_7 | \ + ((crtc)->h_blank_start_8 << 8)) + +#define crtc_set_h_blank_start(crtc,v) {\ + ((crtc))->h_blank_start_0_7 = (v); \ + ((crtc))->h_blank_start_8 = (v) >> 8; \ +} + +#define crtc_h_blank_end(crtc) ((crtc)->h_blank_end_0_4 | \ + ((crtc)->h_blank_end_5 << 5)) + +#define crtc_set_h_blank_end(crtc,v) {\ + ((crtc))->h_blank_end_0_4 = (v); \ + ((crtc))->h_blank_end_5 = (v) >> 5; \ +} + +#define crtc_h_sync_start(crtc) ((crtc)->h_sync_start_0_7 | \ + ((crtc)->h_sync_start_8 << 8)) + +#define crtc_set_h_sync_start(crtc,v) {\ + ((crtc))->h_sync_start_0_7 = (v); \ + ((crtc))->h_sync_start_8 = (v) >> 8; \ +} + +#define crtc_h_sync_end(crtc) ((crtc)->h_sync_end_0_4) + +#define crtc_set_h_sync_end(crtc,v) {\ + ((crtc))->h_sync_end_0_4 = (v); \ +} + +#define crtc_screen_off(crtc) ((crtc)->screen_off_0_7 | \ + (((crtc)->screen_off_8_9 ? \ + ((crtc))->screen_off_8_9 : \ + ((crtc))->old_screen_off_8) << 8)) + +#define crtc_set_screen_off(crtc,v) {\ + ((crtc))->screen_off_0_7 = (v); \ + ((crtc))->old_screen_off_8 = 0; \ + ((crtc))->screen_off_8_9 = (v) >> 8; \ +} + +#define crtc_ge_screen_width(crtc) ((crtc)->ge_screen_width_0_1 | \ + ((crtc)->ge_screen_width_2 << 2)) + +#define crtc_set_ge_screen_width(crtc,v) { \ + (crtc)->ge_screen_width_0_1 = (v); \ + (crtc)->ge_screen_width_2 = (v) >> 2; \ +} + +#define crtc_h_start_fifo_fetch(crtc) ((crtc)->h_start_fifo_fetch_0_7 | \ + ((crtc)->h_start_fifo_fetch_8 << 8)) + +#define crtc_set_h_start_fifo_fetch(crtc,v) {\ + (crtc)->h_start_fifo_fetch_0_7 = (v); \ + (crtc)->h_start_fifo_fetch_8 = (v) >> 8; \ +} + +#define crtc_start_address(crtc) ((crtc)->start_address_0_7 | \ + ((crtc)->start_address_8_15 << 8) | \ + ((crtc)->start_address_16_19 << 16)) + +#define crtc_set_start_address(crtc,v) {\ + (crtc)->start_address_0_7 = (v); \ + (crtc)->start_address_8_15 = (v) >> 8; \ + (crtc)->start_address_16_19 = (v) >> 16; \ +} + +#define crtc_line_compare(crtc) ((crtc)->line_compare_0_7 | \ + ((crtc)->line_compare_8 << 8) | \ + ((crtc)->line_compare_9 << 9) | \ + ((crtc)->line_compare_10 << 10)) + +#define crtc_set_line_compare(crtc,v) { \ + ((crtc))->line_compare_0_7 = (v); \ + ((crtc))->line_compare_8 = (v) >> 8; \ + ((crtc))->line_compare_9 = (v) >> 9; \ + ((crtc))->line_compare_10 = (v) >> 10; \ +} + + +#define GetCrtc(s3,i) _s3ReadIndexRegister (&(s3)->crt_vga_3d4, (i)) +#define PutCrtc(s3,i,v) _s3WriteIndexRegister (&(s3)->crt_vga_3d4, (i), (v)) + +#define GetSrtc(s3,i) _s3ReadIndexRegister (&(s3)->crt_vga_3c4, (i)) +#define PutSrtc(s3,i,v) _s3WriteIndexRegister (&(s3)->crt_vga_3c4, (i), (v)) + +#define S3_CLOCK_REF 14318 /* KHz */ + +#define S3_CLOCK(m,n,r) (S3_CLOCK_REF * ((m) + 2) / (((n) + 2) * (1 << (r)))) + +#if PLATFORM == 200 +#define S3_MAX_CLOCK 80000 /* KHz */ +#endif +#if PLATFORM == 300 +#define S3_MAX_CLOCK 135000 /* KHz */ +#endif + +typedef struct _s3Save { + CARD8 cursor_fg; + CARD8 cursor_bg; + CARD8 lock1; + CARD8 lock2; + CARD8 locksrtc; + CARD8 clock_mode; + CARD32 alt_mix; + CARD32 write_mask; + CARD32 fg; + CARD32 bg; + S3Crtc crtc; +} S3Save; + +typedef struct _s3CardInfo { + S3Ptr s3; /* pointer to register structure */ + int memory; /* amount of memory */ + CARD8 *frameBuffer; /* pointer to frame buffer */ + CARD8 *registers; /* pointer to register map */ + S3Save save; + Bool savage; + Bool need_sync; +} S3CardInfo; + +typedef struct _s3FbInfo { + CARD8 *offscreen; /* pointer to offscreen area */ + int offscreen_y; /* top y coordinate of offscreen area */ + int offscreen_x; /* top x coordinate of offscreen area */ + int offscreen_width; /* width of offscreen area */ + int offscreen_height; /* height of offscreen area */ + S3Patterns patterns; + CARD32 bitmap_offset; + int accel_stride; + int accel_bpp; +} S3FBInfo; + +typedef struct _s3ScreenInfo { + CARD8 *cursor_base; /* pointer to cursor area */ + S3Cursor cursor; + S3FBInfo fb[1]; +} S3ScreenInfo; + +#define LockS3(s3c) +#define UnlockS3(s3c) + +#define getS3CardInfo(kd) ((S3CardInfo *) ((kd)->card->driver)) +#define s3CardInfo(kd) S3CardInfo *s3c = getS3CardInfo(kd) + +#define getS3ScreenInfo(kd) ((S3ScreenInfo *) ((kd)->screen->driver)) +#define s3ScreenInfo(kd) S3ScreenInfo *s3s = getS3ScreenInfo(kd) + +Bool s3CardInit (KdCardInfo *); +Bool s3ScreenInit (KdScreenInfo *); +Bool s3Enable (ScreenPtr pScreen); +void s3Disable (ScreenPtr pScreen); +void s3Fini (ScreenPtr pScreen); + +Bool s3CursorInit (ScreenPtr pScreen); +void s3CursorEnable (ScreenPtr pScreen); +void s3CursorDisable (ScreenPtr pScreen); +void s3CursorFini (ScreenPtr pScreen); +void s3RecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdefs); + +Bool s3DrawInit (ScreenPtr pScreen); +void s3DrawEnable (ScreenPtr pScreen); +void s3DrawSync (ScreenPtr pScreen); +void s3DrawDisable (ScreenPtr pScreen); +void s3DrawFini (ScreenPtr pScreen); + +void s3GetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs); +void s3PutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs); + +void S3InitCard (KdCardAttr *attr); + +void s3GetClock (int target, int *Mp, int *Np, int *Rp, int maxM, int maxN, int maxR); + +CARD8 _s3ReadIndexRegister (VOL8 *base, CARD8 index); +void _s3WriteIndexRegister (VOL8 *base, CARD8 index, CARD8 value); + +extern KdCardFuncs s3Funcs; + +/* + * Wait for the begining of the retrace interval + */ + +#define S3_RETRACE_LOOP_CHECK if (++_loop_count > 300000) {\ + DRAW_DEBUG ((DEBUG_FAILURE, "S3 wait loop failed at %s:%d", \ + __FILE__, __LINE__)); \ + break; \ +} + +#define _s3WaitVRetrace(s3) { \ + VOL8 *_status = &s3->crt_vga_status_1; \ + int _loop_count; \ + DRAW_DEBUG ((DEBUG_CRTC, "_s3WaitVRetrace 0x%x", *_status)); \ + _loop_count = 0; \ + while ((*_status & VGA_STATUS_1_VSY) != 0) S3_RETRACE_LOOP_CHECK; \ + _loop_count = 0; \ + while ((*_status & VGA_STATUS_1_VSY) == 0) S3_RETRACE_LOOP_CHECK; \ +} +/* + * Wait for the begining of the retrace interval + */ +#define _s3WaitVRetraceEnd(s3) { \ + VOL8 *_status = &s3->crt_vga_status_1; \ + int _loop_count; \ + DRAW_DEBUG ((DEBUG_CRTC, "_s3WaitVRetraceEnd 0x%x", *_status)); \ + _loop_count = 0; \ + while ((*_status & VGA_STATUS_1_VSY) == 0) S3_RETRACE_LOOP_CHECK; \ + _loop_count = 0; \ + while ((*_status & VGA_STATUS_1_VSY) != 0) S3_RETRACE_LOOP_CHECK; \ +} + +/* + * This extension register must contain a magic bit pattern to enable + * the remaining extended registers + */ + +#define _s3UnlockExt(s3) _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x39, 0xa0) +#define _s3LockExt(s3) _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x39, 0x00) + +#define S3_CURSOR_WIDTH 64 +#define S3_CURSOR_HEIGHT 64 +#define S3_CURSOR_SIZE ((S3_CURSOR_WIDTH * S3_CURSOR_HEIGHT + 7) / 8) + +#define S3_TILE_SIZE 8 + +#endif /* _S3_H_ */ --- xorg-server-1.4.2.orig/hw/kdrive/trio/s3clock.c +++ xorg-server-1.4.2/hw/kdrive/trio/s3clock.c @@ -0,0 +1,85 @@ +/* + * 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_CONFIG_H +#include +#endif +#include "s3.h" + +/* + * Clock synthesis: + * + * f_out = f_ref * ((M + 2) / ((N + 2) * (1 << R))) + * + * Constraints: + * + * 1. 135MHz <= f_ref * ((M + 2) / (N + 2)) <= 270 MHz + * 2. N >= 1 + * + * Vertical refresh rate = clock / ((hsize + hblank) * (vsize + vblank)) + * Horizontal refresh rate = clock / (hsize + hblank) + */ + +/* all in kHz */ +#define MIN_VCO 180000.0 +#define MAX_VCO 360000.0 + +void +s3GetClock (int target, int *Mp, int *Np, int *Rp, int maxM, int maxN, int maxR) +{ + int M, N, R, bestM, bestN; + int f_vco, f_out; + int err, abserr, besterr; + + /* + * Compute correct R value to keep VCO in range + */ + for (R = 0; R <= maxR; R++) + { + f_vco = target * (1 << R); + if (MIN_VCO <= f_vco && f_vco < MAX_VCO) + break; + } + + /* M = f_out / f_ref * ((N + 2) * (1 << R)); */ + besterr = target; + for (N = 0; N <= maxN; N++) + { + M = (target * (N + 2) * (1 << R) + (S3_CLOCK_REF/2)) / S3_CLOCK_REF - 2; + if (0 <= M && M <= maxM) + { + f_out = S3_CLOCK(M,N,R); + err = target - f_out; + if (err < 0) + err = -err; + if (err < besterr) + { + besterr = err; + bestM = M; + bestN = N; + } + } + } + *Mp = bestM; + *Np = bestN; + *Rp = R; +} --- xorg-server-1.4.2.orig/hw/kdrive/trio/s3cmap.c +++ xorg-server-1.4.2/hw/kdrive/trio/s3cmap.c @@ -0,0 +1,70 @@ +/* + * 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_CONFIG_H +#include +#endif +#include "s3.h" + +void +s3GetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs) +{ + KdScreenPriv(pScreen); + s3CardInfo(pScreenPriv); + S3Ptr s3 = s3c->s3; + VOL8 *dac_rd_ad = &s3->crt_vga_dac_rd_ad; + VOL8 *dac_data = &s3->crt_vga_dac_data; + + LockS3 (s3c); + while (ndef--) + { + *dac_rd_ad = pdefs->pixel; + pdefs->red = *dac_data << 10; + pdefs->green = *dac_data << 10; + pdefs->blue = *dac_data << 10; + pdefs++; + } + UnlockS3(s3c); +} + +void +s3PutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs) +{ + KdScreenPriv(pScreen); + s3CardInfo(pScreenPriv); + S3Ptr s3 = s3c->s3; + VOL8 *dac_wt_ad = &s3->crt_vga_dac_wt_ad; + VOL8 *dac_data = &s3->crt_vga_dac_data; + + LockS3(s3c); + _s3WaitVRetrace (s3); + while (ndef--) + { + *dac_wt_ad = pdefs->pixel; + *dac_data = pdefs->red >> 10; + *dac_data = pdefs->green >> 10; + *dac_data = pdefs->blue >> 10; + pdefs++; + } + UnlockS3(s3c); +} + --- xorg-server-1.4.2.orig/hw/kdrive/itsy/ts.c +++ xorg-server-1.4.2/hw/kdrive/itsy/ts.c @@ -0,0 +1,210 @@ +/* + * 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_CONFIG_H +#include +#endif +#define NEED_EVENTS +#include "itsy.h" +#include +#include "inputstr.h" +#include "Xpoll.h" + +int +itsyTsReadBytes (int fd, char *buf, int len, int min) +{ + int n, tot; + fd_set set; + struct timeval tv; + + tot = 0; + while (len) + { + n = read (fd, buf, len); + if (n > 0) + { + tot += n; + buf += n; + len -= n; + } + if (tot % min == 0) + break; + FD_ZERO (&set); + FD_SET (fd, &set); + tv.tv_sec = 0; + tv.tv_usec = 100 * 1000; + n = select (fd + 1, &set, 0, 0, &tv); + if (n <= 0) + break; + } + return tot; +} + +void +itsyTsRead (KdPointerInfo *pi, int tsPort) +{ + ts_event event; + long buf[3]; + int n; + long pressure; + long x, y; + unsigned long flags; + unsigned long buttons; + + n = itsyTsReadBytes (tsPort, (char *) &event, + sizeof (event), sizeof (event)); + if (n == sizeof (event)) + { + if (event.pressure) + { + flags = KD_BUTTON_1; + x = event.point.x; + y = event.point.y; + } + else + { + flags = KD_MOUSE_DELTA; + x = 0; + y = 0; + } + KdEnqueuePointerEvent (pi, flags, x, y, 0); + } +} + +#if 0 +#define ITSY_DEBUG_LOW 1 + +// +// Touch screen parameters are stored +// in the flash. This code is taken from 'wm1'. +// +void itsySetTouchCalibration (int mou_filedsc, + int xs, int xt, int ys, int yt, int xys) +{ + int k, ibuf[10]; + + ibuf[0] = xs; + ibuf[1] = xt; + ibuf[2] = ys; + ibuf[3] = yt; + ibuf[4] = xys; + if ((k=ioctl(mou_filedsc, TS_SET_CALM, ibuf)) != 0) { + fprintf(stderr, "ERROR: ioctl TS_SET_CALM returns %d\n", k); + } +} + + +int itsyReadFlashBlock(int location, signed char *data, int dbytes) +{ + int offset, bytes; + int flashfd; + + flashfd = open("/dev/flash1", O_RDONLY); + if (flashfd < 0) return(0); + + offset = lseek(flashfd, location, SEEK_SET); + if (offset != location) { + close(flashfd); + return(0); + } + + bytes = read(flashfd, data, dbytes); + if (bytes != dbytes) { + close(flashfd); + return(0); + } + + close(flashfd); + return(1); +} + +/**********************************************************************/ +#define RAMSIZE (0x400000) +#define MONITOR_BLOCKSIZE (32) +/**********************************************************************/ + +/* code for storing calibration into flash */ + +#define CALIBRATE_BLOCKSIZE (32) +#define CALIBRATE_OFFSET (RAMSIZE-MONITOR_BLOCKSIZE-CALIBRATE_BLOCKSIZE) +#define CALIBRATE_MAGIC_NUM (0x0babedee) + + +static int check_if_calibrated_and_set(int mou_filedsc) +{ + signed char cal_data[CALIBRATE_BLOCKSIZE]; + int *iptr; + + if (itsyReadFlashBlock(CALIBRATE_OFFSET, + cal_data, CALIBRATE_BLOCKSIZE) == 0) { + if ( ITSY_DEBUG_LOW ) { + fprintf(stderr,"unable to read calibration data for touch screen\n"); + } + return(0); + } + + iptr = (int *) cal_data; + if (iptr[0] == CALIBRATE_MAGIC_NUM) { + if ( ITSY_DEBUG_LOW ) { + fprintf(stderr,"Calibrating touch screen using %d, %d, %d, %d, %d\n", + iptr[1], iptr[2], iptr[3], iptr[4], iptr[5]); + } + itsySetTouchCalibration(mou_filedsc, iptr[1], iptr[2], iptr[3], iptr[4], iptr[5]); + return(1); + } + else { + if ( ITSY_DEBUG_LOW ) { + fprintf(stderr,"Couldn't calibrate screen\n"); + } + return(0); + } +} +#endif + +int +itsyTsInit (void) +{ + int tsPort; + + tsPort = open ("/dev/ts", 0); + fprintf (stderr, "tsPort %d\n", tsPort); +#if 0 + if (tsPort >= 0) + check_if_calibrated_and_set (tsPort); +#endif + return tsPort; +} + +void +itsyTsFini (int tsPort) +{ + if (tsPort >= 0) + close (tsPort); +} + +KdPointerDriver itsyTsMouseDriver = { + "itsyts", + itsyTsInit, + itsyTsRead, + itsyTsFini +}; + --- xorg-server-1.4.2.orig/hw/kdrive/itsy/kbd.c +++ xorg-server-1.4.2/hw/kdrive/itsy/kbd.c @@ -0,0 +1,251 @@ +/* + * 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_CONFIG_H +#include +#endif +#include "itsy.h" +#include +#include + +#define ITSY_WIDTH 2 + +KeySym ItsyKeymap[] = { +/* 1 8 */ XK_Escape, NoSymbol, +/* 2 9 */ XK_1, XK_exclam, +/* 3 10 */ XK_2, XK_at, +/* 4 11 */ XK_3, XK_numbersign, +/* 5 12 */ XK_4, XK_dollar, +/* 6 13 */ XK_5, XK_percent, +/* 7 14 */ XK_6, XK_asciicircum, +/* 8 15 */ XK_7, XK_ampersand, +/* 9 16 */ XK_8, XK_asterisk, +/* 10 17 */ XK_9, XK_parenleft, +/* 11 18 */ XK_0, XK_parenright, +/* 12 19 */ XK_minus, XK_underscore, +/* 13 20 */ XK_equal, XK_plus, +/* 14 21 */ XK_BackSpace, NoSymbol, +/* 15 22 */ XK_Tab, NoSymbol, +/* 16 23 */ XK_Q, NoSymbol, +/* 17 24 */ XK_W, NoSymbol, +/* 18 25 */ XK_E, NoSymbol, +/* 19 26 */ XK_R, NoSymbol, +/* 20 27 */ XK_T, NoSymbol, +/* 21 28 */ XK_Y, NoSymbol, +/* 22 29 */ XK_U, NoSymbol, +/* 23 30 */ XK_I, NoSymbol, +/* 24 31 */ XK_O, NoSymbol, +/* 25 32 */ XK_P, NoSymbol, +/* 26 33 */ XK_bracketleft, XK_braceleft, +/* 27 34 */ XK_bracketright, XK_braceright, +/* 28 35 */ XK_Return, NoSymbol, +/* 29 36 */ XK_Control_L, NoSymbol, +/* 30 37 */ XK_A, NoSymbol, +/* 31 38 */ XK_S, NoSymbol, +/* 32 39 */ XK_D, NoSymbol, +/* 33 40 */ XK_F, NoSymbol, +/* 34 41 */ XK_G, NoSymbol, +/* 35 42 */ XK_H, NoSymbol, +/* 36 43 */ XK_J, NoSymbol, +/* 37 44 */ XK_K, NoSymbol, +/* 38 45 */ XK_L, NoSymbol, +/* 39 46 */ XK_semicolon, XK_colon, +/* 40 47 */ XK_apostrophe, XK_quotedbl, +/* 41 48 */ XK_grave, XK_asciitilde, +/* 42 49 */ XK_Shift_L, NoSymbol, +/* 43 50 */ XK_backslash, XK_bar, +/* 44 51 */ XK_Z, NoSymbol, +/* 45 52 */ XK_X, NoSymbol, +/* 46 53 */ XK_C, NoSymbol, +/* 47 54 */ XK_V, NoSymbol, +/* 48 55 */ XK_B, NoSymbol, +/* 49 56 */ XK_N, NoSymbol, +/* 50 57 */ XK_M, NoSymbol, +/* 51 58 */ XK_comma, XK_less, +/* 52 59 */ XK_period, XK_greater, +/* 53 60 */ XK_slash, XK_question, +/* 54 61 */ XK_Shift_R, NoSymbol, +/* 55 62 */ XK_KP_Multiply, NoSymbol, +/* 56 63 */ XK_Alt_L, XK_Meta_L, +/* 57 64 */ XK_space, NoSymbol, +/* 58 65 */ XK_Caps_Lock, NoSymbol, +/* 59 66 */ XK_F1, NoSymbol, +/* 60 67 */ XK_F2, NoSymbol, +/* 61 68 */ XK_F3, NoSymbol, +/* 62 69 */ XK_F4, NoSymbol, +/* 63 70 */ XK_F5, NoSymbol, +/* 64 71 */ XK_F6, NoSymbol, +/* 65 72 */ XK_F7, NoSymbol, +/* 66 73 */ XK_F8, NoSymbol, +/* 67 74 */ XK_F9, NoSymbol, +/* 68 75 */ XK_F10, NoSymbol, +/* 69 76 */ XK_Break, XK_Pause, +/* 70 77 */ XK_Scroll_Lock, NoSymbol, +/* 71 78 */ XK_KP_Home, XK_KP_7, +/* 72 79 */ XK_KP_Up, XK_KP_8, +/* 73 80 */ XK_KP_Page_Up, XK_KP_9, +/* 74 81 */ XK_KP_Subtract, NoSymbol, +/* 75 82 */ XK_KP_Left, XK_KP_4, +/* 76 83 */ XK_KP_5, NoSymbol, +/* 77 84 */ XK_KP_Right, XK_KP_6, +/* 78 85 */ XK_KP_Add, NoSymbol, +/* 79 86 */ XK_KP_End, XK_KP_1, +/* 80 87 */ XK_KP_Down, XK_KP_2, +/* 81 88 */ XK_KP_Page_Down, XK_KP_3, +/* 82 89 */ XK_KP_Insert, XK_KP_0, +/* 83 90 */ XK_KP_Delete, XK_KP_Decimal, +/* 84 91 */ NoSymbol, NoSymbol, +/* 85 92 */ NoSymbol, NoSymbol, +/* 86 93 */ NoSymbol, NoSymbol, +/* 87 94 */ XK_F11, NoSymbol, +/* 88 95 */ XK_F12, NoSymbol, + +/* These are remapped from the extended set (using ExtendMap) */ + +/* 89 96 */ XK_Control_R, NoSymbol, +/* 90 97 */ XK_KP_Enter, NoSymbol, +/* 91 98 */ XK_KP_Divide, NoSymbol, +/* 92 99 */ XK_Sys_Req, XK_Print, +/* 93 100 */ XK_Alt_R, XK_Meta_R, +/* 94 101 */ XK_Num_Lock, NoSymbol, +/* 95 102 */ XK_Home, NoSymbol, +/* 96 103 */ XK_Up, NoSymbol, +/* 97 104 */ XK_Page_Up, NoSymbol, +/* 98 105 */ XK_Left, NoSymbol, +/* 99 106 */ XK_Right, NoSymbol, +/* 100 107 */ XK_End, NoSymbol, +/* 101 108 */ XK_Down, NoSymbol, +/* 102 109 */ XK_Page_Down, NoSymbol, +/* 103 110 */ XK_Insert, NoSymbol, +/* 104 111 */ XK_Delete, NoSymbol, +/* 105 112 */ XK_Super_L, NoSymbol, +/* 106 113 */ XK_Super_R, NoSymbol, +/* 107 114 */ XK_Menu, NoSymbol, + +/* Itsy hardware buttons */ +#define ITSY_BUTTON_FIRST 108 +#define ITSY_BUTTON_LAST 116 + +/* 108 115 */ XK_Next, NoSymbol, /* right button on side */ +/* 109 116 */ XK_Prior, NoSymbol, /* left button on side */ +/* 110 117 */ XK_Up, NoSymbol, /* joypad */ +/* 111 118 */ XK_Down, NoSymbol, +/* 112 119 */ XK_Left, NoSymbol, +/* 113 120 */ XK_Right, NoSymbol, +/* 114 121 */ NoSymbol, NoSymbol, /* left near speaker */ +/* 115 122 */ NoSymbol, NoSymbol, /* right near speaker */ +/* 116 123 */ NoSymbol, NoSymbol, /* tiny button */ +}; + +static unsigned long itsyButtonState; + +void +ItsyKeyboardLoad (void) +{ + KeySym *k; + +} + +static Status +ItsyKeyboardInit (KdKeyboardInfo *ki) +{ + if (!ki) + return BadImplementation; + + ki->driverPrivate = open ("/dev/buttons", 0); + + itsyButtonState = 0; + ki->keySyms.minKeyCode = 1; + ki->keySyms.maxKeyCode = (sizeof (ItsyKeymap) / sizeof (ItsyKeymap[0])) / ITSY_WIDTH; + ki->minScanCode = ki->keySyms.minKeyCode; + ki->maxScanCode = ki->keySyms.maxKeyCode; + ki->keySyms.mapWidth = ITSY_WIDTH; + + if (ki->keySyms.map) + xfree(ki->keySyms.map); + ki->keySyms.map = xalloc(sizeof(ItsyKeymap)); + if (!ki->keySyms.map) + return BadAlloc; + memcpy (kdKeymap, ItsyKeymap, sizeof (ItsyKeymap)); + + return Success; +} + +static void +ItsyKeyboardDisable (KdKeybdInfo *ki) +{ + if (fd >= 0) + close ((int)ki->driverPrivate); +} + +static void +ItsyKeyboardFini (KdKeybdInfo *ki) +{ + return; +} + +void +ItsyKeyboardRead (int fd) +{ + itsy_buttons_event event; + int b; + unsigned long bit; + unsigned long change; + unsigned long buttons; + + if (read (fd, &event, sizeof (event)) == sizeof (event)) + { + buttons = event.state; + change = buttons ^ itsyButtonState; + if (!change) + return; + for (b = ITSY_BUTTON_FIRST; b <= ITSY_BUTTON_LAST; b++) + { + bit = (1 << (b - ITSY_BUTTON_FIRST)); + if (change & bit) + KdEnqueueKeyboardEvent (b, (buttons & bit) == 0); + } + itsyButtonState = buttons; + } +} + +void +ItsyKeyboardLeds (int leds) +{ +} + +void +ItsyKeyboardBell (int volume, int frequency, int duration) +{ +} + +KdKeyboardFuncs itsyKeyboardFuncs = { + "itsy", + ItsyKeyboardInit, + ItsyKeyboardEnable, + ItsyKeyboardRead, + ItsyKeyboardLeds, + ItsyKeyboardBell, + ItsyKeyboardDisable + ItsyKeyboardFini, + NULL, +}; --- xorg-server-1.4.2.orig/hw/kdrive/itsy/itsy.c +++ xorg-server-1.4.2/hw/kdrive/itsy/itsy.c @@ -0,0 +1,325 @@ +/* + * 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_CONFIG_H +#include +#endif +#include "itsy.h" + +/* struct with LCD characteristics defined in fb_brutus.h */ +static struct FbLcdParamsStruct fbLcdParams; +static int fb_d; +static int fbn; +Bool +itsyCardInit (KdCardInfo *card) +{ + int k; + char *fb; + char *pixels; + + if ((fb_d = open("/dev/fbclone", O_RDWR)) < 0) { + perror("Error opening /dev/fb\n"); + return FALSE; + } + if ((k=ioctl(fb_d, FB_LCD_PARAMS, &fbLcdParams)) != 0) { + perror("Error with /dev/fb ioctl FB_LCD_PARAMS call"); + return FALSE; + } + + fb = (char *) mmap ((caddr_t) NULL, fbLcdParams.frameBufferSize, + PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, fb_d, 0); + + fprintf (stderr, "fb mapped at 0x%x\n", fb); + if (fb == (char *)-1) { + perror("ERROR: mmap framebuffer fails!"); + return FALSE; + } + + card->driver = fb; + + return TRUE; +} + +Bool +itsyScreenInit (KdScreenInfo *screen) +{ + CARD8 *fb = screen->card->driver; + + screen->width = fbLcdParams.screenSizeH; + screen->height = fbLcdParams.screenSizeV; + screen->depth = fbLcdParams.bitsPerPixel; + screen->bitsPerPixel = fbLcdParams.bitsPerPixel; + screen->byteStride = fbLcdParams.frameBufferSizeH; + screen->pixelStride = (fbLcdParams.frameBufferSizeH * 8 / + fbLcdParams.bitsPerPixel); + fprintf (stderr, "width %d height %d depth %d pstride %d bstride %d\n", + screen->width, screen->height, screen->depth, + screen->pixelStride, screen->byteStride); + screen->dumb = FALSE; + screen->softCursor = TRUE; + screen->blueMask = 0; + screen->greenMask = 0; + screen->redMask = 0; + screen->visuals = 1 << StaticGray; + screen->rate = 72; + screen->frameBuffer = (CARD8 *) (fb + + fbLcdParams.pixelDataOffset + + (fbLcdParams.reserveTopRows * + screen->byteStride)); + fprintf (stderr, "Frame buffer 0x%x\n", screen->frameBuffer); + return TRUE; +} + +static unsigned short itsyIntensity[16] = { + 0xffff, + 0xffff, + 0xedb6, + 0xdb6d, + 0xc924, + 0xb6db, + 0xa492, + 0x9249, + 0x8000, + 0x6db6, + 0x5b6d, + 0x4924, + 0x36db, + 0x2492, + 0x1249, + 0x0000, +}; + +Bool +itsyCreateColormap (ColormapPtr pmap) +{ + int i; + + for (i = 0; i < 16; i++) + { + pmap->red[i].co.local.red = itsyIntensity[i]; + pmap->red[i].co.local.green = itsyIntensity[i]; + pmap->red[i].co.local.blue = itsyIntensity[i]; + } + return TRUE; +} + +Bool +itsyInitScreen (ScreenPtr pScreen) +{ + pScreen->CreateColormap = itsyCreateColormap; + return TRUE; +} + +void +itsyPreserve (KdCardInfo *card) +{ +} + +void +itsyEnable (ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + + fprintf (stderr, "Enabling LCD display\n"); + /* display it on the LCD */ + ioctl(fb_d, FB_LCD_SHOW, 0); +} + +Bool +itsyDPMS (ScreenPtr pScreen, int mode) +{ + if (mode) + ioctl (fb_d, FB_LCD_OFF, 0); + else + ioctl (fb_d, FB_LCD_ON, 0); + return TRUE; +} + +void +itsyDisable (ScreenPtr pScreen) +{ +/* ioctl (fb_d, FB_LCD_SWITCH, 0); */ +/* fprintf (stderr, "Disabling LCD display\n");*/ +} + +void +itsyRestore (KdCardInfo *card) +{ +} + +void +itsyScreenFini (KdScreenInfo *screen) +{ +} + +void +itsyCardFini (KdCardInfo *card) +{ + int k; + + fprintf (stderr, "Unmapping driver at 0x%x\n", card->driver); + munmap (card->driver, fbLcdParams.frameBufferSize); + fprintf (stderr, "Releasing fbn %d\n", fbn); + /* release it */ + if (ioctl(fb_d, FB_LCD_FREE, fbn) != 0) { + printf("FB_LCD_FREE of %d fails!\n", fbn); + } + close (fb_d); + fprintf (stderr, "itsyFini done\n"); +} + +KdCardFuncs itsyFuncs = { + itsyCardInit, /* cardinit */ + itsyScreenInit, /* scrinit */ + itsyInitScreen, /* initScreen */ + itsyPreserve, /* preserve */ + itsyEnable, /* enable */ + itsyDPMS, /* dpms */ + itsyDisable, /* disable */ + itsyRestore, /* restore */ + itsyScreenFini, /* scrfini */ + itsyCardFini, /* cardfini */ + + 0, /* initCursor */ + 0, /* enableCursor */ + 0, /* disableCursor */ + 0, /* finiCursor */ + 0, /* recolorCursor */ + + 0, /* initAccel */ + 0, /* enableAccel */ + 0, /* disableAccel */ + 0, /* finiAccel */ + + 0, /* getColors */ + 0, /* putColors */ +}; + +void +InitCard (void) +{ + KdCardAttr attr; + + KdCardInfoAdd (&itsyFuncs, &attr, 0); +} + +void +InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) +{ + KdInitOutput (pScreenInfo, argc, argv); +} + +void +InitInput (int argc, char **argv) +{ + KdInitInput (&itsyTsMouseFuncs, &itsyKeyboardFuncs); +} + +int itsySessionFd = -1; + +int +ItsyOsInit (void) +{ + pid_t sid; + int i; + itsy_session_info info; + + if (itsySessionFd < 0) + { + itsySessionFd = open ("/dev/session", 0); + ErrorF("itsySessionFD %d\n", itsySessionFd); + } + + (void) setsid (); + sid = getsid (0); + ErrorF ("Session ID %d PID %d\n", sid, getpid ()); + info.sid = sid; + strcpy (info.name, "X"); + if (itsySessionFd >= 0) + { + i = ioctl (itsySessionFd, SESSION_SET_INFO, &info); + if (i < 0) + perror ("SESSION_SET_INFO"); + } + return 1; +} + +void +ItsyOsEnable (void) +{ + itsy_session_request req; + int i; + +#define MANAGER_SID_TO_FOREGROUND 2 + + req.operation = MANAGER_SID_TO_FOREGROUND; + req.data = 0; + if (itsySessionFd >= 0) + { + i = ioctl (itsySessionFd, SESSION_MANAGER_REQUEST, &req); + if (i < 0) + perror ("SESSION_MANAGER_REQUEST"); + } +} + +Bool +ItsyOsSpecialKey (KeySym sym) +{ + return FALSE; +} + +void +ItsyOsDisable (void) +{ +} + +void +ItsyOsFini (void) +{ +} + +KdOsFuncs ItsyOsFuncs = { + ItsyOsInit, + ItsyOsEnable, + ItsyOsSpecialKey, + ItsyOsDisable, + ItsyOsFini, + 0 +}; + +void +OsVendorInit (void) +{ + KdOsInit (&ItsyOsFuncs); +} + +void +ddxUseMsg (void) +{ + KdUseMsg(); +} + +int +ddxProcessArgument (int argc, char **argv, int i) +{ + return KdProcessArgument (argc, argv, i); +} --- xorg-server-1.4.2.orig/hw/kdrive/itsy/itsy.h +++ xorg-server-1.4.2/hw/kdrive/itsy/itsy.h @@ -0,0 +1,39 @@ +/* + * 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. + */ + +#include "kdrive.h" +#include +#include +#include +#include +#include +#include +#include +#include + +#define FB_HEIGHT 200 +#define FB_WIDTH 320 +#define FB_DEPTH 4 +#define FB_PALETTE_SIZE 16 + +extern KdMouseFuncs itsyTsMouseFuncs; +extern KdKeyboardFuncs itsyKeyboardFuncs; --- xorg-server-1.4.2.orig/hw/kdrive/chips/Makefile.in +++ xorg-server-1.4.2/hw/kdrive/chips/Makefile.in @@ -152,7 +152,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -286,10 +286,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/kdrive/sdl/Makefile.in +++ xorg-server-1.4.2/hw/kdrive/sdl/Makefile.in @@ -143,7 +143,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -277,10 +277,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/kdrive/pcmcia/pcmciacurs.c +++ xorg-server-1.4.2/hw/kdrive/pcmcia/pcmciacurs.c @@ -0,0 +1,451 @@ +/* + * Copyright 2001 by Alan Hourihane, Sychdyn, North Wales, UK. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright 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, + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "pcmcia.h" +#include "cursorstr.h" + +#define SetupCursor(s) KdScreenPriv(s); \ + pcmciaCardInfo(pScreenPriv); \ + pcmciaScreenInfo(pScreenPriv); \ + pcmciaCursor *pCurPriv = &pcmcias->cursor + +static void +_pcmciaMoveCursor (ScreenPtr pScreen, int x, int y) +{ + SetupCursor(pScreen); + CARD8 xlow, xhigh, ylow, yhigh; + CARD8 xoff, yoff; + + x -= pCurPriv->xhot; + xoff = 0; + if (x < 0) + { + xoff = -x; + x = 0; + } + y -= pCurPriv->yhot; + yoff = 0; + if (y < 0) + { + yoff = -y; + y = 0; + } + + /* This is the recommended order to move the cursor */ + if (pcmciac->HP) { + xlow = (CARD8) x; + xhigh = (CARD8) (x >> 8); + ylow = (CARD8) y; + yhigh = (CARD8) (y >> 8); + pcmciaWriteIndex (pcmciac, 0x3d4, 0x40, xlow); + pcmciaWriteIndex (pcmciac, 0x3d4, 0x41, xhigh); + pcmciaWriteIndex (pcmciac, 0x3d4, 0x42, ylow); + pcmciaWriteIndex (pcmciac, 0x3d4, 0x43, yhigh); + pcmciaWriteIndex (pcmciac, 0x3d4, 0x46, xoff); + pcmciaWriteIndex (pcmciac, 0x3d4, 0x47, yoff); + } else { + x >>= 3; + y >>= 3; + xlow = (CARD8) x; + xhigh = (CARD8) (x >> 8); + ylow = (CARD8) y; + yhigh = (CARD8) (y >> 8); + /* Don't be alarmed, yes the upper 3bits of the index are correct */ + pcmciaWriteIndex (pcmciac, 0x3c4, 0x10 | xhigh << 5, xlow); + pcmciaWriteIndex (pcmciac, 0x3c4, 0x11 | yhigh << 5, ylow); + } +} + +static void +pcmciaMoveCursor (ScreenPtr pScreen, int x, int y) +{ + SetupCursor (pScreen); + + if (!pCurPriv->has_cursor) + return; + + if (!pScreenPriv->enabled) + return; + + _pcmciaMoveCursor (pScreen, x, y); +} + +static void +pcmciaAllocCursorColors (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + CursorPtr pCursor = pCurPriv->pCursor; + + KdAllocateCursorPixels (pScreen, 0, pCursor, + &pCurPriv->source, &pCurPriv->mask); + switch (pScreenPriv->screen->fb[0].bitsPerPixel) { + case 4: + pCurPriv->source |= pCurPriv->source << 4; + pCurPriv->mask |= pCurPriv->mask << 4; + case 8: + pCurPriv->source |= pCurPriv->source << 8; + pCurPriv->mask |= pCurPriv->mask << 8; + case 16: + pCurPriv->source |= pCurPriv->source << 16; + pCurPriv->mask |= pCurPriv->mask << 16; + } +} + +static void +pcmciaSetCursorColors (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + CursorPtr pCursor = pCurPriv->pCursor; + CARD32 fg, bg; + + fg = pCurPriv->source; + bg = pCurPriv->mask; + + if (pcmciac->HP) { + /* + * This trident chip uses the palette for it's cursor colors - ouch! + * We enforce it to always stay the black/white colors as we don't + * want it to muck with the overscan color. Tough. Use softCursor + * if you want to change cursor colors. + */ + pcmciaWriteReg (pcmciac, 0x3c8, 0xff); /* DAC 0 */ + pcmciaWriteReg (pcmciac, 0x3c9, 0x00); + pcmciaWriteReg (pcmciac, 0x3c9, 0x00); + pcmciaWriteReg (pcmciac, 0x3c9, 0x00); + pcmciaWriteReg (pcmciac, 0x3c8, 0x00); /* DAC 255 */ + pcmciaWriteReg (pcmciac, 0x3c9, 0x3f); + pcmciaWriteReg (pcmciac, 0x3c9, 0x3f); + pcmciaWriteReg (pcmciac, 0x3c9, 0x3f); + } else { + CARD8 temp; + temp = pcmciaReadIndex(pcmciac, 0x3c4, 0x12); + pcmciaWriteIndex (pcmciac, 0x3c4, 0x12, (temp & 0xFE) | 0x02); + + pcmciaWriteReg (pcmciac, 0x3c8, 0x00); /* DAC 256 */ + pcmciaWriteReg (pcmciac, 0x3c9, fg); + pcmciaWriteReg (pcmciac, 0x3c9, fg >> 8); + pcmciaWriteReg (pcmciac, 0x3c9, fg >> 16); + pcmciaWriteReg (pcmciac, 0x3c8, 0x00); /* DAC 257 */ + pcmciaWriteReg (pcmciac, 0x3c9, bg); + pcmciaWriteReg (pcmciac, 0x3c9, bg >> 8); + pcmciaWriteReg (pcmciac, 0x3c9, bg >> 16); + + pcmciaWriteIndex (pcmciac, 0x3c4, 0x12, temp); + } +} + +void +pcmciaRecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef) +{ + SetupCursor (pScreen); + CursorPtr pCursor = pCurPriv->pCursor; + xColorItem sourceColor, maskColor; + + if (!pCurPriv->has_cursor || !pCursor) + return; + + if (!pScreenPriv->enabled) + return; + + if (pdef) + { + while (ndef) + { + if (pdef->pixel == pCurPriv->source || + pdef->pixel == pCurPriv->mask) + break; + ndef--; + } + if (!ndef) + return; + } + pcmciaAllocCursorColors (pScreen); + pcmciaSetCursorColors (pScreen); +} + +#define InvertBits32(v) { \ + v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \ + v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \ + v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \ +} + +static void +pcmciaLoadCursor (ScreenPtr pScreen, int x, int y) +{ + SetupCursor(pScreen); + CursorPtr pCursor = pCurPriv->pCursor; + CursorBitsPtr bits = pCursor->bits; + int w, h; + CARD8 *ram; + CARD32 *msk, *mskLine, *src, *srcLine; + int i, j; + int cursor_address; + int lwsrc; + unsigned char ramdac_control_; + CARD32 offset; + + /* + * Allocate new colors + */ + pcmciaAllocCursorColors (pScreen); + + pCurPriv->pCursor = pCursor; + pCurPriv->xhot = pCursor->bits->xhot; + pCurPriv->yhot = pCursor->bits->yhot; + + /* + * Stick new image into cursor memory + */ + if (pcmciac->HP) { + ram = (CARD8 *) pcmcias->cursor_base; + } else { + /* The last bank */ + ram = (CARD8 *) pcmciac->fb; + pcmciaWriteIndex (pcmciac, 0x3ce, 0x09, 0x7f); + pcmciaWriteIndex (pcmciac, 0x3ce, 0x0A, 0x7f); + } + + mskLine = (CARD32 *) bits->mask; + srcLine = (CARD32 *) bits->source; + + h = bits->height; + if (h > PCMCIA_CURSOR_HEIGHT) + h = PCMCIA_CURSOR_HEIGHT; + + lwsrc = BitmapBytePad(bits->width) / 4; + + for (i = 0; i < PCMCIA_CURSOR_HEIGHT; i++) { + msk = mskLine; + src = srcLine; + mskLine += lwsrc; + srcLine += lwsrc; + for (j = 0; j < PCMCIA_CURSOR_WIDTH / 32; j++) { + + CARD32 m, s; + + if (i < h && j < lwsrc) + { + m = *msk++; + s = *src++; + InvertBits32(m); + InvertBits32(s); + } + else + { + m = 0; + s = 0; + } + + /* Do 8bit access */ + *ram++ = (m & 0xff); + *ram++ = (m & 0xff00) >> 8; + *ram++ = (m & 0xff0000) >> 16; + *ram++ = (m & 0xff000000) >> 24; + *ram++ = (s & 0xff); + *ram++ = (s & 0xff00) >> 8; + *ram++ = (s & 0xff0000) >> 16; + *ram++ = (s & 0xff000000) >> 24; + } + } + + /* Set address for cursor bits */ + if (pcmciac->HP) { + offset = pcmcias->cursor_base - (CARD8 *) pcmcias->screen; + offset >>= 10; + pcmciaWriteIndex (pcmciac, 0x3d4, 0x44, (CARD8) (offset & 0xff)); + pcmciaWriteIndex (pcmciac, 0x3d4, 0x45, (CARD8) (offset >> 8)); + } else { + pcmciaWriteIndex (pcmciac, 0x3c4, 0x13, 15); /* ?? */ + } + + /* Set new color */ + pcmciaSetCursorColors (pScreen); + + /* Enable the cursor */ + if (pcmciac->HP) + pcmciaWriteIndex (pcmciac, 0x3d4, 0x50, 0xc1); + else + pcmciaWriteIndex (pcmciac, 0x3c4, 0x12, 0x05); + + /* Move to new position */ + pcmciaMoveCursor (pScreen, x, y); +} + +static void +pcmciaUnloadCursor (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + /* Disable cursor */ + if (pcmciac->HP) + pcmciaWriteIndex (pcmciac, 0x3d4, 0x50, 0); + else + pcmciaWriteIndex (pcmciac, 0x3c4, 0x12, 0); +} + +static Bool +pcmciaRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) +{ + SetupCursor(pScreen); + + if (!pScreenPriv->enabled) + return TRUE; + + /* miRecolorCursor does this */ + if (pCurPriv->pCursor == pCursor) + { + if (pCursor) + { + int x, y; + + miPointerPosition (&x, &y); + pcmciaLoadCursor (pScreen, x, y); + } + } + return TRUE; +} + +static Bool +pcmciaUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) +{ + return TRUE; +} + +static void +pcmciaSetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y) +{ + SetupCursor(pScreen); + + pCurPriv->pCursor = pCursor; + + if (!pScreenPriv->enabled) + return; + + if (pCursor) + pcmciaLoadCursor (pScreen, x, y); + else + pcmciaUnloadCursor (pScreen); +} + +miPointerSpriteFuncRec pcmciaPointerSpriteFuncs = { + pcmciaRealizeCursor, + pcmciaUnrealizeCursor, + pcmciaSetCursor, + pcmciaMoveCursor, +}; + +static void +pcmciaQueryBestSize (int class, + unsigned short *pwidth, unsigned short *pheight, + ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + switch (class) + { + case CursorShape: + if (*pwidth > pCurPriv->width) + *pwidth = pCurPriv->width; + if (*pheight > pCurPriv->height) + *pheight = pCurPriv->height; + if (*pwidth > pScreen->width) + *pwidth = pScreen->width; + if (*pheight > pScreen->height) + *pheight = pScreen->height; + break; + default: + fbQueryBestSize (class, pwidth, pheight, pScreen); + break; + } +} + +Bool +pcmciaCursorInit (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + if (!pcmcias->cursor_base) + { + pCurPriv->has_cursor = FALSE; + return FALSE; + } + + pCurPriv->width = PCMCIA_CURSOR_WIDTH; + pCurPriv->height= PCMCIA_CURSOR_HEIGHT; + pScreen->QueryBestSize = pcmciaQueryBestSize; + miPointerInitialize (pScreen, + &pcmciaPointerSpriteFuncs, + &kdPointerScreenFuncs, + FALSE); + pCurPriv->has_cursor = TRUE; + pCurPriv->pCursor = NULL; + return TRUE; +} + +void +pcmciaCursorEnable (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + if (pCurPriv->has_cursor) + { + if (pCurPriv->pCursor) + { + int x, y; + + miPointerPosition (&x, &y); + pcmciaLoadCursor (pScreen, x, y); + } + else + pcmciaUnloadCursor (pScreen); + } +} + +void +pcmciaCursorDisable (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + if (!pScreenPriv->enabled) + return; + + if (pCurPriv->has_cursor) + { + if (pCurPriv->pCursor) + { + pcmciaUnloadCursor (pScreen); + } + } +} + +void +pcmciaCursorFini (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + pCurPriv->pCursor = NULL; +} --- xorg-server-1.4.2.orig/hw/kdrive/pcmcia/pcmciastub.c +++ xorg-server-1.4.2/hw/kdrive/pcmcia/pcmciastub.c @@ -0,0 +1,63 @@ +/* + * Copyright 2001 by Alan Hourihane, Sychdyn, North Wales, UK. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright 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, + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "pcmcia.h" + +void +InitCard (char *name) +{ + KdCardAttr attr; + + KdCardInfoAdd (&pcmciaFuncs, &attr, 0); +} + +void +InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) +{ + KdInitOutput (pScreenInfo, argc, argv); +} + +void +InitInput (int argc, char **argv) +{ + KdOsAddInputDrivers (); + KdInitInput (); +} + +extern pcmciaDisplayModeRec pcmciaDefaultModes[]; + +void +ddxUseMsg (void) +{ + KdUseMsg(); +} + +int +ddxProcessArgument (int argc, char **argv, int i) +{ + return KdProcessArgument (argc, argv, i); +} --- xorg-server-1.4.2.orig/hw/kdrive/pcmcia/pcmcia.c +++ xorg-server-1.4.2/hw/kdrive/pcmcia/pcmcia.c @@ -0,0 +1,1199 @@ +/* + * Copyright 2001 by Alan Hourihane, Sychdyn, North Wales, UK. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright 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, + * + * A driver for the following PCMCIA cards... + * Hewlett Packards HP VGA Out (Model F1252A) + * Colorgraphics Voyager VGA + * + * Tested running under a Compaq IPAQ Pocket PC running Linux + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "pcmcia.h" +#define extern +#include +#undef extern + +#define CLOCK 14318 /* KHz */ +#define CLK_N(a,b) (a & 0xff) +#define CLK_M(a,b) ((b) & 0x3f) +#define CLK_K(a,b) (((b) >> 6) & 3) +#define CLK_FREQ(a,b) (((CLK_N(a,b) + 8) * CLOCK) / ((CLK_M(a,b)+2) << CLK_K(a,b))) + +extern void +tridentUpdatePacked (ScreenPtr pScreen, + shadowBufPtr pBuf); +extern void +cirrusUpdatePacked (ScreenPtr pScreen, + shadowBufPtr pBuf); + +static Bool +tridentSetCLK(int clock, CARD8 *a, CARD8 *b); + +static Bool +CirrusFindClock(int freq, int *num_out, int *den_out); + +Bool +pcmciaCardInit (KdCardInfo *card) +{ + pcmciaCardInfo *pcmciac; + CARD8 r9; + + pcmciac = (pcmciaCardInfo *) xalloc (sizeof (pcmciaCardInfo)); + if (!pcmciac) + return FALSE; + + pcmciac->cop_base = (CARD8 *) KdMapDevice (PCMCIA_COP_BASE(card), + PCMCIA_COP_SIZE(card)); + + r9 = pcmciaReadIndex (pcmciac, 0x3c4, 0x09); + /* + * Crude detection.... + * The trident chip has a read only register at 0x09, which returns 0x4. + * If it's not that, we assume the cirrus chip. + * BREAKAGE.! If we have an anonymous PCMCIA card inserted, we could + * potentially smash something here. FIXME ! + */ + if (r9 == 0x04) { + ErrorF("PCMCIA: Found HP VGA card\n"); + pcmciac->HP = TRUE; /* Select HP VGA Out Card */ + } else { + ErrorF("PCMCIA: Found Voyager VGA card\n"); + pcmciac->HP = FALSE; /* Select Voyager VGA Card */ + } + + if (pcmciac->HP) { + /* needed by the accelerator - later */ + pcmciac->cop = (Cop *) (pcmciac->cop_base + TRIDENT_COP_OFF(card)); + } + + /* + * Map frame buffer + */ + if (pcmciac->HP) + pcmciac->fb = KdMapDevice (0x2ce00000, 0x80000); + else + pcmciac->fb = KdMapDevice (0x2c0a0000, 0x10000); /*64K bank switched*/ + + if (!pcmciac->fb) + return FALSE; + + pcmciac->window = 0; + + card->driver = pcmciac; + + return TRUE; +} + +Bool +pcmciaModeSupported (KdScreenInfo *screen, + const KdMonitorTiming *t) +{ + KdCardInfo *card = screen->card; + pcmciaCardInfo *pcmciac = (pcmciaCardInfo *) card->driver; + + if (pcmciac->HP) + { + CARD8 a, b; + if (!tridentSetCLK (t->clock, &a, &b)) + return FALSE; + } + else + { + int a, b; + if (!CirrusFindClock (t->clock, &a, &b)) + return FALSE; + } + + /* width must be a multiple of 16 */ + if (t->horizontal & 0xf) + return FALSE; + return TRUE; +} + +Bool +pcmciaModeUsable (KdScreenInfo *screen) +{ + KdCardInfo *card = screen->card; + pcmciaCardInfo *pcmciac = (pcmciaCardInfo *) card->driver; + int screen_size; + int pixel_width; + int byte_width; + int fb; + + if (screen->fb[0].depth == 8) + screen->fb[0].bitsPerPixel = 8; + else if (screen->fb[0].depth == 15 || screen->fb[0].depth == 16) + screen->fb[0].bitsPerPixel = 16; + else + return FALSE; + + screen_size = 0; + screen->fb[0].pixelStride = screen->width; + screen->fb[0].byteStride = screen->width * (screen->fb[0].bitsPerPixel >>3); + screen->fb[0].frameBuffer = pcmciac->fb; + screen_size = screen->fb[0].byteStride * screen->height; + + return screen_size <= pcmciac->memory; +} + +Bool +pcmciaScreenInit (KdScreenInfo *screen) +{ + pcmciaCardInfo *pcmciac = screen->card->driver; + pcmciaScreenInfo *pcmcias; + int screen_size, memory; + int i; + const KdMonitorTiming *t; + + pcmcias = (pcmciaScreenInfo *) xalloc (sizeof (pcmciaScreenInfo)); + if (!pcmcias) + return FALSE; + memset (pcmcias, '\0', sizeof (pcmciaScreenInfo)); + + /* if (!pcmciac->cop) */ + screen->dumb = TRUE; + + if (screen->fb[0].depth < 8) + screen->fb[0].depth = 8; + + /* default to 16bpp */ + if (!screen->fb[0].depth) + screen->fb[0].depth = 16; + + /* default to 60Hz refresh */ + if (!screen->width || !screen->height) + { + screen->width = 640; + screen->height = 400; + screen->rate = 60; + } + + pcmciac->memory = 512 * 1024; + if (pcmciac->HP && !screen->softCursor && screen->fb[0].depth == 8) + { + /* ack, bail on the HW cursor for everything -- no ARGB falback */ + pcmcias->cursor_base = 0; +#if 0 + /* Let's do hw cursor for the HP card, only in 8bit mode though */ + pcmcias->cursor_base = pcmcias->screen + pcmciac->memory - 4096; + pcmciac->memory -= 4096; +#endif + } + + pcmcias->screen = pcmciac->fb; + screen->driver = pcmcias; + + t = KdFindMode (screen, pcmciaModeSupported); + + screen->rate = t->rate; + screen->width = t->horizontal; + screen->height = t->vertical; + + pcmcias->randr = screen->randr; + + if (!KdTuneMode (screen, pcmciaModeUsable, pcmciaModeSupported)) + { + xfree (pcmcias); + return FALSE; + } + + switch (screen->fb[0].depth) { + case 4: + screen->fb[0].visuals = ((1 << StaticGray) | + (1 << GrayScale) | + (1 << StaticColor)); + screen->fb[0].blueMask = 0x00; + screen->fb[0].greenMask = 0x00; + screen->fb[0].redMask = 0x00; + break; + case 8: + screen->fb[0].visuals = ((1 << StaticGray) | + (1 << GrayScale) | + (1 << StaticColor) | + (1 << PseudoColor) | + (1 << TrueColor) | + (1 << DirectColor)); + screen->fb[0].blueMask = 0x00; + screen->fb[0].greenMask = 0x00; + screen->fb[0].redMask = 0x00; + break; + case 15: + screen->fb[0].visuals = (1 << TrueColor); + screen->fb[0].blueMask = 0x001f; + screen->fb[0].greenMask = 0x03e0; + screen->fb[0].redMask = 0x7c00; + break; + case 16: + screen->fb[0].visuals = (1 << TrueColor); + screen->fb[0].blueMask = 0x001f; + screen->fb[0].greenMask = 0x07e0; + screen->fb[0].redMask = 0xf800; + break; + } + + return TRUE; +} + +void * +tridentWindowLinear (ScreenPtr pScreen, + CARD32 row, + CARD32 offset, + int mode, + CARD32 *size, + void *closure) +{ + KdScreenPriv(pScreen); + pcmciaCardInfo *pcmciac = pScreenPriv->card->driver; + + if (!pScreenPriv->enabled) + return 0; + + *size = pScreenPriv->screen->fb[0].byteStride; + return (CARD8 *) pcmciac->fb + row * pScreenPriv->screen->fb[0].byteStride + offset; +} + +void * +cirrusWindowWindowed (ScreenPtr pScreen, + CARD32 row, + CARD32 offset, + int mode, + CARD32 *size, + void *closure) +{ + KdScreenPriv(pScreen); + pcmciaCardInfo *pcmciac = pScreenPriv->card->driver; + int bank, boffset; + + if (!pScreenPriv->enabled) + return 0; + + bank = (row * pScreenPriv->screen->fb[0].byteStride) / 0x1000; + pcmciaWriteIndex(pcmciac, 0x3ce, 0x0B, 0x0c); + pcmciaWriteIndex(pcmciac, 0x3ce, 0x09, bank); + pcmciaWriteIndex(pcmciac, 0x3ce, 0x0A, bank); + *size = pScreenPriv->screen->fb[0].byteStride; + return (CARD8 *) pcmciac->fb + (row * pScreenPriv->screen->fb[0].byteStride) - (bank * 0x1000) + offset; +} + +LayerPtr +pcmciaLayerCreate (ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + pcmciaCardInfo *pcmciac = pScreenPriv->card->driver; + pcmciaScreenInfo *pcmcias = (pcmciaScreenInfo *) pScreenPriv->screen->driver; + ShadowUpdateProc update; + ShadowWindowProc window; + PixmapPtr pPixmap; + int kind; + + if (pcmciac->HP) { + window = tridentWindowLinear; + if (pcmcias->randr == RR_Rotate_0) + update = tridentUpdatePacked; + else + update = pcmciaUpdateRotatePacked; + } else { + window = cirrusWindowWindowed; + if (pcmcias->randr == RR_Rotate_0) + update = cirrusUpdatePacked; + else + update = pcmciaUpdateRotatePacked; + } + + if (!update) + abort (); + + kind = LAYER_SHADOW; + pPixmap = 0; + + return LayerCreate (pScreen, kind, screen->fb[0].depth, + pPixmap, update, window, pcmcias->randr, 0); +} + +void +pcmciaConfigureScreen (ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + FbdevPriv *priv = pScreenPriv->card->driver; + pcmciaScreenInfo *pcmcias = (pcmciaScreenInfo *) screen->driver; + KdMouseMatrix m; + + KdComputeMouseMatrix (&m, pcmcias->randr, + screen->width, screen->height); + + if (m.matrix[0][0]) + { + pScreen->width = screen->width; + pScreen->height = screen->height; + pScreen->mmWidth = screen->width_mm; + pScreen->mmHeight = screen->height_mm; + } + else + { + pScreen->width = screen->height; + pScreen->height = screen->width; + pScreen->mmWidth = screen->height_mm; + pScreen->mmHeight = screen->width_mm; + } + KdSetMouseMatrix (&m); +} + +#ifdef RANDR + +Bool +pcmciaRandRSupported (ScreenPtr pScreen, + const KdMonitorTiming *t) +{ + KdScreenPriv(pScreen); + pcmciaCardInfo *pcmciac = pScreenPriv->card->driver; + KdScreenInfo *screen = pScreenPriv->screen; + int screen_size; + int byteStride; + + /* Make sure the clock is supported */ + if (!pcmciaModeSupported (screen, t)) + return FALSE; + /* Check for sufficient memory */ + byteStride = screen->width * (screen->fb[0].bitsPerPixel >>3); + screen_size = byteStride * screen->height; + + return screen_size <= pcmciac->memory; +} + +Bool +pcmciaRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) +{ + KdScreenPriv(pScreen); + pcmciaScreenInfo *pcmcias = (pcmciaScreenInfo *) pScreenPriv->screen->driver; + + *rotations = (RR_Rotate_0|RR_Rotate_90|RR_Rotate_180|RR_Rotate_270| + RR_Reflect_X|RR_Reflect_Y); + + return KdRandRGetInfo (pScreen, pcmcias->randr, pcmciaRandRSupported); +} + +int +pcmciaLayerAdd (WindowPtr pWin, pointer value) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + LayerPtr pLayer = (LayerPtr) value; + + if (!LayerWindowAdd (pScreen, pLayer, pWin)) + return WT_STOPWALKING; + + return WT_WALKCHILDREN; +} + +int +pcmciaLayerRemove (WindowPtr pWin, pointer value) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + LayerPtr pLayer = (LayerPtr) value; + + LayerWindowRemove (pScreen, pLayer, pWin); + + return WT_WALKCHILDREN; +} + +pcmciaRandRSetConfig (ScreenPtr pScreen, + Rotation randr, + int rate, + RRScreenSizePtr pSize) +{ + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + FbdevPriv *priv = pScreenPriv->card->driver; + pcmciaScreenInfo *pcmcias = (pcmciaScreenInfo *) pScreenPriv->screen->driver; + Bool wasEnabled = pScreenPriv->enabled; + int newwidth, newheight; + LayerPtr pNewLayer; + int kind; + int oldrandr = pcmcias->randr; + PixmapPtr pPixmap; + const KdMonitorTiming *t; + + randr = KdAddRotation (screen->randr, randr); + + t = KdRandRGetTiming (pScreen, pcmciaRandRSupported, rate, pSize); + + if (wasEnabled) + KdDisableScreen (pScreen); + + screen->rate = t->rate; + screen->width = t->horizontal; + screen->height = t->vertical; + + pcmcias->randr = randr; + pcmciaConfigureScreen (pScreen); + + pNewLayer = pcmciaLayerCreate (pScreen); + + if (!pNewLayer) + { + pcmcias->randr = oldrandr; + pcmciaConfigureScreen (pScreen); + if (wasEnabled) + KdEnableScreen (pScreen); + return FALSE; + } + + if (WalkTree (pScreen, pcmciaLayerAdd, (pointer) pNewLayer) == WT_STOPWALKING) + { + WalkTree (pScreen, pcmciaLayerRemove, (pointer) pNewLayer); + LayerDestroy (pScreen, pNewLayer); + pcmcias->randr = oldrandr; + pcmciaConfigureScreen (pScreen); + if (wasEnabled) + KdEnableScreen (pScreen); + return FALSE; + } + WalkTree (pScreen, pcmciaLayerRemove, (pointer) pcmcias->pLayer); + LayerDestroy (pScreen, pcmcias->pLayer); + pcmcias->pLayer = pNewLayer; + if (wasEnabled) + KdEnableScreen (pScreen); + return TRUE; +} + +Bool +pcmciaRandRInit (ScreenPtr pScreen) +{ + rrScrPrivPtr pScrPriv; + + if (!RRScreenInit (pScreen)) + return FALSE; + + pScrPriv = rrGetScrPriv(pScreen); + pScrPriv->rrGetInfo = pcmciaRandRGetInfo; + pScrPriv->rrSetConfig = pcmciaRandRSetConfig; + return TRUE; +} +#endif + +Bool +pcmciaInitScreen (ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + FbdevPriv *priv = pScreenPriv->card->driver; + pcmciaScreenInfo *pcmcias = (pcmciaScreenInfo *) pScreenPriv->screen->driver; + + if (!LayerStartInit (pScreen)) + return FALSE; + if (!LayerFinishInit (pScreen)) + return FALSE; + + pcmciaConfigureScreen (pScreen); + + pcmcias->pLayer = pcmciaLayerCreate (pScreen); + if (!pcmcias->pLayer) + return FALSE; +#ifdef RANDR + if (!pcmciaRandRInit (pScreen)) + return FALSE; +#endif + return TRUE; +} + +CARD8 +pcmciaReadIndex (pcmciaCardInfo *pcmciac, CARD16 port, CARD8 index) +{ + CARD8 value; + + pcmciac->cop_base[port] = index; + value = pcmciac->cop_base[port+1]; + return value; +} + +void +pcmciaWriteIndex (pcmciaCardInfo *pcmciac, CARD16 port, CARD8 index, CARD8 value) +{ + pcmciac->cop_base[port] = index; + pcmciac->cop_base[port+1] = value; +} + +CARD8 +pcmciaReadReg (pcmciaCardInfo *pcmciac, CARD16 port) +{ + CARD8 value; + + value = pcmciac->cop_base[port]; + + return value; +} + +void +pcmciaWriteReg (pcmciaCardInfo *pcmciac, CARD16 port, CARD8 value) +{ + pcmciac->cop_base[port] = value; +} + + +void +pcmciaPause () +{ + struct timeval tv; + + tv.tv_sec = 0; + tv.tv_usec = 50 * 1000; + select (1, 0, 0, 0, &tv); +} + +void +pcmciaPreserve (KdCardInfo *card) +{ +} + +/* CLOCK_FACTOR is double the osc freq in kHz (osc = 14.31818 MHz) */ +#define CLOCK_FACTOR 28636 + +/* stability constraints for internal VCO -- MAX_VCO also determines the maximum Video pixel clock */ +#define MIN_VCO CLOCK_FACTOR +#define MAX_VCO 111000 + +/* clock in kHz is (numer * CLOCK_FACTOR / (denom & 0x3E)) >> (denom & 1) */ +#define VCOVAL(n, d) \ + ((((n) & 0x7F) * CLOCK_FACTOR / ((d) & 0x3E)) ) + +#define CLOCKVAL(n, d) \ + (VCOVAL(n, d) >> ((d) & 1)) + +static Bool +CirrusFindClock(int freq, int *num_out, int *den_out) +{ + int n; + int num = 0, den = 0; + int mindiff; + + /* + * If max_clock is greater than the MAX_VCO default, ignore + * MAX_VCO. On the other hand, if MAX_VCO is higher than max_clock, + * make use of the higher MAX_VCO value. + */ + + mindiff = freq; + for (n = 0x10; n < 0x7f; n++) { + int d; + for (d = 0x14; d < 0x3f; d++) { + int c, diff; + /* Avoid combinations that can be unstable. */ + if ((VCOVAL(n, d) < MIN_VCO) || (VCOVAL(n, d) > MAX_VCO)) + continue; + c = CLOCKVAL(n, d); + diff = abs(c - freq); + if (diff < mindiff) { + mindiff = diff; + num = n; + den = d; + } + } + } + if (n == 0x80) + return FALSE; + + *num_out = num; + *den_out = den; + + return TRUE; +} + + +static Bool +tridentSetCLK(int clock, CARD8 *a, CARD8 *b) +{ + int powerup[4] = { 1,2,4,8 }; + int clock_diff = 750; + int freq, ffreq; + int m, n, k; + int p, q, r, s; + int startn, endn; + int endm, endk; + + p = q = r = s = 0; + + startn = 0; + endn = 121; + endm = 31; + endk = 1; + + freq = clock; + + for (k=0;k<=endk;k++) + for (n=startn;n<=endn;n++) + for (m=1;m<=endm;m++) + { + ffreq = ( ( ((n + 8) * CLOCK) / ((m + 2) * powerup[k]) )); + if ((ffreq > freq - clock_diff) && (ffreq < freq + clock_diff)) + { + clock_diff = (freq > ffreq) ? freq - ffreq : ffreq - freq; + p = n; q = m; r = k; s = ffreq; + } + } + +#if 0 + ErrorF ("ffreq %d clock %d\n", s, clock); +#endif + if (s == 0) + return FALSE; + + /* N is first 7bits, first M bit is 8th bit */ + *a = ((1 & q) << 7) | p; + /* first 4bits are rest of M, 1bit for K value */ + *b = (((q & 0xFE) >> 1) | (r << 4)); + return TRUE; +} + +Bool +pcmciaEnable (ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + pcmciaCardInfo *pcmciac = pScreenPriv->card->driver; + pcmciaScreenInfo *pcmcias = (pcmciaScreenInfo *) screen->driver; + int i,j; + unsigned char Sequencer[6]; + unsigned char CRTC[31]; + unsigned char Graphics[9]; + unsigned char Attribute[21]; + unsigned char MiscOutReg; + const KdMonitorTiming *t; + int hactive, hblank, hfp, hbp; + int vactive, vblank, vfp, vbp; + + int h_active; + int h_total; + int h_display_end; + int h_sync_start; + int h_sync_end; + int h_skew = 0; + + int v_active; + int v_total; + int v_sync_start; + int v_sync_end; + int v_skew = 0; + + t = KdFindMode (screen, pcmciaModeSupported); + + hactive = t->horizontal; + hfp = t->hfp; + hbp = t->hbp; + hblank = t->hblank; + + h_active = hactive; + h_sync_start = hactive + hfp; + h_sync_end = hactive + hblank - hbp; + h_total = hactive + hblank; + + vactive = t->vertical; + vfp = t->vfp; + vbp = t->vbp; + vblank = t->vblank; + + v_active = vactive; + v_sync_start = vactive + vfp; + v_sync_end = vactive + vblank - vbp; + v_total = vactive + vblank; + + /* + * compute correct Hsync & Vsync polarity + */ + + MiscOutReg = 0x23; + if (t->hpol == KdSyncNegative) + MiscOutReg |= 0x40; + if (t->vpol == KdSyncNegative) + MiscOutReg |= 0x80; + + /* + * Time Sequencer + */ + if (pScreenPriv->screen->fb[0].depth == 4) + Sequencer[0] = 0x02; + else + Sequencer[0] = 0x00; + Sequencer[1] = 0x01; + Sequencer[2] = 0x0F; + Sequencer[3] = 0x00; /* Font select */ + if (pScreenPriv->screen->fb[0].depth < 8) + Sequencer[4] = 0x06; /* Misc */ + else + Sequencer[4] = 0x0E; /* Misc */ + Sequencer[5] = 0x00; + + /* + * CRTC Controller + */ + CRTC[0] = ((h_total) >> 3) - 5; + CRTC[1] = (hactive >> 3) - 1; + CRTC[2] = ((min(h_sync_start,h_active)) >> 3) - 1; + CRTC[3] = ((((min(h_sync_end,h_total)) >> 3) - 1) & 0x1F) | 0x80; + i = (((h_skew << 2) + 0x10) & ~0x1F); + if (i < 0x80) + CRTC[3] |= i; + CRTC[4] = (h_sync_start >> 3); + CRTC[5] = (((((min(h_sync_end,h_total)) >> 3) - 1) & 0x20) << 2) + | (((h_sync_end >> 3)) & 0x1F); + + CRTC[6] = (v_total - 2) & 0xFF; + CRTC[7] = (((v_total - 2) & 0x100) >> 8) + | (((v_active - 1) & 0x100) >> 7) + | ((v_sync_start & 0x100) >> 6) + | ((((min(v_sync_start,v_active)) - 1) & 0x100) >> 5) + | 0x10 + | (((v_total - 2) & 0x200) >> 4) + | (((v_active - 1) & 0x200) >> 3) + | ((v_sync_start & 0x200) >> 2); + CRTC[8] = 0x00; + CRTC[9] = ((((min(v_sync_start,v_active))-1) & 0x200) >> 4) | 0x40; + CRTC[10] = 0x00; + CRTC[11] = 0x00; + CRTC[12] = 0x00; + CRTC[13] = 0x00; + CRTC[14] = 0x00; + CRTC[15] = 0x00; + CRTC[16] = v_sync_start & 0xFF; + CRTC[17] = (v_sync_end & 0x0F) | 0x20; + CRTC[18] = (v_active - 1) & 0xFF; + if (pScreenPriv->screen->fb[0].depth == 4) + CRTC[19] = pScreenPriv->screen->fb[0].pixelStride >> 4; + else + if (pScreenPriv->screen->fb[0].depth == 8) + CRTC[19] = pScreenPriv->screen->fb[0].pixelStride >> 3; + else + if (pScreenPriv->screen->fb[0].depth == 16 || + pScreenPriv->screen->fb[0].depth == 15) + CRTC[19] = pScreenPriv->screen->fb[0].pixelStride >> 2; + CRTC[20] = 0x00; + CRTC[21] = ((min(v_sync_end,v_active)) - 1) & 0xFF; + CRTC[22] = ((min(v_sync_end,v_active)) - 1) & 0xFF; + if (pScreenPriv->screen->fb[0].depth < 8) + CRTC[23] = 0xE3; + else + CRTC[23] = 0xC3; + CRTC[24] = 0xFF; + CRTC[25] = 0x00; + CRTC[26] = 0x00; +#if 0 + if (!pcmciac->HP) + if (mode.Flags & V_INTERLACE) CRTC[26] |= 0x01; +#endif + if (pcmciac->HP) + CRTC[27] = 0x00; + else + CRTC[27] = 0x22; + CRTC[28] = 0x00; + CRTC[29] = 0x00; + CRTC[30] = 0x80; +#if 0 + if (pcmciac->HP) + if (mode.Flags & V_INTERLACE) CRTC[30] |= 0x04; +#endif + +{ + int nExtBits = 0; + CARD32 ExtBits; + CARD32 ExtBitMask = ((1 << nExtBits) - 1) << 6; + + CRTC[3] = (CRTC[3] & ~0x1F) + | ((((min(h_sync_end,h_total)) >> 3) - 1) & 0x1F); + CRTC[5] = (CRTC[5] & ~0x80) + | (((((min(h_sync_end,h_total)) >> 3) - 1) & 0x20) << 2); + ExtBits = (((min(h_sync_end,h_total)) >> 3) - 1) & ExtBitMask; + + /* First the horizontal case */ + if ((((min(h_sync_end,h_total)) >> 3) == (h_total >> 3))) + { + int i = (CRTC[3] & 0x1F) + | ((CRTC[5] & 0x80) >> 2) + | ExtBits; + if ((i-- > ((((min(h_sync_start,h_active)) >> 3) - 1) + & (0x3F | ExtBitMask))) + && ((min(h_sync_end,h_total)) == h_total)) + i = 0; + CRTC[3] = (CRTC[3] & ~0x1F) | (i & 0x1F); + CRTC[5] = (CRTC[5] & ~0x80) | ((i << 2) & 0x80); + ExtBits = i & ExtBitMask; + } +} +{ + CARD32 ExtBits; + CARD32 ExtBitMask = 0; + /* 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 = 0; + int VBlankStart = ((min(v_sync_start,v_active)) - 1) & 0xFF; + CRTC[22] = ((min(v_sync_end,v_total)) - 1) & 0xFF; + ExtBits = ((min(v_sync_end,v_total)) - 1) & ExtBitMask; + + if ((min(v_sync_end,v_total)) == v_total) + /* Null top overscan */ + { + int i = CRTC[22] | ExtBits; + if (((BitMask && ((i & BitMask) > (VBlankStart & BitMask))) + || ((i > VBlankStart) && /* 8-bit case */ + ((i & 0x7F) > (VBlankStart & 0x7F)))) && /* 7-bit case */ + !(CRTC[9] & 0x9F)) /* 1 scanline/row */ + i = 0; + else + i = (i - 1); + CRTC[22] = i & 0xFF; + ExtBits = i & 0xFF00; + } +} + + /* + * Graphics Display Controller + */ + Graphics[0] = 0x00; + Graphics[1] = 0x00; + Graphics[2] = 0x00; + Graphics[3] = 0x00; + Graphics[4] = 0x00; + if (pScreenPriv->screen->fb[0].depth == 4) + Graphics[5] = 0x02; + else + Graphics[5] = 0x40; + Graphics[6] = 0x05; /* only map 64k VGA memory !!!! */ + Graphics[7] = 0x0F; + Graphics[8] = 0xFF; + + Attribute[0] = 0x00; /* standard colormap translation */ + Attribute[1] = 0x01; + Attribute[2] = 0x02; + Attribute[3] = 0x03; + Attribute[4] = 0x04; + Attribute[5] = 0x05; + Attribute[6] = 0x06; + Attribute[7] = 0x07; + Attribute[8] = 0x08; + Attribute[9] = 0x09; + Attribute[10] = 0x0A; + Attribute[11] = 0x0B; + Attribute[12] = 0x0C; + Attribute[13] = 0x0D; + Attribute[14] = 0x0E; + Attribute[15] = 0x0F; + if (pScreenPriv->screen->fb[0].depth == 4) + Attribute[16] = 0x81; + else + Attribute[16] = 0x41; + if (pScreenPriv->screen->fb[0].bitsPerPixel == 16) + Attribute[17] = 0x00; + else + Attribute[17] = 0xFF; + Attribute[18] = 0x0F; + Attribute[19] = 0x00; + Attribute[20] = 0x00; + + /* Wake up the card */ + if (pcmciac->HP) { + pcmciaWriteReg(pcmciac, 0x3c3, 0x1); + pcmciaWriteReg(pcmciac, 0x46e8, 0x10); + } else { + pcmciaWriteReg(pcmciac, 0x105, 0x1); + pcmciaWriteReg(pcmciac, 0x46e8, 0x1f); + pcmciaWriteReg(pcmciac, 0x102, 0x1); + pcmciaWriteReg(pcmciac, 0x46e8, 0xf); + pcmciaWriteReg(pcmciac, 0x3c3, 0x1); + } + + if (pcmciac->HP) { + /* unlock */ + pcmciaWriteIndex(pcmciac, 0x3c4, 0x11, 0x92); + j = pcmciaReadIndex(pcmciac, 0x3c4, 0xb); + pcmciaWriteIndex(pcmciac, 0x3c4, 0xe, 0xc2); + + /* switch on dac */ + pcmciaWriteIndex(pcmciac, 0x3d4, 0x29, 0x24); + /* switch on the accelerator */ + pcmciaWriteIndex(pcmciac, 0x3d4, 0x36, 0x80); + + /* bump up memory clk */ + pcmciaWriteReg(pcmciac, 0x43c6, 0x65); + pcmciaWriteReg(pcmciac, 0x43c7, 0x00); + } else { + /* unlock */ + pcmciaWriteIndex(pcmciac, 0x3c4, 0x06, 0x12); + pcmciaWriteReg(pcmciac, 0x3c2, MiscOutReg); + } + + /* synchronous reset */ + pcmciaWriteIndex(pcmciac, 0x3c4, 0, 0); + + pcmciaWriteReg(pcmciac, 0x3da, 0x10); + + for (i=0;i<6;i++) + pcmciaWriteIndex(pcmciac, 0x3c4, i, Sequencer[i]); + + if (pcmciac->HP) { + /* Stick chip into color mode */ + pcmciaWriteIndex(pcmciac, 0x3ce, 0x2f, 0x06); + /* Switch on Linear addressing */ + pcmciaWriteIndex(pcmciac, 0x3d4, 0x21, 0x2e); + } else { + /* Stick chip into 8bit access mode - ugh! */ + pcmciaWriteIndex(pcmciac, 0x3c4, 0x0F, 0x20); /* 0x26 ? */ + /* reset mclk */ + pcmciaWriteIndex(pcmciac, 0x3c4, 0x1F, 0); + } + + pcmciaWriteIndex(pcmciac, 0x3c4, 0, 0x3); + + for (i=0;i<31;i++) + pcmciaWriteIndex(pcmciac, 0x3d4, i, CRTC[i]); + + for (i=0;i<9;i++) + pcmciaWriteIndex(pcmciac, 0x3ce, i, Graphics[i]); + + j = pcmciaReadReg(pcmciac, 0x3da); + + for (i=0;i<21;i++) { + pcmciaWriteReg(pcmciac, 0x3c0, i); + pcmciaWriteReg(pcmciac, 0x3c0, Attribute[i]); + } + + j = pcmciaReadReg(pcmciac, 0x3da); + pcmciaWriteReg(pcmciac, 0x3c0, 0x20); + + j = pcmciaReadReg(pcmciac, 0x3c8); + j = pcmciaReadReg(pcmciac, 0x3c6); + j = pcmciaReadReg(pcmciac, 0x3c6); + j = pcmciaReadReg(pcmciac, 0x3c6); + j = pcmciaReadReg(pcmciac, 0x3c6); + switch (pScreenPriv->screen->fb[0].depth) { + /* This is here for completeness, when/if we ever do 4bpp */ + case 4: + pcmciaWriteReg(pcmciac, 0x3c6, 0x0); + if (pcmciac->HP) { + pcmciaWriteIndex(pcmciac, 0x3ce, 0x0f, 0x90); + pcmciaWriteIndex(pcmciac, 0x3d4, 0x38, 0x00); + } else + pcmciaWriteIndex(pcmciac, 0x3c4, 0x07, 0x00); + break; + case 8: + pcmciaWriteReg(pcmciac, 0x3c6, 0x0); + if (pcmciac->HP) { + pcmciaWriteIndex(pcmciac, 0x3ce, 0x0f, 0x92); + pcmciaWriteIndex(pcmciac, 0x3d4, 0x38, 0x00); + } else + pcmciaWriteIndex(pcmciac, 0x3c4, 0x07, 0x01); + break; + case 15: + if (pcmciac->HP) { + pcmciaWriteReg(pcmciac, 0x3c6, 0x10); + pcmciaWriteIndex(pcmciac, 0x3ce, 0x0f, 0x9a); + pcmciaWriteIndex(pcmciac, 0x3d4, 0x38, 0x04); + } else { + pcmciaWriteReg(pcmciac, 0x3c6, 0xC0); + pcmciaWriteIndex(pcmciac, 0x3c4, 0x07, 0x03); + } + break; + case 16: + if (pcmciac->HP) { + pcmciaWriteReg(pcmciac, 0x3c6, 0x30); + pcmciaWriteIndex(pcmciac, 0x3ce, 0x0f, 0x9a); + pcmciaWriteIndex(pcmciac, 0x3d4, 0x38, 0x04); + } else { + pcmciaWriteReg(pcmciac, 0x3c6, 0xC1); + pcmciaWriteIndex(pcmciac, 0x3c4, 0x07, 0x03); + } + break; + } + j = pcmciaReadReg(pcmciac, 0x3c8); + + pcmciaWriteReg(pcmciac, 0x3c6, 0xff); + + for (i=0;i<256;i++) { + pcmciaWriteReg(pcmciac, 0x3c8, i); + pcmciaWriteReg(pcmciac, 0x3c9, i); + pcmciaWriteReg(pcmciac, 0x3c9, i); + pcmciaWriteReg(pcmciac, 0x3c9, i); + } + + /* Set the Clock */ + if (pcmciac->HP) { + CARD8 a,b; + int clock = t->clock; + if (pScreenPriv->screen->fb[0].bitsPerPixel == 16) + clock *= 2; + tridentSetCLK(clock, &a, &b); + pcmciaWriteReg(pcmciac, 0x43c8, a); + pcmciaWriteReg(pcmciac, 0x43c9, b); + } else { + int num, den; + unsigned char tmp; + int clock = t->clock; + if (pScreenPriv->screen->fb[0].bitsPerPixel == 16) + clock *= 2; + + CirrusFindClock(clock, &num, &den); + + tmp = pcmciaReadIndex(pcmciac, 0x3c4, 0x0d); + pcmciaWriteIndex(pcmciac, 0x3c4, 0x0d, (tmp & 0x80) | num); + tmp = pcmciaReadIndex(pcmciac, 0x3c4, 0x1d); + pcmciaWriteIndex(pcmciac, 0x3c4, 0x1d, (tmp & 0xc0) | den); + } + pcmciaWriteReg(pcmciac, 0x3c2, MiscOutReg | 0x08); + +#if 1 + for (i=1;i<0x3f;i++) + ErrorF("0x3c4:%02x: 0x%x\n",i,pcmciaReadIndex(pcmciac, 0x3c4, i)); + + ErrorF("\n"); + + for (i=0;i<0x3f;i++) + ErrorF("0x3ce:%02x: 0x%x\n",i,pcmciaReadIndex(pcmciac, 0x3ce, i)); + + ErrorF("\n"); + + for (i=0;i<0x3f;i++) + ErrorF("0x3d4:%02x: 0x%x\n",i,pcmciaReadIndex(pcmciac, 0x3d4, i)); +#endif + + return TRUE; +} + +void +pcmciaDisable (ScreenPtr pScreen) +{ +} + +const CARD8 tridentDPMSModes[4] = { + 0x00, /* KD_DPMS_NORMAL */ + 0x01, /* KD_DPMS_STANDBY */ + 0x02, /* KD_DPMS_SUSPEND */ + 0x03, /* KD_DPMS_POWERDOWN */ +}; + +Bool +pcmciaDPMS (ScreenPtr pScreen, int mode) +{ + KdScreenPriv(pScreen); + pcmciaCardInfo *pcmciac = pScreenPriv->card->driver; + + if (pcmciac->HP) { + pcmciaWriteIndex (pcmciac, 0x3ce, 0x23, tridentDPMSModes[mode]); + pcmciaPause (); + } else { + /* Voyager */ + } + + return TRUE; +} + +void +pcmciaRestore (KdCardInfo *card) +{ +} + +void +pcmciaScreenFini (KdScreenInfo *screen) +{ + pcmciaScreenInfo *pcmcias = (pcmciaScreenInfo *) screen->driver; + + xfree (pcmcias); + screen->driver = 0; +} + +void +pcmciaCardFini (KdCardInfo *card) +{ + pcmciaCardInfo *pcmciac = card->driver; + + if (pcmciac->cop_base) + KdUnmapDevice ((void *) pcmciac->cop_base, PCMCIA_COP_SIZE(card)); +} + +void +pcmciaGetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs) +{ + KdScreenPriv(pScreen); + pcmciaCardInfo *pcmciac = pScreenPriv->card->driver; + + while (ndef--) + { + pcmciaWriteReg (pcmciac, 0x3C7, pdefs->pixel); + pdefs->red = pcmciaReadReg (pcmciac, 0x3C9) << 10; + pdefs->green = pcmciaReadReg (pcmciac, 0x3C9) << 10; + pdefs->blue = pcmciaReadReg (pcmciac, 0x3C9) << 10; + pdefs++; + } +} + +void +pcmciaPutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs) +{ + KdScreenPriv(pScreen); + pcmciaCardInfo *pcmciac = pScreenPriv->card->driver; + + while (ndef--) + { + pcmciaWriteReg (pcmciac, 0x3C8, pdefs->pixel); + pcmciaWriteReg (pcmciac, 0x3C9, pdefs->red >> 10); + pcmciaWriteReg (pcmciac, 0x3C9, pdefs->green >> 10); + pcmciaWriteReg (pcmciac, 0x3C9, pdefs->blue >> 10); + pdefs++; + } +} + + +KdCardFuncs pcmciaFuncs = { + pcmciaCardInit, /* cardinit */ + pcmciaScreenInit, /* scrinit */ + pcmciaInitScreen, /* initScreen */ + pcmciaPreserve, /* preserve */ + pcmciaEnable, /* enable */ + pcmciaDPMS, /* dpms */ + pcmciaDisable, /* disable */ + pcmciaRestore, /* restore */ + pcmciaScreenFini, /* scrfini */ + pcmciaCardFini, /* cardfini */ + + pcmciaCursorInit, /* initCursor */ + pcmciaCursorEnable, /* enableCursor */ + pcmciaCursorDisable, /* disableCursor */ + pcmciaCursorFini, /* finiCursor */ + pcmciaRecolorCursor, /* recolorCursor */ + +#if 0 /* not yet */ + pcmciaDrawInit, /* initAccel */ + pcmciaDrawEnable, /* enableAccel */ + pcmciaDrawSync, /* syncAccel */ + pcmciaDrawDisable, /* disableAccel */ + pcmciaDrawFini, /* finiAccel */ +#else + 0, + 0, + 0, + 0, + 0, +#endif + + pcmciaGetColors, /* getColors */ + pcmciaPutColors, /* putColors */ +}; --- xorg-server-1.4.2.orig/hw/kdrive/pcmcia/pcmcia.h +++ xorg-server-1.4.2/hw/kdrive/pcmcia/pcmcia.h @@ -0,0 +1,267 @@ +/* + * Copyright 2001 by Alan Hourihane, Sychdyn, North Wales, UK. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright 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, + */ + +#ifndef _PCMCIA_H_ +#define _PCMCIA_H_ + +#include + +/* + * offset from ioport beginning + */ + +#define PCMCIA_COP_BASE(c) 0x20000000 +#define PCMCIA_COP_SIZE(c) 0x10000 +#define TRIDENT_COP_OFF(c) 0x2100 + +typedef volatile CARD8 VOL8; +typedef volatile CARD16 VOL16; +typedef volatile CARD32 VOL32; + +typedef struct _cop { + VOL32 src_start_xy; /* 0x00 */ + VOL32 src_end_xy; /* 0x04 */ + VOL32 dst_start_xy; /* 0x08 */ + VOL32 dst_end_xy; /* 0x0c */ + VOL32 alpha; /* 0x10 */ + CARD8 pad14[0xc]; /* 0x14 */ + VOL32 multi; /* 0x20 */ + +#define COP_MULTI_CLIP_TOP_LEFT 0x10000000 +#define COP_MULTI_DEPTH 0x40000000 +#define COP_MULTI_COLOR_KEY 0x70000000 +#define COP_MULTI_STYLE 0x50000000 +#define COP_MULTI_PATTERN 0x80000000 +#define COP_MULTI_ROP 0x90000000 +#define COP_MULTI_STRIDE 0x60000000 +#define COP_MULTI_Z 0xa0000000 +#define COP_MULTI_ALPHA 0xb0000000 +#define COP_MULTI_TEXTURE 0xd0000000 +#define COP_MULTI_TEXTURE_BOUND 0xe0000000 +#define COP_MULTI_TEXTURE_ADVANCED 0x20000000 +#define COP_MULTI_MASK 0xf0000000 + +#define COP_DEPTH_8 0x00000000 +#define COP_DEPTH_16 0x00000001 +#define COP_DEPTH_24_32 0x00000002 +#define COP_DEPTH_15 0x00000005 +#define COP_DEPTH_DITHER_DISABLE 0x00000008 + + +#define COP_ALPHA_SRC_BLEND_0 0x00000000 +#define COP_ALPHA_SRC_BLEND_1 0x00000001 +#define COP_ALPHA_SRC_BLEND_SRC_C 0x00000002 +#define COP_ALPHA_SRC_BLEND_1_SRC_C 0x00000003 +#define COP_ALPHA_SRC_BLEND_SRC_A 0x00000004 +#define COP_ALPHA_SRC_BLEND_1_SRC_A 0x00000005 +#define COP_ALPHA_SRC_BLEND_DST_A 0x00000006 +#define COP_ALPHA_SRC_BLEND_1_DST_A 0x00000007 +#define COP_ALPHA_SRC_BLEND_DST_C 0x00000008 +#define COP_ALPHA_SRC_BLEND_1_DST_C 0x00000009 +#define COP_ALPHA_SRC_BLEND_SAT 0x0000000A +#define COP_ALPHA_SRC_BLEND_BG 0x0000000B + +#define COP_ALPHA_DST_BLEND_0 0x00000000 +#define COP_ALPHA_DST_BLEND_1 0x00000010 +#define COP_ALPHA_DST_BLEND_SRC_C 0x00000020 +#define COP_ALPHA_DST_BLEND_1_SRC_C 0x00000030 +#define COP_ALPHA_DST_BLEND_SRC_A 0x00000040 +#define COP_ALPHA_DST_BLEND_1_SRC_A 0x00000050 +#define COP_ALPHA_DST_BLEND_DST_A 0x00000060 +#define COP_ALPHA_DST_BLEND_1_DST_A 0x00000070 +#define COP_ALPHA_DST_BLEND_DST_C 0x00000080 +#define COP_ALPHA_DST_BLEND_1_DST_C 0x00000090 +#define COP_ALPHA_DST_BLEND_OTHER 0x000000A0 + +#define COP_ALPHA_RESULT_ALPHA 0x00100000 +#define COP_ALPHA_DEST_ALPHA 0x00200000 +#define COP_ALPHA_SOURCE_ALPHA 0x00400000 +#define COP_ALPHA_WRITE_ENABLE 0x00800000 +#define COP_ALPHA_TEST_ENABLE 0x01000000 +#define COP_ALPHA_BLEND_ENABLE 0x02000000 +#define COP_ALPHA_DEST_VALUE 0x04000000 +#define COP_ALPHA_SOURCE_VALUE 0x08000000 + + VOL32 command; /* 0x24 */ +#define COP_OP_NULL 0x00000000 +#define COP_OP_LINE 0x20000000 +#define COP_OP_BLT 0x80000000 +#define COP_OP_TEXT 0x90000000 +#define COP_OP_POLY 0xb0000000 +#define COP_OP_POLY2 0xe0000000 +#define COP_SCL_EXPAND 0x00800000 +#define COP_SCL_OPAQUE 0x00400000 +#define COP_SCL_REVERSE 0x00200000 +#define COP_SCL_MONO_OFF 0x001c0000 +#define COP_LIT_TEXTURE 0x00004000 +#define COP_BILINEAR 0x00002000 +#define COP_OP_ZBUF 0x00000800 +#define COP_OP_ROP 0x00000400 +#define COP_OP_FG 0x00000200 +#define COP_OP_FB 0x00000080 +#define COP_X_REVERSE 0x00000004 +#define COP_CLIP 0x00000001 + VOL32 texture_format; /* 0x28 */ + CARD8 pad2c[0x4]; /* 0x2c */ + + VOL32 clip_bottom_right; /* 0x30 */ + VOL32 dataIII; /* 0x34 */ + VOL32 dataIV; /* 0x38 */ + CARD8 pad3c[0x8]; /* 0x3c */ + + VOL32 fg; /* 0x44 */ + VOL32 bg; /* 0x48 */ + CARD8 pad4c[0x4]; /* 0x4c */ + + VOL32 pattern_fg; /* 0x50 */ + VOL32 pattern_bg; /* 0x54 */ + CARD8 pad58[0xc]; /* 0x58 */ + + VOL32 status; /* 0x64 */ +#define COP_STATUS_BE_BUSY 0x80000000 +#define COP_STATUS_DPE_BUSY 0x20000000 +#define COP_STATUS_MI_BUSY 0x10000000 +#define COP_STATUS_FIFO_BUSY 0x08000000 +#define COP_STATUS_WB_BUSY 0x00800000 +#define COP_STATUS_Z_FAILED 0x00400000 +#define COP_STATUS_EFFECTIVE 0x00200000 +#define COP_STATUS_LEFT_VIEW 0x00080000 + + CARD8 pad68[0x4]; /* 0x68 */ + + VOL32 src_offset; /* 0x6c */ + VOL32 z_offset; /* 0x70 */ + CARD8 pad74[0x4]; /* 0x74 */ + + VOL32 display_offset; /* 0x78 */ + VOL32 dst_offset; /* 0x7c */ + CARD8 pad80[0x34]; /* 0x80 */ + + VOL32 semaphore; /* 0xb4 */ +} Cop; + +#define TRI_XY(x,y) ((y) << 16 | (x)) + +typedef struct _pcmciaCardInfo { + CARD8 *fb; + Bool HP; + CARD32 memory; + CARD8 *cop_base; + Cop *cop; + CARD32 *window; + CARD32 cop_depth; + CARD32 cop_stride; +} pcmciaCardInfo; + +#define getpcmciaCardInfo(kd) ((pcmciaCardInfo *) ((kd)->card->driver)) +#define pcmciaCardInfo(kd) pcmciaCardInfo *pcmciac = getpcmciaCardInfo(kd) + +typedef struct _pcmciaCursor { + int width, height; + int xhot, yhot; + Bool has_cursor; + CursorPtr pCursor; + Pixel source, mask; +} pcmciaCursor; + +#define PCMCIA_CURSOR_WIDTH 64 +#define PCMCIA_CURSOR_HEIGHT 64 + +typedef struct _pcmciaScreenInfo { + CARD8 *cursor_base; + CARD8 *screen; + CARD8 *off_screen; + int off_screen_size; + int randr; + LayerPtr pLayer; + pcmciaCursor cursor; +} pcmciaScreenInfo; + +#define getpcmciaScreenInfo(kd) ((pcmciaScreenInfo *) ((kd)->screen->driver)) +#define pcmciaScreenInfo(kd) pcmciaScreenInfo *pcmcias = getpcmciaScreenInfo(kd) + +Bool +pcmciaDrawInit (ScreenPtr pScreen); + +void +pcmciaDrawEnable (ScreenPtr pScreen); + +void +pcmciaDrawSync (ScreenPtr pScreen); + +void +pcmciaDrawDisable (ScreenPtr pScreen); + +void +pcmciaDrawFini (ScreenPtr pScreen); + +CARD8 +pcmciaReadIndex (pcmciaCardInfo *pcmciac, CARD16 port, CARD8 index); + +void +pcmciaWriteIndex (pcmciaCardInfo *pcmciac, CARD16 port, CARD8 index, CARD8 value); + +void +pcmciaWriteReg (pcmciaCardInfo *pcmciac, CARD16 port, CARD8 value); + +Bool +pcmciaCursorInit (ScreenPtr pScreen); + +void +pcmciaCursorEnable (ScreenPtr pScreen); + +void +pcmciaCursorDisable (ScreenPtr pScreen); + +void +pcmciaCursorFini (ScreenPtr pScreen); + +void +pcmciaRecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef); + +void +pcmciaUpdateRotatePacked (ScreenPtr pScreen, + shadowBufPtr pBuf); + +typedef struct _pcmciaDisplayModeRec { + int Width; + int Height; + int Refresh; + int Clock; /* pixel clock freq */ + 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; +} pcmciaDisplayModeRec, *pcmciaDisplayModePtr; + +extern KdCardFuncs pcmciaFuncs; + +#endif /* _PCMCIA_H_ */ --- xorg-server-1.4.2.orig/hw/kdrive/pcmcia/pcmciashadow.c +++ xorg-server-1.4.2/hw/kdrive/pcmcia/pcmciashadow.c @@ -0,0 +1,199 @@ +/* + * Copyright 2001 by Alan Hourihane, Sychdyn, North Wales, UK. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright 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, + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include "scrnintstr.h" +#include "windowstr.h" +#include "font.h" +#include "dixfontstr.h" +#include "fontstruct.h" +#include "mi.h" +#include "regionstr.h" +#include "globals.h" +#include "gcstruct.h" +#include "shadow.h" +#include "fb.h" + +void +tridentUpdatePacked (ScreenPtr pScreen, + shadowBufPtr pBuf) +{ + RegionPtr damage = &pBuf->damage; + PixmapPtr pShadow = pBuf->pPixmap; + shadowScrPriv(pScreen); + int nbox = REGION_NUM_RECTS (damage); + BoxPtr pbox = REGION_RECTS (damage); + FbBits *shaBase, *shaLine, *sha; + FbStride shaStride; + int scrBase, scrLine, scr; + int shaBpp; + int shaXoff, shaYoff; /* XXX assumed to be zero */ + int x, y, w, h, width; + int i; + FbBits *winBase, *win; + CARD32 winSize; + + fbGetDrawable (&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff, shaYoff); + while (nbox--) + { + x = pbox->x1 * shaBpp; + y = pbox->y1; + w = (pbox->x2 - pbox->x1) * shaBpp; + h = pbox->y2 - pbox->y1; + + scrLine = (x >> FB_SHIFT); + shaLine = shaBase + y * shaStride + (x >> FB_SHIFT); + + x &= FB_MASK; + w = (w + x + FB_MASK) >> FB_SHIFT; + + while (h--) + { + winSize = 0; + scrBase = 0; + width = w; + scr = scrLine; + sha = shaLine; + while (width) { + /* how much remains in this window */ + i = scrBase + winSize - scr; + if (i <= 0 || scr < scrBase) + { + winBase = (FbBits *) (*pBuf->window) (pScreen, + y, + scr * sizeof (FbBits), + SHADOW_WINDOW_WRITE, + &winSize, + pBuf->closure); + if(!winBase) + return; + scrBase = scr; + winSize /= sizeof (FbBits); + i = winSize; + } + win = winBase + (scr - scrBase); + if (i > width) + i = width; + width -= i; + scr += i; + { + CARD16 *sha16 = (CARD16*)sha; + CARD16 *win16 = (CARD16*)win; + while (i--) + { + *win16++ = *sha16++; + *win16++ = *sha16++; + } + } + } + shaLine += shaStride; + y++; + } + pbox++; + } +} + +void +cirrusUpdatePacked (ScreenPtr pScreen, + shadowBufPtr pBuf) +{ + RegionPtr damage = &pBuf->damage; + PixmapPtr pShadow = pBuf->pPixmap; + shadowScrPriv(pScreen); + int nbox = REGION_NUM_RECTS (damage); + BoxPtr pbox = REGION_RECTS (damage); + FbBits *shaBase, *shaLine, *sha; + FbStride shaStride; + int scrBase, scrLine, scr; + int shaBpp; + int shaXoff, shaYoff; /* XXX assumed to be zero */ + int x, y, w, h, width; + int i; + FbBits *winBase, *win; + CARD32 winSize; + + fbGetDrawable (&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff, shaYoff); + while (nbox--) + { + x = pbox->x1 * shaBpp; + y = pbox->y1; + w = (pbox->x2 - pbox->x1) * shaBpp; + h = pbox->y2 - pbox->y1; + + scrLine = (x >> FB_SHIFT); + shaLine = shaBase + y * shaStride + (x >> FB_SHIFT); + + x &= FB_MASK; + w = (w + x + FB_MASK) >> FB_SHIFT; + + while (h--) + { + winSize = 0; + scrBase = 0; + width = w; + scr = scrLine; + sha = shaLine; + while (width) { + /* how much remains in this window */ + i = scrBase + winSize - scr; + if (i <= 0 || scr < scrBase) + { + winBase = (FbBits *) (*pBuf->window) (pScreen, + y, + scr * sizeof (FbBits), + SHADOW_WINDOW_WRITE, + &winSize, + pBuf->closure); + if(!winBase) + return; + scrBase = scr; + winSize /= sizeof (FbBits); + i = winSize; + } + win = winBase + (scr - scrBase); + if (i > width) + i = width; + width -= i; + scr += i; + { + CARD8 *sha8 = (CARD8*)sha; + CARD8 *win8 = (CARD8*)win; + while (i--) + { + *win8++ = *sha8++; + *win8++ = *sha8++; + *win8++ = *sha8++; + *win8++ = *sha8++; + } + } + } + shaLine += shaStride; + y++; + } + pbox++; + } +} --- xorg-server-1.4.2.orig/hw/kdrive/pcmcia/pcmciarotate.c +++ xorg-server-1.4.2/hw/kdrive/pcmcia/pcmciarotate.c @@ -0,0 +1,333 @@ +/* + * Copyright © 2001 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_CONFIG_H +#include +#endif +#include +#include "scrnintstr.h" +#include "windowstr.h" +#include "font.h" +#include "dixfontstr.h" +#include "fontstruct.h" +#include "mi.h" +#include "regionstr.h" +#include "globals.h" +#include "gcstruct.h" +#include "shadow.h" +#include "fb.h" + +/* + * These indicate which way the source (shadow) is scanned when + * walking the screen in a particular direction + */ + +#define LEFT_TO_RIGHT 1 +#define RIGHT_TO_LEFT -1 +#define TOP_TO_BOTTOM 2 +#define BOTTOM_TO_TOP -2 + +typedef CARD16 PcBits; +typedef INT32 PcStride; + +#define PC_SHIFT 4 +#define PC_UNIT (1 << PC_SHIFT) +#define PC_HALFUNIT (1 << (PC_SHIFT-1)) +#define PC_MASK (PC_UNIT - 1) +#define PC_ALLONES ((PcBits) -1) + +#define PcScrRight(x,b) FbScrRight(x,b) +#define PcScrLeft(x,b) FbScrLeft(x,b) +#define PcBitsMask(x,w) (PcScrRight(PC_ALLONES,(x) & PC_MASK) & \ + PcScrLeft(PC_ALLONES,(PC_UNIT - ((x) + (w))) & PC_MASK)) + +#define pcGetDrawable(pDrawable, pointer, stride, bpp, xoff, yoff) { \ + PixmapPtr _pPix; \ + if ((pDrawable)->type != DRAWABLE_PIXMAP) \ + _pPix = fbGetWindowPixmap(pDrawable); \ + else \ + _pPix = (PixmapPtr) (pDrawable); \ + (pointer) = (PcBits *) _pPix->devPrivate.ptr; \ + (stride) = ((int) _pPix->devKind) / sizeof (PcBits); \ + (bpp) = _pPix->drawable.bitsPerPixel; \ + (xoff) = 0; \ + (yoff) = 0; \ +} + +void +pcmciaUpdateRotatePacked (ScreenPtr pScreen, + shadowBufPtr pBuf) +{ + RegionPtr damage = &pBuf->damage; + PixmapPtr pShadow = pBuf->pPixmap; + int nbox = REGION_NUM_RECTS (damage); + BoxPtr pbox = REGION_RECTS (damage); + PcBits *shaBits; + PcStride shaStride; + int shaBpp; + int shaXoff, shaYoff; + int box_x1, box_x2, box_y1, box_y2; + int sha_x1, sha_y1; + int scr_x1, scr_x2, scr_y1, scr_y2, scr_w, scr_h; + int scr_x, scr_y; + int w; + int pixelsPerBits; + int pixelsMask; + PcStride shaStepOverY, shaStepDownY, shaStepOverX, shaStepDownX; + PcBits *shaLine, *sha; + int shaHeight = pShadow->drawable.height; + int shaWidth = pShadow->drawable.width; + PcBits shaMask; + int shaFirstShift, shaShift; + int o_x_dir; + int o_y_dir; + int x_dir; + int y_dir; + + pcGetDrawable (&pShadow->drawable, shaBits, shaStride, shaBpp, shaXoff, shaYoff); + pixelsPerBits = (sizeof (PcBits) * 8) / shaBpp; + pixelsMask = ~(pixelsPerBits - 1); + shaMask = PcBitsMask (PC_UNIT-shaBpp, shaBpp); + /* + * Compute rotation related constants to walk the shadow + */ + o_x_dir = LEFT_TO_RIGHT; + o_y_dir = TOP_TO_BOTTOM; + if (pBuf->randr & SHADOW_REFLECT_X) + o_x_dir = -o_x_dir; + if (pBuf->randr & SHADOW_REFLECT_Y) + o_y_dir = -o_y_dir; + switch (pBuf->randr & (SHADOW_ROTATE_ALL)) { + case SHADOW_ROTATE_0: /* upper left shadow -> upper left screen */ + default: + x_dir = o_x_dir; + y_dir = o_y_dir; + break; + case SHADOW_ROTATE_90: /* upper right shadow -> upper left screen */ + x_dir = o_y_dir; + y_dir = -o_x_dir; + break; + case SHADOW_ROTATE_180: /* lower right shadow -> upper left screen */ + x_dir = -o_x_dir; + y_dir = -o_y_dir; + break; + case SHADOW_ROTATE_270: /* lower left shadow -> upper left screen */ + x_dir = -o_y_dir; + y_dir = o_x_dir; + break; + } + switch (x_dir) { + case LEFT_TO_RIGHT: + shaStepOverX = shaBpp; + shaStepOverY = 0; + break; + case TOP_TO_BOTTOM: + shaStepOverX = 0; + shaStepOverY = shaStride; + break; + case RIGHT_TO_LEFT: + shaStepOverX = -shaBpp; + shaStepOverY = 0; + break; + case BOTTOM_TO_TOP: + shaStepOverX = 0; + shaStepOverY = -shaStride; + break; + } + switch (y_dir) { + case TOP_TO_BOTTOM: + shaStepDownX = 0; + shaStepDownY = shaStride; + break; + case RIGHT_TO_LEFT: + shaStepDownX = -shaBpp; + shaStepDownY = 0; + break; + case BOTTOM_TO_TOP: + shaStepDownX = 0; + shaStepDownY = -shaStride; + break; + case LEFT_TO_RIGHT: + shaStepDownX = shaBpp; + shaStepDownY = 0; + break; + } + + while (nbox--) + { + box_x1 = pbox->x1; + box_y1 = pbox->y1; + box_x2 = pbox->x2; + box_y2 = pbox->y2; + pbox++; + + /* + * Compute screen and shadow locations for this box + */ + switch (x_dir) { + case LEFT_TO_RIGHT: + scr_x1 = box_x1 & pixelsMask; + scr_x2 = (box_x2 + pixelsPerBits - 1) & pixelsMask; + + sha_x1 = scr_x1; + break; + case TOP_TO_BOTTOM: + scr_x1 = box_y1 & pixelsMask; + scr_x2 = (box_y2 + pixelsPerBits - 1) & pixelsMask; + + sha_y1 = scr_x1; + break; + case RIGHT_TO_LEFT: + scr_x1 = (shaWidth - box_x2) & pixelsMask; + scr_x2 = (shaWidth - box_x1 + pixelsPerBits - 1) & pixelsMask; + + sha_x1 = (shaWidth - scr_x1 - 1); + break; + case BOTTOM_TO_TOP: + scr_x1 = (shaHeight - box_y2) & pixelsMask; + scr_x2 = (shaHeight - box_y1 + pixelsPerBits - 1) & pixelsMask; + + sha_y1 = (shaHeight - scr_x1 - 1); + break; + } + switch (y_dir) { + case TOP_TO_BOTTOM: + scr_y1 = box_y1; + scr_y2 = box_y2; + + sha_y1 = scr_y1; + break; + case RIGHT_TO_LEFT: + scr_y1 = (shaWidth - box_x2); + scr_y2 = (shaWidth - box_x1); + + sha_x1 = box_x2 - 1; + break; + case BOTTOM_TO_TOP: + scr_y1 = shaHeight - box_y2; + scr_y2 = shaHeight - box_y1; + + sha_y1 = box_y2 - 1; + break; + case LEFT_TO_RIGHT: + scr_y1 = box_x1; + scr_y2 = box_x2; + + sha_x1 = box_x1; + break; + } + scr_w = ((scr_x2 - scr_x1) * shaBpp) >> PC_SHIFT; + scr_h = scr_y2 - scr_y1; + scr_y = scr_y1; + + /* shift amount for first pixel on screen */ + shaFirstShift = PC_UNIT - ((sha_x1 * shaBpp) & PC_MASK) - shaBpp; + + /* pointer to shadow data first placed on screen */ + shaLine = (shaBits + + sha_y1 * shaStride + + ((sha_x1 * shaBpp) >> PC_SHIFT)); + + /* + * Copy the bits, always write across the physical frame buffer + * to take advantage of write combining. + */ + while (scr_h--) + { + int p; + PcBits bits; + PcBits *win; + int i; + CARD32 winSize; + + sha = shaLine; + shaShift = shaFirstShift; + w = scr_w; + scr_x = scr_x1 * shaBpp >> PC_SHIFT; + + while (w) + { + /* + * Map some of this line + */ + win = (PcBits *) (*pBuf->window) (pScreen, + scr_y, + scr_x << 1, + SHADOW_WINDOW_WRITE, + &winSize, + pBuf->closure); + i = (winSize >> 1); + if (i > w) + i = w; + w -= i; + scr_x += i; + /* + * Copy the portion of the line mapped + */ + while (i--) + { + bits = 0; + p = pixelsPerBits; + /* + * Build one word of output from multiple inputs + * + * Note that for 90/270 rotations, this will walk + * down the shadow hitting each scanline once. + * This is probably not very efficient. + */ + while (p--) + { + bits = PcScrLeft(bits, shaBpp); + bits |= PcScrRight (*sha, shaShift) & shaMask; + + shaShift -= shaStepOverX; + if (shaShift >= PC_UNIT) + { + shaShift -= PC_UNIT; + sha--; + } + else if (shaShift < 0) + { + shaShift += PC_UNIT; + sha++; + } + sha += shaStepOverY; + } + *win++ = bits; + } + } + scr_y++; + shaFirstShift -= shaStepDownX; + if (shaFirstShift >= PC_UNIT) + { + shaFirstShift -= PC_UNIT; + shaLine--; + } + else if (shaFirstShift < 0) + { + shaFirstShift += PC_UNIT; + shaLine++; + } + shaLine += shaStepDownY; + } + } +} --- xorg-server-1.4.2.orig/hw/kdrive/pcmcia/modes.h +++ xorg-server-1.4.2/hw/kdrive/pcmcia/modes.h @@ -0,0 +1,65 @@ +/* + * Copyright 2001 by Alan Hourihane, Sychdyn, North Wales, UK. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright 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, + */ + +#define V_NHSYNC 0x01 +#define V_NVSYNC 0x02 +#define V_PHSYNC 0x04 +#define V_PVSYNC 0x08 +#define V_INTERLACE 0x10 + +pcmciaDisplayModeRec pcmciaDefaultModes [] = { +/* 640x400 @ 70Hz (VGA) hsync: 37.9kHz */ + {640, 400, 70 ,31500, 640,672,736,832,0, 400,401,404,445,0, V_NHSYNC | V_PVSYNC}, +/* 640x480 @ 60Hz (Industry standard) hsync: 31.5kHz */ + {640, 480, 60 ,25200, 640,656,752,800,0, 480,490,492,525,0, V_NHSYNC | V_NVSYNC}, +/* 640x480 @ 72Hz (VESA) hsync: 37.9kHz */ + {640, 480, 72 ,31500, 640,664,704,832,0, 480,489,491,520,0, V_NHSYNC | V_NVSYNC}, +/* 640x480 @ 75Hz (VESA) hsync: 37.5kHz */ + {640, 480, 75 ,31500, 640,656,720,840,0, 480,481,484,500,0, V_NHSYNC | V_NVSYNC}, +/* 640x480 @ 85Hz (VESA) hsync: 43.3kHz */ + {640, 480, 85 ,36000, 640,696,752,832,0, 480,481,484,509,0, V_NHSYNC | V_NVSYNC}, +/* 800x600 @ 56Hz (VESA) hsync: 35.2kHz */ + {800, 600, 56 ,36000, 800,824,896,1024,0, 600,601,603,625,0, V_PHSYNC | V_PVSYNC}, +/* 800x600 @ 60Hz (VESA) hsync: 37.9kHz */ + {800, 600, 60 ,40000, 800,840,968,1056,0, 600,601,605,628,0, V_PHSYNC | V_PVSYNC}, +/* 800x600 @ 72Hz (VESA) hsync: 48.1kHz */ + {800, 600, 72 ,50000, 800,856,976,1040,0, 600,637,643,666,0, V_PHSYNC | V_PVSYNC}, +/* 800x600 @ 75Hz (VESA) hsync: 46.9kHz */ + {800, 600, 75 ,49500, 800,816,896,1056,0, 600,601,604,625,0, V_PHSYNC | V_PVSYNC}, +/* 800x600 @ 85Hz (VESA) hsync: 53.7kHz */ + {800, 600, 85 ,56300, 800,832,896,1048,0, 600,601,604,631,0, V_PHSYNC | V_PVSYNC}, +/* 1024x768i @ 43Hz (industry standard) hsync: 35.5kHz */ + {1024, 768, 43 ,44900, 1024,1032,1208,1264,0, 768,768,776,817,0, V_PHSYNC | V_PVSYNC | V_INTERLACE}, +/* 1024x768 @ 60Hz (VESA) hsync: 48.4kHz */ + {1024, 768, 60 ,65000, 1024,1048,1184,1344,0, 768,771,777,806,0, V_NHSYNC | V_NVSYNC}, +/* 1024x768 @ 70Hz (VESA) hsync: 56.5kHz */ + {1024, 768, 70 ,75000, 1024,1048,1184,1328,0, 768,771,777,806,0, V_NHSYNC | V_NVSYNC}, +/* 1024x768 @ 75Hz (VESA) hsync: 60.0kHz */ + {1024, 768, 75 ,78800, 1024,1040,1136,1312,0, 768,769,772,800,0, V_PHSYNC | V_PVSYNC}, +/* 1024x768 @ 85Hz (VESA) hsync: 68.7kHz */ + {1024, 768, 85 ,94500, 1024,1072,1168,1376,0, 768,769,772,808,0, V_PHSYNC | V_PVSYNC}, +/* 1152x864 @ 75Hz (VESA) hsync: 67.5kHz */ + {1152, 864, 75 ,108000, 1152,1216,1344,1600,0, 864,865,868,900,0, V_PHSYNC | V_PVSYNC}, + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} +}; --- xorg-server-1.4.2.orig/hw/kdrive/ts300/ts300.c +++ xorg-server-1.4.2/hw/kdrive/ts300/ts300.c @@ -0,0 +1,136 @@ +/* + * 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_CONFIG_H +#include +#endif +#include "kdrive.h" + +extern KdCardFuncs sisFuncs; +extern KdCardFuncs s3Funcs; + +/* + * Kludgy code to parse the ascii /proc/pci file as the TS300 + * is running a 2.0 kernel + */ +BOOL +HasPCI (char *name, KdCardAttr *attr) +{ + FILE *f; + char line[1024]; + BOOL waiting; + BOOL found = FALSE; + char *mem; + + f = fopen ("/proc/pci", "r"); + if (!f) + return FALSE; + waiting = FALSE; + attr->naddr = 0; + while (fgets (line, sizeof (line), f)) + { + if (waiting) + { + + if (mem = strstr (line, "memory at ")) + { + mem += strlen ("memory at "); + attr->address[attr->naddr++] = strtoul (mem, NULL, 0); + found = TRUE; + } + else if (mem = strstr (line, "I/O at ")) + { + mem += strlen ("I/O at "); + attr->io = strtoul (mem, NULL, 0); + found = TRUE; + } + else if (strstr (line, "Bus") && strstr (line, "device") && + strstr (line, "function")) + break; + } + else if (strstr (line, "VGA compatible controller")) + { + if (strstr (line, name)) + waiting = TRUE; + } + } + fclose (f); + return found; +} + +typedef struct _PCICard { + char *user; + char *name; + KdCardFuncs *funcs; +} PCICard; + +PCICard PCICards[] = { + "sis", "Silicon Integrated Systems", &sisFuncs, + "s3", "S3 Inc.", &s3Funcs, +}; + +#define NUM_PCI_CARDS (sizeof (PCICards) / sizeof (PCICards[0])) + +void +InitCard (char *name) +{ + KdCardInfo *card; + CARD32 fb; + int i; + KdCardAttr attr; + + for (i = 0; i < NUM_PCI_CARDS; i++) + { + if (!name || !strcmp (name, PCICards[i].user)) + { + if (HasPCI (PCICards[i].name, &attr)) + { + KdCardInfoAdd (PCICards[i].funcs, &attr, 0); + return; + } + } + } +} + +void +InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) +{ + KdInitOutput (pScreenInfo, argc, argv); +} + +void +InitInput (int argc, char **argv) +{ + KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs); +} + +void +ddxUseMsg (void) +{ + KdUseMsg(); +} + +int +ddxProcessArgument (int argc, char **argv, int i) +{ + return KdProcessArgument (argc, argv, i); +} --- xorg-server-1.4.2.orig/hw/kdrive/smi/smivideo.c +++ xorg-server-1.4.2/hw/kdrive/smi/smivideo.c @@ -0,0 +1,1015 @@ +/* + * Copyright © 2001 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_CONFIG_H +#include +#endif +#include "mach64.h" + +#include "Xv.h" +#include "../../xfree86/common/fourcc.h" + +#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) + +static Atom xvBrightness, xvSaturation, xvColorKey; + +#define IMAGE_MAX_WIDTH 720 +#define IMAGE_MAX_HEIGHT 576 + +static void +mach64StopVideo(KdScreenInfo *screen, pointer data, Bool exit) +{ + ScreenPtr pScreen = screen->pScreen; + KdScreenPriv(pScreen); + KdCardInfo *card = pScreenPriv->card; + Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; + Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver; + Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr; + Reg *reg = mach64c->reg; + MediaReg *media = mach64c->media_reg; + + REGION_EMPTY(screen->pScreen, &pPortPriv->clip); + + if (!media) + return; + + if(pPortPriv->videoOn) + { + mach64WaitIdle (reg); + /* wait for buffer to be displayed */ + while (((media->TRIG_CNTL >> 5) & 1) != pPortPriv->currentBuf) + ; + /* wait for buffer to be finished */ + while (((media->TRIG_CNTL >> 6) & 1) != 0) + ; + mach64WaitAvail (reg, 1); + media->OVERLAY_SCALE_CNTL = 0; + pPortPriv->videoOn = FALSE; + mach64WaitIdle (reg); + } +} + +static int +mach64SetPortAttribute(KdScreenInfo *screen, + Atom attribute, + int value, + pointer data) +{ + ScreenPtr pScreen = screen->pScreen; + KdScreenPriv(pScreen); + KdCardInfo *card = pScreenPriv->card; + Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; + Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver; + Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr; + MediaReg *media = mach64c->media_reg; + + if(attribute == xvBrightness) + { + if(value < -1000) + value = -1000; + if (value > 1000) + value = 1000; + pPortPriv->brightness = value; + } + else if(attribute == xvSaturation) + { + if (value < -1000) + value = -1000; + if (value > 1000) + value = 1000; + pPortPriv->saturation = value; + } + else if(attribute == xvColorKey) + { + if (pPortPriv->colorKey != value) + { + pPortPriv->colorKey = value; + REGION_EMPTY(screen->pScreen, &pPortPriv->clip); + } + } + else + return BadMatch; + + return Success; +} + +static int +mach64GetPortAttribute(KdScreenInfo *screen, + Atom attribute, + int *value, + pointer data) +{ + Mach64PortPrivPtr pPortPriv = (Mach64PortPrivPtr)data; + + if(attribute == xvBrightness) + *value = pPortPriv->brightness; + else if(attribute == xvSaturation) + *value = pPortPriv->saturation; + else if(attribute == xvColorKey) + *value = pPortPriv->colorKey; + else + return BadMatch; + + return Success; +} + +static void +mach64QueryBestSize(KdScreenInfo *screen, + Bool motion, + short vid_w, + short vid_h, + short drw_w, + short drw_h, + unsigned int *p_w, + unsigned int *p_h, + pointer data) +{ + *p_w = drw_w; + *p_h = drw_h; +} + + +static void +mach64CopyPackedData(KdScreenInfo *screen, + unsigned char *buf, + int randr, + int srcPitch, + int dstPitch, + int srcW, + int srcH, + int top, + int left, + int h, + int w) +{ + ScreenPtr pScreen = screen->pScreen; + KdScreenPriv(pScreen); + KdCardInfo *card = pScreenPriv->card; + Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; + Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver; + Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr; + CARD8 *src, *dst; + int srcDown, srcRight, srcNext; + int p; + + switch (randr & RR_Rotate_All) { + case RR_Rotate_0: + src = buf; + srcDown = srcPitch; + srcRight = 2; + break; + case RR_Rotate_90: + src = buf + (srcH - 1) * 2; + srcDown = -2; + srcRight = srcPitch; + break; + case RR_Rotate_180: + src = buf + srcPitch * (srcH - 1) + (srcW - 1) * 2; + srcDown = -srcPitch; + srcRight = -2; + break; + case RR_Rotate_270: + src = buf + srcPitch * (srcW - 1); + srcDown = 2; + srcRight = -srcPitch; + break; + } + + src = src + top*srcDown + left*srcRight; + + if (pPortPriv->currentBuf == 0) + dst = (CARD8 *) mach64s->vesa.fb + pPortPriv->YBuf0Offset; + else + dst = (CARD8 *) mach64s->vesa.fb + pPortPriv->YBuf1Offset; + + w >>= 1; + srcRight >>= 1; + srcNext = srcRight >> 1; + while(h--) + { + CARD16 *s = (CARD16 *) src; + CARD32 *d = (CARD32 *) dst; + p = w; + while (p--) + { + *d++ = s[0] | (s[srcNext] << 16); + s += srcRight; + } + src += srcPitch; + dst += dstPitch; + } +} + +static void +mach64CopyPlanarData(KdScreenInfo *screen, + unsigned char *buf, + int randr, + int srcPitch, + int srcPitch2, + int dstPitch, /* of chroma */ + int srcW, + int srcH, + int height, + int top, + int left, + int h, + int w, + int id) +{ + ScreenPtr pScreen = screen->pScreen; + KdScreenPriv(pScreen); + KdCardInfo *card = pScreenPriv->card; + Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; + Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver; + Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr; + int i, j; + CARD8 *src1, *src2, *src3, *dst1; + int srcDown, srcDown2, srcRight, srcRight2, srcNext; + + /* compute source data pointers */ + src1 = buf; + src2 = src1 + height * srcPitch; + src3 = src2 + (height >> 1) * srcPitch2; + switch (randr & RR_Rotate_All) { + case RR_Rotate_0: + srcDown = srcPitch; + srcDown2 = srcPitch2; + srcRight = 2; + srcRight2 = 1; + srcNext = 1; + break; + case RR_Rotate_90: + src1 = src1 + srcH - 1; + src2 = src2 + (srcH >> 1) - 1; + src3 = src3 + (srcH >> 1) - 1; + srcDown = -1; + srcDown2 = -1; + srcRight = srcPitch * 2; + srcRight2 = srcPitch2; + srcNext = srcPitch; + break; + case RR_Rotate_180: + src1 = src1 + srcPitch * (srcH - 1) + (srcW - 1); + src2 = src2 + srcPitch2 * ((srcH >> 1) - 1) + ((srcW >> 1) - 1); + src3 = src3 + srcPitch2 * ((srcH >> 1) - 1) + ((srcW >> 1) - 1); + srcDown = -srcPitch; + srcDown2 = -srcPitch2; + srcRight = -2; + srcRight2 = -1; + srcNext = -1; + break; + case RR_Rotate_270: + src1 = src1 + srcPitch * (srcW - 1); + src2 = src2 + srcPitch2 * ((srcW >> 1) - 1); + src3 = src3 + srcPitch2 * ((srcW >> 1) - 1); + srcDown = 1; + srcDown2 = 1; + srcRight = -srcPitch * 2; + srcRight2 = -srcPitch2; + srcNext = -srcPitch; + break; + } + + /* adjust for origin */ + src1 += top * srcDown + left * srcNext; + src2 += (top >> 1) * srcDown2 + (left >> 1) * srcRight2; + src3 += (top >> 1) * srcDown2 + (left >> 1) * srcRight2; + + if (id == FOURCC_I420) + { + CARD8 *srct = src2; + src2 = src3; + src3 = srct; + } + + if (pPortPriv->currentBuf == 0) + dst1 = (CARD8 *) mach64s->vesa.fb + pPortPriv->YBuf0Offset; + else + dst1 = (CARD8 *) mach64s->vesa.fb + pPortPriv->YBuf1Offset; + + w >>= 1; + for (j = 0; j < h; j++) + { + CARD32 *dst = (CARD32 *) dst1; + CARD8 *s1l = src1; + CARD8 *s1r = src1 + srcNext; + CARD8 *s2 = src2; + CARD8 *s3 = src3; + + for (i = 0; i < w; i++) + { + *dst++ = *s1l | (*s1r << 16) | (*s3 << 8) | (*s2 << 24); + s1l += srcRight; + s1r += srcRight; + s2 += srcRight2; + s3 += srcRight2; + } + src1 += srcDown; + dst1 += dstPitch; + if (j & 1) + { + src2 += srcDown2; + src3 += srcDown2; + } + } +} + +static void +mach64PaintRegion (ScreenPtr pScreen, RegionPtr pRgn, Pixel fg) +{ + WindowPtr pRoot = WindowTable[pScreen->myNum]; + GCPtr pGC; + CARD32 val[2]; + xRectangle *rects, *r; + BoxPtr pBox = REGION_RECTS (pRgn); + int nBox = REGION_NUM_RECTS (pRgn); + + rects = ALLOCATE_LOCAL (nBox * sizeof (xRectangle)); + if (!rects) + goto bail0; + r = rects; + while (nBox--) + { + r->x = pBox->x1; + r->y = pBox->y1; + r->width = pBox->x2 - pBox->x1; + r->height = pBox->y2 - pBox->y1; + r++; + pBox++; + } + + pGC = GetScratchGC (pRoot->drawable.depth, pScreen); + if (!pGC) + goto bail1; + + val[0] = fg; + val[1] = IncludeInferiors; + ChangeGC (pGC, GCForeground|GCSubwindowMode, val); + + ValidateGC (&pRoot->drawable, pGC); + + (*pGC->ops->PolyFillRect) (&pRoot->drawable, pGC, + REGION_NUM_RECTS (pRgn), rects); + + FreeScratchGC (pGC); +bail1: + DEALLOCATE_LOCAL (rects); +bail0: + ; +} + +/* Mach64ClipVideo - + + 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. +*/ + +static void +Mach64ClipVideo(BoxPtr dst, + INT32 *x1, + INT32 *x2, + INT32 *y1, + INT32 *y2, + BoxPtr extents, /* extents of the clip region */ + INT32 width, + INT32 height) +{ + INT32 vscale, hscale, delta; + int diff; + + hscale = ((*x2 - *x1) << 16) / (dst->x2 - dst->x1); + vscale = ((*y2 - *y1) << 16) / (dst->y2 - dst->y1); + + *x1 <<= 16; *x2 <<= 16; + *y1 <<= 16; *y2 <<= 16; + + diff = extents->x1 - dst->x1; + if(diff > 0) { + dst->x1 = extents->x1; + *x1 += diff * hscale; + } + diff = dst->x2 - extents->x2; + if(diff > 0) { + dst->x2 = extents->x2; + *x2 -= diff * hscale; + } + diff = extents->y1 - dst->y1; + if(diff > 0) { + dst->y1 = extents->y1; + *y1 += diff * vscale; + } + diff = dst->y2 - extents->y2; + if(diff > 0) { + dst->y2 = extents->y2; + *y2 -= diff * vscale; + } + + if(*x1 < 0) { + diff = (- *x1 + hscale - 1)/ hscale; + dst->x1 += diff; + *x1 += diff * hscale; + } + delta = *x2 - (width << 16); + if(delta > 0) { + diff = (delta + hscale - 1)/ hscale; + dst->x2 -= diff; + *x2 -= diff * hscale; + } + if(*y1 < 0) { + diff = (- *y1 + vscale - 1)/ vscale; + dst->y1 += diff; + *y1 += diff * vscale; + } + delta = *y2 - (height << 16); + if(delta > 0) { + diff = (delta + vscale - 1)/ vscale; + dst->y2 -= diff; + *y2 -= diff * vscale; + } +} + +static void +mach64DisplayVideo(KdScreenInfo *screen, + int id, + int dstPitch, /* of chroma for 4:2:0 */ + int x1, + int y1, + int x2, + int y2, + int dst_x1, + int dst_y1, + int dst_x2, + int dst_y2, + short src_w, + short src_h, + short drw_w, + short drw_h) +{ + ScreenPtr pScreen = screen->pScreen; + KdScreenPriv(pScreen); + KdCardInfo *card = pScreenPriv->card; + Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; + Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver; + Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr; + Reg *reg = mach64c->reg; + MediaReg *media = mach64c->media_reg; + int xscaleInt, xscaleFract, yscaleInt, yscaleFract; + int xscaleIntUV = 0, xscaleFractUV = 0; + int yscaleIntUV = 0, yscaleFractUV = 0; + int randr = mach64s->vesa.randr; + int HORZ_INC, VERT_INC; + CARD32 SCALER_IN; + CARD32 OVERLAY_SCALE_CNTL; + int tmp; + int left; + int bright; + int sat; + + if (id == FOURCC_UYVY) + SCALER_IN = SCALER_IN_YVYU422; + else + SCALER_IN = SCALER_IN_VYUY422; + + mach64WaitAvail (reg, 4); + + media->VIDEO_FORMAT = SCALER_IN | VIDEO_IN_VYUY422; + + /* color key */ + media->OVERLAY_GRAPHICS_KEY_MSK = (1 << screen->fb[0].depth) - 1; + media->OVERLAY_GRAPHICS_KEY_CLR = pPortPriv->colorKey; + /* set key control to obey only graphics color key */ + media->OVERLAY_KEY_CNTL = 0x50; + + mach64WaitAvail (reg, 9); + media->CAPTURE_DEBUG = 0; + /* no exclusive video region */ + media->OVERLAY_EXCLUSIVE_HORZ = 0; + media->OVERLAY_EXCLUSIVE_VERT = 0; + /* scaling coefficients */ + media->SCALER_H_COEFF0 = 0x00002000; + media->SCALER_H_COEFF1 = 0x0D06200D; + media->SCALER_H_COEFF2 = 0x0D0A1C0D; + media->SCALER_H_COEFF3 = 0x0C0E1A0C; + media->SCALER_H_COEFF4 = 0x0C14140C; + media->SCALER_TEST = 0; + + mach64WaitAvail (reg, 2); + media->OVERLAY_SCALE_CNTL = (SCALE_PIX_EXPAND | + SCALE_GAMMA_BRIGHT | + SCALE_BANDWIDTH | + SCALE_OVERLAY_EN | + SCALE_EN); + + bright = (pPortPriv->brightness * 64 / 1000); + if (bright < -0x40) + bright = -0x40; + if (bright > 0x3f) + bright = 0x3f; + bright = bright & 0x7f; + sat = ((pPortPriv->saturation * 31 + 31000) / 2000); + if (sat > 0x1f) + sat = 0x1f; + if (sat < 0) + sat = 0; + + media->SCALER_COLOUR_CNTL = ((bright << 0) | /* BRIGHTNESS */ + (sat << 8) | /* SATURATION_U */ + (sat << 16) | /* SATURATION_V */ + (0 << 21) | /* SCALER_VERT_ADJ_UV */ + (0 << 28)); /* SCALER_HORZ_ADJ_UV */ + + VERT_INC = (src_h << 12) / drw_h; + HORZ_INC = (src_w << 12) / drw_w; + + mach64WaitAvail (reg, 13); + + /* lock registers to prevent non-atomic update */ + media->OVERLAY_Y_X_START = 0x80000000 | MACH64_YX (dst_x1, dst_y1); + /* ending screen coordinate */ + media->OVERLAY_Y_X_END = 0x80000000 | MACH64_YX (dst_x2, dst_y2); + + media->OVERLAY_SCALE_INC = MACH64_YX(HORZ_INC, VERT_INC); + + media->SCALER_BUF0_OFFSET = pPortPriv->YBuf0Offset; + media->SCALER_BUF1_OFFSET = pPortPriv->YBuf1Offset; + + media->SCALER_BUF0_OFFSET_U = pPortPriv->YBuf0Offset; + media->SCALER_BUF1_OFFSET_U = pPortPriv->YBuf1Offset; + + media->SCALER_BUF0_OFFSET_V = pPortPriv->YBuf0Offset; + media->SCALER_BUF1_OFFSET_V = pPortPriv->YBuf1Offset; + + media->SCALER_BUF_PITCH = dstPitch >> 1; + media->SCALER_HEIGHT_WIDTH = MACH64_YX(src_w - (x1 >> 16), src_h - (y1 >> 16)); + + media->CAPTURE_CONFIG = pPortPriv->currentBuf << 28; + + /* set XY location and unlock */ + media->OVERLAY_Y_X_START = MACH64_YX (dst_x1, dst_y1); +} + +static int +mach64PutImage(KdScreenInfo *screen, + 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, + pointer data) +{ + KdCardInfo *card = screen->card; + Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; + Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver; + Mach64PortPrivPtr pPortPriv = (Mach64PortPrivPtr)data; + Reg *reg = mach64c->reg; + MediaReg *media = mach64c->media_reg; + INT32 x1, x2, y1, y2; + int randr = mach64s->vesa.randr; + int srcPitch, srcPitch2, dstPitch; + int top, left, npixels, nlines, size; + BoxRec dstBox; + int dst_width = width, dst_height = height; + int rot_x1, rot_y1, rot_x2, rot_y2; + int dst_x1, dst_y1, dst_x2, dst_y2; + int rot_src_w, rot_src_h, rot_drw_w, rot_drw_h; + + /* Clip */ + x1 = src_x; + x2 = src_x + src_w; + y1 = src_y; + y2 = src_y + src_h; + + dstBox.x1 = drw_x; + dstBox.x2 = drw_x + drw_w; + dstBox.y1 = drw_y; + dstBox.y2 = drw_y + drw_h; + + Mach64ClipVideo(&dstBox, &x1, &x2, &y1, &y2, + REGION_EXTENTS(pScreen, clipBoxes), width, height); + + if((x1 >= x2) || (y1 >= y2)) + return Success; + + if (!media) + return BadAlloc; + + if (randr & (RR_Rotate_0|RR_Rotate_180)) + { + dst_width = width; + dst_height = height; + rot_src_w = src_w; + rot_src_h = src_h; + rot_drw_w = drw_w; + rot_drw_h = drw_h; + } + else + { + dst_width = height; + dst_height = width; + rot_src_w = src_h; + rot_src_h = src_w; + rot_drw_w = drw_h; + rot_drw_h = drw_w; + } + + switch (randr & RR_Rotate_All) { + case RR_Rotate_0: + dst_x1 = dstBox.x1; + dst_y1 = dstBox.y1; + dst_x2 = dstBox.x2; + dst_y2 = dstBox.y2; + rot_x1 = x1; + rot_y1 = y1; + rot_x2 = x2; + rot_y2 = y2; + break; + case RR_Rotate_90: + dst_x1 = dstBox.y1; + dst_y1 = screen->height - dstBox.x2; + dst_x2 = dstBox.y2; + dst_y2 = screen->height - dstBox.x1; + + rot_x1 = y1; + rot_y1 = (src_w << 16) - x2; + rot_x2 = y2; + rot_y2 = (src_w << 16) - x1; + break; + case RR_Rotate_180: + dst_x1 = screen->width - dstBox.x2; + dst_y1 = screen->height - dstBox.y2; + dst_x2 = screen->width - dstBox.x1; + dst_y2 = screen->height - dstBox.y1; + rot_x1 = (src_w << 16) - x2; + rot_y1 = (src_h << 16) - y2; + rot_x2 = (src_w << 16) - x1; + rot_y2 = (src_h << 16) - y1; + break; + case RR_Rotate_270: + dst_x1 = screen->width - dstBox.y2; + dst_y1 = dstBox.x1; + dst_x2 = screen->width - dstBox.y1; + dst_y2 = dstBox.x2; + rot_x1 = (src_h << 16) - y2; + rot_y1 = x1; + rot_x2 = (src_h << 16) - y1; + rot_y2 = x2; + break; + } + + switch(id) { + case FOURCC_YV12: + case FOURCC_I420: + dstPitch = ((dst_width << 1) + 15) & ~15; + srcPitch = (width + 3) & ~3; + srcPitch2 = ((width >> 1) + 3) & ~3; + size = dstPitch * (int) dst_height; + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + dstPitch = ((dst_width << 1) + 15) & ~15; + srcPitch = (width << 1); + size = dstPitch * (int) dst_height; + break; + } + + pPortPriv->offset = mach64s->off_screen - (CARD8 *) mach64s->vesa.fb; + /* fixup pointers */ + + pPortPriv->YBuf0Offset = pPortPriv->offset; + pPortPriv->YBuf1Offset = pPortPriv->offset + size; + +#if 0 + mach64WaitIdle (reg); + + if (pPortPriv->videoOn) + { + /* wait for buffer to be displayed */ + while (((media->TRIG_CNTL >> 5) & 1) != pPortPriv->currentBuf) + ; + } +#endif + /* + * Use the other buffer + */ + pPortPriv->currentBuf = 1 - pPortPriv->currentBuf; + + /* copy data */ + top = rot_y1 >> 16; + left = (rot_x1 >> 16) & ~1; + npixels = ((((rot_x2 + 0xffff) >> 16) + 1) & ~1) - left; + + switch(id) { + case FOURCC_YV12: + case FOURCC_I420: + top &= ~1; + nlines = ((((rot_y2 + 0xffff) >> 16) + 1) & ~1) - top; + mach64CopyPlanarData(screen, buf, randr, + srcPitch, srcPitch2, dstPitch, + rot_src_w, rot_src_h, height, + top, left, nlines, npixels, id); + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + nlines = ((rot_y2 + 0xffff) >> 16) - top; + mach64CopyPackedData(screen, buf, randr, + srcPitch, dstPitch, + rot_src_w, rot_src_h, + top, left, nlines, + npixels); + break; + } + + mach64DisplayVideo(screen, id, dstPitch, + rot_x1, rot_y1, rot_x2, rot_y2, + dst_x1, dst_y1, + dst_x2, dst_y2, + rot_src_w, rot_src_h, rot_drw_w, rot_drw_h); + + /* update cliplist */ + if (!REGION_EQUAL (screen->pScreen, &pPortPriv->clip, clipBoxes)) + { + REGION_COPY (screen->pScreen, &pPortPriv->clip, clipBoxes); + mach64PaintRegion (screen->pScreen, &pPortPriv->clip, pPortPriv->colorKey); + } + + pPortPriv->videoOn = TRUE; + + return Success; +} + +static int +mach64QueryImageAttributes(KdScreenInfo *screen, + int id, + unsigned short *w, + unsigned short *h, + int *pitches, + int *offsets) +{ + int size, tmp; + + if(*w > IMAGE_MAX_WIDTH) + *w = IMAGE_MAX_WIDTH; + if(*h > IMAGE_MAX_HEIGHT) + *h = IMAGE_MAX_HEIGHT; + + *w = (*w + 1) & ~1; + if(offsets) offsets[0] = 0; + + switch(id) { + case FOURCC_YV12: + case FOURCC_I420: + *h = (*h + 1) & ~1; + size = (*w + 3) & ~3; + if(pitches) + pitches[0] = size; + size *= *h; + if(offsets) + offsets[1] = size; + tmp = ((*w >> 1) + 3) & ~3; + if(pitches) + pitches[1] = pitches[2] = tmp; + tmp *= (*h >> 1); + size += tmp; + if(offsets) + offsets[2] = size; + size += tmp; + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + size = *w << 1; + if(pitches) + pitches[0] = size; + size *= *h; + break; + } + + return size; +} + + +/* client libraries expect an encoding */ +static KdVideoEncodingRec DummyEncoding[1] = +{ + { + 0, + "XV_IMAGE", + IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT, + {1, 1} + } +}; + +#define NUM_FORMATS 3 + +static KdVideoFormatRec Formats[NUM_FORMATS] = +{ + {15, TrueColor}, {16, TrueColor}, {24, TrueColor} +}; + +#define NUM_ATTRIBUTES 3 + +static KdAttributeRec Attributes[NUM_ATTRIBUTES] = +{ + {XvSettable | XvGettable, 0, ~0, "XV_COLORKEY"}, + {XvSettable | XvGettable, -1000, 1000, "XV_BRIGHTNESS"}, + {XvSettable | XvGettable, -1000, 1000, "XV_SATURATION"} +}; + +#define NUM_IMAGES 4 + +static KdImageRec Images[NUM_IMAGES] = +{ + XVIMAGE_YUY2, + XVIMAGE_YV12, + XVIMAGE_I420, + XVIMAGE_UYVY +}; + +static void mach64ResetVideo(KdScreenInfo *screen) +{ + ScreenPtr pScreen = screen->pScreen; + KdScreenPriv(pScreen); + KdCardInfo *card = pScreenPriv->card; + Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; + Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver; + Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr; + MediaReg *media = mach64c->media_reg; + + /* + * Default to maximum image size in YV12 + */ + +} + +static int +mach64ReputImage (KdScreenInfo *screen, + short drw_x, + short drw_y, + RegionPtr clipBoxes, + pointer data) +{ + ScreenPtr pScreen = screen->pScreen; + Mach64PortPrivPtr pPortPriv = (Mach64PortPrivPtr)data; + BoxPtr pOldExtents = REGION_EXTENTS (pScreen, &pPortPriv->clip); + BoxPtr pNewExtents = REGION_EXTENTS (pScreen, clipBoxes); + + if (pOldExtents->x1 == pNewExtents->x1 && + pOldExtents->x2 == pNewExtents->x2 && + pOldExtents->y1 == pNewExtents->y1 && + pOldExtents->y2 == pNewExtents->y2) + { + /* update cliplist */ + if (!REGION_EQUAL (screen->pScreen, &pPortPriv->clip, clipBoxes)) + { + REGION_COPY (screen->pScreen, &pPortPriv->clip, clipBoxes); + mach64PaintRegion (screen->pScreen, &pPortPriv->clip, pPortPriv->colorKey); + } + return Success; + } + return BadMatch; +} + +static KdVideoAdaptorPtr +mach64SetupImageVideo(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + mach64CardInfo(pScreenPriv); + mach64ScreenInfo(pScreenPriv); + KdScreenInfo *screen = pScreenPriv->screen; + KdCardInfo *card = pScreenPriv->card; + KdVideoAdaptorPtr adapt; + Mach64PortPrivPtr pPortPriv; + + if(!(adapt = xcalloc(1, sizeof(KdVideoAdaptorRec) + + sizeof(Mach64PortPrivRec) + + sizeof(DevUnion)))) + return NULL; + + adapt->type = XvWindowMask | XvInputMask | XvImageMask; + adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; + adapt->name = "Mach64 Video Overlay"; + adapt->nEncodings = 1; + adapt->pEncodings = DummyEncoding; + adapt->nFormats = NUM_FORMATS; + adapt->pFormats = Formats; + adapt->nPorts = 1; + adapt->pPortPrivates = (DevUnion*)(&adapt[1]); + + pPortPriv = (Mach64PortPrivPtr)(&adapt->pPortPrivates[1]); + + adapt->pPortPrivates[0].ptr = (pointer)(pPortPriv); + adapt->pAttributes = Attributes; + adapt->nImages = NUM_IMAGES; + adapt->nAttributes = NUM_ATTRIBUTES; + adapt->pImages = Images; + adapt->PutVideo = NULL; + adapt->PutStill = NULL; + adapt->GetVideo = NULL; + adapt->GetStill = NULL; + adapt->StopVideo = mach64StopVideo; + adapt->SetPortAttribute = mach64SetPortAttribute; + adapt->GetPortAttribute = mach64GetPortAttribute; + adapt->QueryBestSize = mach64QueryBestSize; + adapt->PutImage = mach64PutImage; + adapt->ReputImage = mach64ReputImage; + adapt->QueryImageAttributes = mach64QueryImageAttributes; + + pPortPriv->colorKey = mach64s->colorKey; + pPortPriv->videoOn = FALSE; + pPortPriv->brightness = 0; + pPortPriv->saturation = 0; + pPortPriv->currentBuf = 0; + + /* gotta uninit this someplace */ + REGION_INIT(pScreen, &pPortPriv->clip, NullBox, 0); + + mach64s->pAdaptor = adapt; + + xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); + xvSaturation = MAKE_ATOM("XV_SATURATION"); + xvColorKey = MAKE_ATOM("XV_COLORKEY"); + + mach64ResetVideo(screen); + + return adapt; +} + +Bool mach64InitVideo(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + KdVideoAdaptorPtr *adaptors, *newAdaptors = NULL; + KdVideoAdaptorPtr newAdaptor = NULL; + int num_adaptors; + KdCardInfo *card = pScreenPriv->card; + Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; + Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver; + + if (!mach64c->media_reg) + return FALSE; + + newAdaptor = mach64SetupImageVideo(pScreen); + + num_adaptors = KdXVListGenericAdaptors(screen, &adaptors); + + if(newAdaptor) + { + if(!num_adaptors) + { + num_adaptors = 1; + adaptors = &newAdaptor; + } + else + { + newAdaptors = xalloc((num_adaptors + 1) * + sizeof(KdVideoAdaptorPtr*)); + if(newAdaptors) + { + memcpy(newAdaptors, adaptors, + num_adaptors * sizeof(KdVideoAdaptorPtr)); + newAdaptors[num_adaptors] = newAdaptor; + adaptors = newAdaptors; + num_adaptors++; + } + } + } + + if(num_adaptors) + KdXVScreenInit(pScreen, adaptors, num_adaptors); + + if(newAdaptors) + xfree(newAdaptors); + return TRUE; +} --- xorg-server-1.4.2.orig/hw/kdrive/smi/Makefile.in +++ xorg-server-1.4.2/hw/kdrive/smi/Makefile.in @@ -153,7 +153,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -287,10 +287,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/kdrive/ephyr/Makefile.in +++ xorg-server-1.4.2/hw/kdrive/ephyr/Makefile.in @@ -157,7 +157,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -291,10 +291,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/kdrive/fbdev/Xfbdev.man +++ xorg-server-1.4.2/hw/kdrive/fbdev/Xfbdev.man @@ -0,0 +1,28 @@ +.\" $RCSId: xc/programs/Xserver/hw/kdrive/fbdev/Xfbdev.man,v 1.4 2001/01/27 18:20:40 dawes Exp $ +.\" +.TH Xfbdev 1 __vendorversion__ +.SH NAME +Xfbdev \- Linux framebuffer device tiny X server +.SH SYNOPSIS +.B Xfbdev +.RI [ :display ] +.RI [ option ...] +.SH DESCRIPTION +.B Xfbdev +is a generic X server for Linux. +.B Xfbdev +doesn't know about any particular hardware, and uses the framebuffer +provided by the Linux framebuffer device. +.SH OPTIONS +.B Xfbdev +accepts the common options of the Xkdrive family of servers. Please +see Xkdrive(1). +.SH KEYBOARD +To be written. +.SH SEE ALSO +X(__miscmansuffix__), Xserver(1), Xkdrive(1), xdm(1), xinit(1). +.SH AUTHORS +The +.B Xfbdev +server was written by Keith Packard. + --- xorg-server-1.4.2.orig/hw/kdrive/fbdev/Makefile.in +++ xorg-server-1.4.2/hw/kdrive/fbdev/Makefile.in @@ -151,7 +151,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -285,10 +285,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/kdrive/r128/Makefile.in +++ xorg-server-1.4.2/hw/kdrive/r128/Makefile.in @@ -152,7 +152,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -286,10 +286,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/kdrive/src/kcolor.c +++ xorg-server-1.4.2/hw/kdrive/src/kcolor.c @@ -0,0 +1,881 @@ +/* + * 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_CONFIG_H +#include +#endif +#include "kdrive.h" +#include +#include "os.h" +#include "opaque.h" +#include + +unsigned char +KdToLower (unsigned char a) +{ + if ((a >= XK_A) && (a <= XK_Z)) + return a + (XK_a - XK_A); + else if ((a >= XK_Agrave) && (a <= XK_Odiaeresis)) + return a + (XK_agrave - XK_Agrave); + else if ((a >= XK_Ooblique) && (a <= XK_Thorn)) + return a + (XK_oslash - XK_Ooblique); + else + return a; +} + +int +KdStrCaseCmp (const unsigned char *s1, const unsigned char *s2, int l2) +{ + unsigned char c1, c2; + + for (;;) + { + c1 = KdToLower (*s1++); + if (l2 == 0) + c2 = '\0'; + else + c2 = KdToLower (*s2++); + if (!c1 || !c2) + break; + if (c1 != c2) + break; + l2--; + } + return c2 - c1; +} + +typedef struct _kdNamedColor { + unsigned short red; + unsigned short green; + unsigned short blue; + const unsigned char *name; +} KdNamedColor; + +#define C 0x101 + +const KdNamedColor KdColors[] = { + { 240*C, 248*C, 255*C, "alice blue" }, + { 240*C, 248*C, 255*C, "AliceBlue" }, + { 250*C, 235*C, 215*C, "antique white" }, + { 250*C, 235*C, 215*C, "AntiqueWhite" }, + { 255*C, 239*C, 219*C, "AntiqueWhite1" }, + { 238*C, 223*C, 204*C, "AntiqueWhite2" }, + { 205*C, 192*C, 176*C, "AntiqueWhite3" }, + { 139*C, 131*C, 120*C, "AntiqueWhite4" }, + { 127*C, 255*C, 212*C, "aquamarine" }, + { 127*C, 255*C, 212*C, "aquamarine1" }, + { 118*C, 238*C, 198*C, "aquamarine2" }, + { 102*C, 205*C, 170*C, "aquamarine3" }, + { 69*C, 139*C, 116*C, "aquamarine4" }, + { 240*C, 255*C, 255*C, "azure" }, + { 240*C, 255*C, 255*C, "azure1" }, + { 224*C, 238*C, 238*C, "azure2" }, + { 193*C, 205*C, 205*C, "azure3" }, + { 131*C, 139*C, 139*C, "azure4" }, + { 245*C, 245*C, 220*C, "beige" }, + { 255*C, 228*C, 196*C, "bisque" }, + { 255*C, 228*C, 196*C, "bisque1" }, + { 238*C, 213*C, 183*C, "bisque2" }, + { 205*C, 183*C, 158*C, "bisque3" }, + { 139*C, 125*C, 107*C, "bisque4" }, + { 0*C, 0*C, 0*C, "black" }, + { 255*C, 235*C, 205*C, "blanched almond" }, + { 255*C, 235*C, 205*C, "BlanchedAlmond" }, + { 0*C, 0*C, 255*C, "blue" }, + { 138*C, 43*C, 226*C, "blue violet" }, + { 0*C, 0*C, 255*C, "blue1" }, + { 0*C, 0*C, 238*C, "blue2" }, + { 0*C, 0*C, 205*C, "blue3" }, + { 0*C, 0*C, 139*C, "blue4" }, + { 138*C, 43*C, 226*C, "BlueViolet" }, + { 165*C, 42*C, 42*C, "brown" }, + { 255*C, 64*C, 64*C, "brown1" }, + { 238*C, 59*C, 59*C, "brown2" }, + { 205*C, 51*C, 51*C, "brown3" }, + { 139*C, 35*C, 35*C, "brown4" }, + { 222*C, 184*C, 135*C, "burlywood" }, + { 255*C, 211*C, 155*C, "burlywood1" }, + { 238*C, 197*C, 145*C, "burlywood2" }, + { 205*C, 170*C, 125*C, "burlywood3" }, + { 139*C, 115*C, 85*C, "burlywood4" }, + { 95*C, 158*C, 160*C, "cadet blue" }, + { 95*C, 158*C, 160*C, "CadetBlue" }, + { 152*C, 245*C, 255*C, "CadetBlue1" }, + { 142*C, 229*C, 238*C, "CadetBlue2" }, + { 122*C, 197*C, 205*C, "CadetBlue3" }, + { 83*C, 134*C, 139*C, "CadetBlue4" }, + { 127*C, 255*C, 0*C, "chartreuse" }, + { 127*C, 255*C, 0*C, "chartreuse1" }, + { 118*C, 238*C, 0*C, "chartreuse2" }, + { 102*C, 205*C, 0*C, "chartreuse3" }, + { 69*C, 139*C, 0*C, "chartreuse4" }, + { 210*C, 105*C, 30*C, "chocolate" }, + { 255*C, 127*C, 36*C, "chocolate1" }, + { 238*C, 118*C, 33*C, "chocolate2" }, + { 205*C, 102*C, 29*C, "chocolate3" }, + { 139*C, 69*C, 19*C, "chocolate4" }, + { 255*C, 127*C, 80*C, "coral" }, + { 255*C, 114*C, 86*C, "coral1" }, + { 238*C, 106*C, 80*C, "coral2" }, + { 205*C, 91*C, 69*C, "coral3" }, + { 139*C, 62*C, 47*C, "coral4" }, + { 100*C, 149*C, 237*C, "cornflower blue" }, + { 100*C, 149*C, 237*C, "CornflowerBlue" }, + { 255*C, 248*C, 220*C, "cornsilk" }, + { 255*C, 248*C, 220*C, "cornsilk1" }, + { 238*C, 232*C, 205*C, "cornsilk2" }, + { 205*C, 200*C, 177*C, "cornsilk3" }, + { 139*C, 136*C, 120*C, "cornsilk4" }, + { 0*C, 255*C, 255*C, "cyan" }, + { 0*C, 255*C, 255*C, "cyan1" }, + { 0*C, 238*C, 238*C, "cyan2" }, + { 0*C, 205*C, 205*C, "cyan3" }, + { 0*C, 139*C, 139*C, "cyan4" }, + { 0*C, 0*C, 139*C, "dark blue" }, + { 0*C, 139*C, 139*C, "dark cyan" }, + { 184*C, 134*C, 11*C, "dark goldenrod" }, + { 169*C, 169*C, 169*C, "dark gray" }, + { 0*C, 100*C, 0*C, "dark green" }, + { 169*C, 169*C, 169*C, "dark grey" }, + { 189*C, 183*C, 107*C, "dark khaki" }, + { 139*C, 0*C, 139*C, "dark magenta" }, + { 85*C, 107*C, 47*C, "dark olive green" }, + { 255*C, 140*C, 0*C, "dark orange" }, + { 153*C, 50*C, 204*C, "dark orchid" }, + { 139*C, 0*C, 0*C, "dark red" }, + { 233*C, 150*C, 122*C, "dark salmon" }, + { 143*C, 188*C, 143*C, "dark sea green" }, + { 72*C, 61*C, 139*C, "dark slate blue" }, + { 47*C, 79*C, 79*C, "dark slate gray" }, + { 47*C, 79*C, 79*C, "dark slate grey" }, + { 0*C, 206*C, 209*C, "dark turquoise" }, + { 148*C, 0*C, 211*C, "dark violet" }, + { 0*C, 0*C, 139*C, "DarkBlue" }, + { 0*C, 139*C, 139*C, "DarkCyan" }, + { 184*C, 134*C, 11*C, "DarkGoldenrod" }, + { 255*C, 185*C, 15*C, "DarkGoldenrod1" }, + { 238*C, 173*C, 14*C, "DarkGoldenrod2" }, + { 205*C, 149*C, 12*C, "DarkGoldenrod3" }, + { 139*C, 101*C, 8*C, "DarkGoldenrod4" }, + { 169*C, 169*C, 169*C, "DarkGray" }, + { 0*C, 100*C, 0*C, "DarkGreen" }, + { 169*C, 169*C, 169*C, "DarkGrey" }, + { 189*C, 183*C, 107*C, "DarkKhaki" }, + { 139*C, 0*C, 139*C, "DarkMagenta" }, + { 85*C, 107*C, 47*C, "DarkOliveGreen" }, + { 202*C, 255*C, 112*C, "DarkOliveGreen1" }, + { 188*C, 238*C, 104*C, "DarkOliveGreen2" }, + { 162*C, 205*C, 90*C, "DarkOliveGreen3" }, + { 110*C, 139*C, 61*C, "DarkOliveGreen4" }, + { 255*C, 140*C, 0*C, "DarkOrange" }, + { 255*C, 127*C, 0*C, "DarkOrange1" }, + { 238*C, 118*C, 0*C, "DarkOrange2" }, + { 205*C, 102*C, 0*C, "DarkOrange3" }, + { 139*C, 69*C, 0*C, "DarkOrange4" }, + { 153*C, 50*C, 204*C, "DarkOrchid" }, + { 191*C, 62*C, 255*C, "DarkOrchid1" }, + { 178*C, 58*C, 238*C, "DarkOrchid2" }, + { 154*C, 50*C, 205*C, "DarkOrchid3" }, + { 104*C, 34*C, 139*C, "DarkOrchid4" }, + { 139*C, 0*C, 0*C, "DarkRed" }, + { 233*C, 150*C, 122*C, "DarkSalmon" }, + { 143*C, 188*C, 143*C, "DarkSeaGreen" }, + { 193*C, 255*C, 193*C, "DarkSeaGreen1" }, + { 180*C, 238*C, 180*C, "DarkSeaGreen2" }, + { 155*C, 205*C, 155*C, "DarkSeaGreen3" }, + { 105*C, 139*C, 105*C, "DarkSeaGreen4" }, + { 72*C, 61*C, 139*C, "DarkSlateBlue" }, + { 47*C, 79*C, 79*C, "DarkSlateGray" }, + { 151*C, 255*C, 255*C, "DarkSlateGray1" }, + { 141*C, 238*C, 238*C, "DarkSlateGray2" }, + { 121*C, 205*C, 205*C, "DarkSlateGray3" }, + { 82*C, 139*C, 139*C, "DarkSlateGray4" }, + { 47*C, 79*C, 79*C, "DarkSlateGrey" }, + { 0*C, 206*C, 209*C, "DarkTurquoise" }, + { 148*C, 0*C, 211*C, "DarkViolet" }, + { 255*C, 20*C, 147*C, "deep pink" }, + { 0*C, 191*C, 255*C, "deep sky blue" }, + { 255*C, 20*C, 147*C, "DeepPink" }, + { 255*C, 20*C, 147*C, "DeepPink1" }, + { 238*C, 18*C, 137*C, "DeepPink2" }, + { 205*C, 16*C, 118*C, "DeepPink3" }, + { 139*C, 10*C, 80*C, "DeepPink4" }, + { 0*C, 191*C, 255*C, "DeepSkyBlue" }, + { 0*C, 191*C, 255*C, "DeepSkyBlue1" }, + { 0*C, 178*C, 238*C, "DeepSkyBlue2" }, + { 0*C, 154*C, 205*C, "DeepSkyBlue3" }, + { 0*C, 104*C, 139*C, "DeepSkyBlue4" }, + { 105*C, 105*C, 105*C, "dim gray" }, + { 105*C, 105*C, 105*C, "dim grey" }, + { 105*C, 105*C, 105*C, "DimGray" }, + { 105*C, 105*C, 105*C, "DimGrey" }, + { 30*C, 144*C, 255*C, "dodger blue" }, + { 30*C, 144*C, 255*C, "DodgerBlue" }, + { 30*C, 144*C, 255*C, "DodgerBlue1" }, + { 28*C, 134*C, 238*C, "DodgerBlue2" }, + { 24*C, 116*C, 205*C, "DodgerBlue3" }, + { 16*C, 78*C, 139*C, "DodgerBlue4" }, + { 178*C, 34*C, 34*C, "firebrick" }, + { 255*C, 48*C, 48*C, "firebrick1" }, + { 238*C, 44*C, 44*C, "firebrick2" }, + { 205*C, 38*C, 38*C, "firebrick3" }, + { 139*C, 26*C, 26*C, "firebrick4" }, + { 255*C, 250*C, 240*C, "floral white" }, + { 255*C, 250*C, 240*C, "FloralWhite" }, + { 34*C, 139*C, 34*C, "forest green" }, + { 34*C, 139*C, 34*C, "ForestGreen" }, + { 220*C, 220*C, 220*C, "gainsboro" }, + { 248*C, 248*C, 255*C, "ghost white" }, + { 248*C, 248*C, 255*C, "GhostWhite" }, + { 255*C, 215*C, 0*C, "gold" }, + { 255*C, 215*C, 0*C, "gold1" }, + { 238*C, 201*C, 0*C, "gold2" }, + { 205*C, 173*C, 0*C, "gold3" }, + { 139*C, 117*C, 0*C, "gold4" }, + { 218*C, 165*C, 32*C, "goldenrod" }, + { 255*C, 193*C, 37*C, "goldenrod1" }, + { 238*C, 180*C, 34*C, "goldenrod2" }, + { 205*C, 155*C, 29*C, "goldenrod3" }, + { 139*C, 105*C, 20*C, "goldenrod4" }, + { 190*C, 190*C, 190*C, "gray" }, + { 0*C, 0*C, 0*C, "gray0" }, + { 3*C, 3*C, 3*C, "gray1" }, + { 26*C, 26*C, 26*C, "gray10" }, + { 255*C, 255*C, 255*C, "gray100" }, + { 28*C, 28*C, 28*C, "gray11" }, + { 31*C, 31*C, 31*C, "gray12" }, + { 33*C, 33*C, 33*C, "gray13" }, + { 36*C, 36*C, 36*C, "gray14" }, + { 38*C, 38*C, 38*C, "gray15" }, + { 41*C, 41*C, 41*C, "gray16" }, + { 43*C, 43*C, 43*C, "gray17" }, + { 46*C, 46*C, 46*C, "gray18" }, + { 48*C, 48*C, 48*C, "gray19" }, + { 5*C, 5*C, 5*C, "gray2" }, + { 51*C, 51*C, 51*C, "gray20" }, + { 54*C, 54*C, 54*C, "gray21" }, + { 56*C, 56*C, 56*C, "gray22" }, + { 59*C, 59*C, 59*C, "gray23" }, + { 61*C, 61*C, 61*C, "gray24" }, + { 64*C, 64*C, 64*C, "gray25" }, + { 66*C, 66*C, 66*C, "gray26" }, + { 69*C, 69*C, 69*C, "gray27" }, + { 71*C, 71*C, 71*C, "gray28" }, + { 74*C, 74*C, 74*C, "gray29" }, + { 8*C, 8*C, 8*C, "gray3" }, + { 77*C, 77*C, 77*C, "gray30" }, + { 79*C, 79*C, 79*C, "gray31" }, + { 82*C, 82*C, 82*C, "gray32" }, + { 84*C, 84*C, 84*C, "gray33" }, + { 87*C, 87*C, 87*C, "gray34" }, + { 89*C, 89*C, 89*C, "gray35" }, + { 92*C, 92*C, 92*C, "gray36" }, + { 94*C, 94*C, 94*C, "gray37" }, + { 97*C, 97*C, 97*C, "gray38" }, + { 99*C, 99*C, 99*C, "gray39" }, + { 10*C, 10*C, 10*C, "gray4" }, + { 102*C, 102*C, 102*C, "gray40" }, + { 105*C, 105*C, 105*C, "gray41" }, + { 107*C, 107*C, 107*C, "gray42" }, + { 110*C, 110*C, 110*C, "gray43" }, + { 112*C, 112*C, 112*C, "gray44" }, + { 115*C, 115*C, 115*C, "gray45" }, + { 117*C, 117*C, 117*C, "gray46" }, + { 120*C, 120*C, 120*C, "gray47" }, + { 122*C, 122*C, 122*C, "gray48" }, + { 125*C, 125*C, 125*C, "gray49" }, + { 13*C, 13*C, 13*C, "gray5" }, + { 127*C, 127*C, 127*C, "gray50" }, + { 130*C, 130*C, 130*C, "gray51" }, + { 133*C, 133*C, 133*C, "gray52" }, + { 135*C, 135*C, 135*C, "gray53" }, + { 138*C, 138*C, 138*C, "gray54" }, + { 140*C, 140*C, 140*C, "gray55" }, + { 143*C, 143*C, 143*C, "gray56" }, + { 145*C, 145*C, 145*C, "gray57" }, + { 148*C, 148*C, 148*C, "gray58" }, + { 150*C, 150*C, 150*C, "gray59" }, + { 15*C, 15*C, 15*C, "gray6" }, + { 153*C, 153*C, 153*C, "gray60" }, + { 156*C, 156*C, 156*C, "gray61" }, + { 158*C, 158*C, 158*C, "gray62" }, + { 161*C, 161*C, 161*C, "gray63" }, + { 163*C, 163*C, 163*C, "gray64" }, + { 166*C, 166*C, 166*C, "gray65" }, + { 168*C, 168*C, 168*C, "gray66" }, + { 171*C, 171*C, 171*C, "gray67" }, + { 173*C, 173*C, 173*C, "gray68" }, + { 176*C, 176*C, 176*C, "gray69" }, + { 18*C, 18*C, 18*C, "gray7" }, + { 179*C, 179*C, 179*C, "gray70" }, + { 181*C, 181*C, 181*C, "gray71" }, + { 184*C, 184*C, 184*C, "gray72" }, + { 186*C, 186*C, 186*C, "gray73" }, + { 189*C, 189*C, 189*C, "gray74" }, + { 191*C, 191*C, 191*C, "gray75" }, + { 194*C, 194*C, 194*C, "gray76" }, + { 196*C, 196*C, 196*C, "gray77" }, + { 199*C, 199*C, 199*C, "gray78" }, + { 201*C, 201*C, 201*C, "gray79" }, + { 20*C, 20*C, 20*C, "gray8" }, + { 204*C, 204*C, 204*C, "gray80" }, + { 207*C, 207*C, 207*C, "gray81" }, + { 209*C, 209*C, 209*C, "gray82" }, + { 212*C, 212*C, 212*C, "gray83" }, + { 214*C, 214*C, 214*C, "gray84" }, + { 217*C, 217*C, 217*C, "gray85" }, + { 219*C, 219*C, 219*C, "gray86" }, + { 222*C, 222*C, 222*C, "gray87" }, + { 224*C, 224*C, 224*C, "gray88" }, + { 227*C, 227*C, 227*C, "gray89" }, + { 23*C, 23*C, 23*C, "gray9" }, + { 229*C, 229*C, 229*C, "gray90" }, + { 232*C, 232*C, 232*C, "gray91" }, + { 235*C, 235*C, 235*C, "gray92" }, + { 237*C, 237*C, 237*C, "gray93" }, + { 240*C, 240*C, 240*C, "gray94" }, + { 242*C, 242*C, 242*C, "gray95" }, + { 245*C, 245*C, 245*C, "gray96" }, + { 247*C, 247*C, 247*C, "gray97" }, + { 250*C, 250*C, 250*C, "gray98" }, + { 252*C, 252*C, 252*C, "gray99" }, + { 0*C, 255*C, 0*C, "green" }, + { 173*C, 255*C, 47*C, "green yellow" }, + { 0*C, 255*C, 0*C, "green1" }, + { 0*C, 238*C, 0*C, "green2" }, + { 0*C, 205*C, 0*C, "green3" }, + { 0*C, 139*C, 0*C, "green4" }, + { 173*C, 255*C, 47*C, "GreenYellow" }, + { 190*C, 190*C, 190*C, "grey" }, + { 0*C, 0*C, 0*C, "grey0" }, + { 3*C, 3*C, 3*C, "grey1" }, + { 26*C, 26*C, 26*C, "grey10" }, + { 255*C, 255*C, 255*C, "grey100" }, + { 28*C, 28*C, 28*C, "grey11" }, + { 31*C, 31*C, 31*C, "grey12" }, + { 33*C, 33*C, 33*C, "grey13" }, + { 36*C, 36*C, 36*C, "grey14" }, + { 38*C, 38*C, 38*C, "grey15" }, + { 41*C, 41*C, 41*C, "grey16" }, + { 43*C, 43*C, 43*C, "grey17" }, + { 46*C, 46*C, 46*C, "grey18" }, + { 48*C, 48*C, 48*C, "grey19" }, + { 5*C, 5*C, 5*C, "grey2" }, + { 51*C, 51*C, 51*C, "grey20" }, + { 54*C, 54*C, 54*C, "grey21" }, + { 56*C, 56*C, 56*C, "grey22" }, + { 59*C, 59*C, 59*C, "grey23" }, + { 61*C, 61*C, 61*C, "grey24" }, + { 64*C, 64*C, 64*C, "grey25" }, + { 66*C, 66*C, 66*C, "grey26" }, + { 69*C, 69*C, 69*C, "grey27" }, + { 71*C, 71*C, 71*C, "grey28" }, + { 74*C, 74*C, 74*C, "grey29" }, + { 8*C, 8*C, 8*C, "grey3" }, + { 77*C, 77*C, 77*C, "grey30" }, + { 79*C, 79*C, 79*C, "grey31" }, + { 82*C, 82*C, 82*C, "grey32" }, + { 84*C, 84*C, 84*C, "grey33" }, + { 87*C, 87*C, 87*C, "grey34" }, + { 89*C, 89*C, 89*C, "grey35" }, + { 92*C, 92*C, 92*C, "grey36" }, + { 94*C, 94*C, 94*C, "grey37" }, + { 97*C, 97*C, 97*C, "grey38" }, + { 99*C, 99*C, 99*C, "grey39" }, + { 10*C, 10*C, 10*C, "grey4" }, + { 102*C, 102*C, 102*C, "grey40" }, + { 105*C, 105*C, 105*C, "grey41" }, + { 107*C, 107*C, 107*C, "grey42" }, + { 110*C, 110*C, 110*C, "grey43" }, + { 112*C, 112*C, 112*C, "grey44" }, + { 115*C, 115*C, 115*C, "grey45" }, + { 117*C, 117*C, 117*C, "grey46" }, + { 120*C, 120*C, 120*C, "grey47" }, + { 122*C, 122*C, 122*C, "grey48" }, + { 125*C, 125*C, 125*C, "grey49" }, + { 13*C, 13*C, 13*C, "grey5" }, + { 127*C, 127*C, 127*C, "grey50" }, + { 130*C, 130*C, 130*C, "grey51" }, + { 133*C, 133*C, 133*C, "grey52" }, + { 135*C, 135*C, 135*C, "grey53" }, + { 138*C, 138*C, 138*C, "grey54" }, + { 140*C, 140*C, 140*C, "grey55" }, + { 143*C, 143*C, 143*C, "grey56" }, + { 145*C, 145*C, 145*C, "grey57" }, + { 148*C, 148*C, 148*C, "grey58" }, + { 150*C, 150*C, 150*C, "grey59" }, + { 15*C, 15*C, 15*C, "grey6" }, + { 153*C, 153*C, 153*C, "grey60" }, + { 156*C, 156*C, 156*C, "grey61" }, + { 158*C, 158*C, 158*C, "grey62" }, + { 161*C, 161*C, 161*C, "grey63" }, + { 163*C, 163*C, 163*C, "grey64" }, + { 166*C, 166*C, 166*C, "grey65" }, + { 168*C, 168*C, 168*C, "grey66" }, + { 171*C, 171*C, 171*C, "grey67" }, + { 173*C, 173*C, 173*C, "grey68" }, + { 176*C, 176*C, 176*C, "grey69" }, + { 18*C, 18*C, 18*C, "grey7" }, + { 179*C, 179*C, 179*C, "grey70" }, + { 181*C, 181*C, 181*C, "grey71" }, + { 184*C, 184*C, 184*C, "grey72" }, + { 186*C, 186*C, 186*C, "grey73" }, + { 189*C, 189*C, 189*C, "grey74" }, + { 191*C, 191*C, 191*C, "grey75" }, + { 194*C, 194*C, 194*C, "grey76" }, + { 196*C, 196*C, 196*C, "grey77" }, + { 199*C, 199*C, 199*C, "grey78" }, + { 201*C, 201*C, 201*C, "grey79" }, + { 20*C, 20*C, 20*C, "grey8" }, + { 204*C, 204*C, 204*C, "grey80" }, + { 207*C, 207*C, 207*C, "grey81" }, + { 209*C, 209*C, 209*C, "grey82" }, + { 212*C, 212*C, 212*C, "grey83" }, + { 214*C, 214*C, 214*C, "grey84" }, + { 217*C, 217*C, 217*C, "grey85" }, + { 219*C, 219*C, 219*C, "grey86" }, + { 222*C, 222*C, 222*C, "grey87" }, + { 224*C, 224*C, 224*C, "grey88" }, + { 227*C, 227*C, 227*C, "grey89" }, + { 23*C, 23*C, 23*C, "grey9" }, + { 229*C, 229*C, 229*C, "grey90" }, + { 232*C, 232*C, 232*C, "grey91" }, + { 235*C, 235*C, 235*C, "grey92" }, + { 237*C, 237*C, 237*C, "grey93" }, + { 240*C, 240*C, 240*C, "grey94" }, + { 242*C, 242*C, 242*C, "grey95" }, + { 245*C, 245*C, 245*C, "grey96" }, + { 247*C, 247*C, 247*C, "grey97" }, + { 250*C, 250*C, 250*C, "grey98" }, + { 252*C, 252*C, 252*C, "grey99" }, + { 240*C, 255*C, 240*C, "honeydew" }, + { 240*C, 255*C, 240*C, "honeydew1" }, + { 224*C, 238*C, 224*C, "honeydew2" }, + { 193*C, 205*C, 193*C, "honeydew3" }, + { 131*C, 139*C, 131*C, "honeydew4" }, + { 255*C, 105*C, 180*C, "hot pink" }, + { 255*C, 105*C, 180*C, "HotPink" }, + { 255*C, 110*C, 180*C, "HotPink1" }, + { 238*C, 106*C, 167*C, "HotPink2" }, + { 205*C, 96*C, 144*C, "HotPink3" }, + { 139*C, 58*C, 98*C, "HotPink4" }, + { 205*C, 92*C, 92*C, "indian red" }, + { 205*C, 92*C, 92*C, "IndianRed" }, + { 255*C, 106*C, 106*C, "IndianRed1" }, + { 238*C, 99*C, 99*C, "IndianRed2" }, + { 205*C, 85*C, 85*C, "IndianRed3" }, + { 139*C, 58*C, 58*C, "IndianRed4" }, + { 255*C, 255*C, 240*C, "ivory" }, + { 255*C, 255*C, 240*C, "ivory1" }, + { 238*C, 238*C, 224*C, "ivory2" }, + { 205*C, 205*C, 193*C, "ivory3" }, + { 139*C, 139*C, 131*C, "ivory4" }, + { 240*C, 230*C, 140*C, "khaki" }, + { 255*C, 246*C, 143*C, "khaki1" }, + { 238*C, 230*C, 133*C, "khaki2" }, + { 205*C, 198*C, 115*C, "khaki3" }, + { 139*C, 134*C, 78*C, "khaki4" }, + { 230*C, 230*C, 250*C, "lavender" }, + { 255*C, 240*C, 245*C, "lavender blush" }, + { 255*C, 240*C, 245*C, "LavenderBlush" }, + { 255*C, 240*C, 245*C, "LavenderBlush1" }, + { 238*C, 224*C, 229*C, "LavenderBlush2" }, + { 205*C, 193*C, 197*C, "LavenderBlush3" }, + { 139*C, 131*C, 134*C, "LavenderBlush4" }, + { 124*C, 252*C, 0*C, "lawn green" }, + { 124*C, 252*C, 0*C, "LawnGreen" }, + { 255*C, 250*C, 205*C, "lemon chiffon" }, + { 255*C, 250*C, 205*C, "LemonChiffon" }, + { 255*C, 250*C, 205*C, "LemonChiffon1" }, + { 238*C, 233*C, 191*C, "LemonChiffon2" }, + { 205*C, 201*C, 165*C, "LemonChiffon3" }, + { 139*C, 137*C, 112*C, "LemonChiffon4" }, + { 173*C, 216*C, 230*C, "light blue" }, + { 240*C, 128*C, 128*C, "light coral" }, + { 224*C, 255*C, 255*C, "light cyan" }, + { 238*C, 221*C, 130*C, "light goldenrod" }, + { 250*C, 250*C, 210*C, "light goldenrod yellow" }, + { 211*C, 211*C, 211*C, "light gray" }, + { 144*C, 238*C, 144*C, "light green" }, + { 211*C, 211*C, 211*C, "light grey" }, + { 255*C, 182*C, 193*C, "light pink" }, + { 255*C, 160*C, 122*C, "light salmon" }, + { 32*C, 178*C, 170*C, "light sea green" }, + { 135*C, 206*C, 250*C, "light sky blue" }, + { 132*C, 112*C, 255*C, "light slate blue" }, + { 119*C, 136*C, 153*C, "light slate gray" }, + { 119*C, 136*C, 153*C, "light slate grey" }, + { 176*C, 196*C, 222*C, "light steel blue" }, + { 255*C, 255*C, 224*C, "light yellow" }, + { 173*C, 216*C, 230*C, "LightBlue" }, + { 191*C, 239*C, 255*C, "LightBlue1" }, + { 178*C, 223*C, 238*C, "LightBlue2" }, + { 154*C, 192*C, 205*C, "LightBlue3" }, + { 104*C, 131*C, 139*C, "LightBlue4" }, + { 240*C, 128*C, 128*C, "LightCoral" }, + { 224*C, 255*C, 255*C, "LightCyan" }, + { 224*C, 255*C, 255*C, "LightCyan1" }, + { 209*C, 238*C, 238*C, "LightCyan2" }, + { 180*C, 205*C, 205*C, "LightCyan3" }, + { 122*C, 139*C, 139*C, "LightCyan4" }, + { 238*C, 221*C, 130*C, "LightGoldenrod" }, + { 255*C, 236*C, 139*C, "LightGoldenrod1" }, + { 238*C, 220*C, 130*C, "LightGoldenrod2" }, + { 205*C, 190*C, 112*C, "LightGoldenrod3" }, + { 139*C, 129*C, 76*C, "LightGoldenrod4" }, + { 250*C, 250*C, 210*C, "LightGoldenrodYellow" }, + { 211*C, 211*C, 211*C, "LightGray" }, + { 144*C, 238*C, 144*C, "LightGreen" }, + { 211*C, 211*C, 211*C, "LightGrey" }, + { 255*C, 182*C, 193*C, "LightPink" }, + { 255*C, 174*C, 185*C, "LightPink1" }, + { 238*C, 162*C, 173*C, "LightPink2" }, + { 205*C, 140*C, 149*C, "LightPink3" }, + { 139*C, 95*C, 101*C, "LightPink4" }, + { 255*C, 160*C, 122*C, "LightSalmon" }, + { 255*C, 160*C, 122*C, "LightSalmon1" }, + { 238*C, 149*C, 114*C, "LightSalmon2" }, + { 205*C, 129*C, 98*C, "LightSalmon3" }, + { 139*C, 87*C, 66*C, "LightSalmon4" }, + { 32*C, 178*C, 170*C, "LightSeaGreen" }, + { 135*C, 206*C, 250*C, "LightSkyBlue" }, + { 176*C, 226*C, 255*C, "LightSkyBlue1" }, + { 164*C, 211*C, 238*C, "LightSkyBlue2" }, + { 141*C, 182*C, 205*C, "LightSkyBlue3" }, + { 96*C, 123*C, 139*C, "LightSkyBlue4" }, + { 132*C, 112*C, 255*C, "LightSlateBlue" }, + { 119*C, 136*C, 153*C, "LightSlateGray" }, + { 119*C, 136*C, 153*C, "LightSlateGrey" }, + { 176*C, 196*C, 222*C, "LightSteelBlue" }, + { 202*C, 225*C, 255*C, "LightSteelBlue1" }, + { 188*C, 210*C, 238*C, "LightSteelBlue2" }, + { 162*C, 181*C, 205*C, "LightSteelBlue3" }, + { 110*C, 123*C, 139*C, "LightSteelBlue4" }, + { 255*C, 255*C, 224*C, "LightYellow" }, + { 255*C, 255*C, 224*C, "LightYellow1" }, + { 238*C, 238*C, 209*C, "LightYellow2" }, + { 205*C, 205*C, 180*C, "LightYellow3" }, + { 139*C, 139*C, 122*C, "LightYellow4" }, + { 50*C, 205*C, 50*C, "lime green" }, + { 50*C, 205*C, 50*C, "LimeGreen" }, + { 250*C, 240*C, 230*C, "linen" }, + { 255*C, 0*C, 255*C, "magenta" }, + { 255*C, 0*C, 255*C, "magenta1" }, + { 238*C, 0*C, 238*C, "magenta2" }, + { 205*C, 0*C, 205*C, "magenta3" }, + { 139*C, 0*C, 139*C, "magenta4" }, + { 176*C, 48*C, 96*C, "maroon" }, + { 255*C, 52*C, 179*C, "maroon1" }, + { 238*C, 48*C, 167*C, "maroon2" }, + { 205*C, 41*C, 144*C, "maroon3" }, + { 139*C, 28*C, 98*C, "maroon4" }, + { 102*C, 205*C, 170*C, "medium aquamarine" }, + { 0*C, 0*C, 205*C, "medium blue" }, + { 186*C, 85*C, 211*C, "medium orchid" }, + { 147*C, 112*C, 219*C, "medium purple" }, + { 60*C, 179*C, 113*C, "medium sea green" }, + { 123*C, 104*C, 238*C, "medium slate blue" }, + { 0*C, 250*C, 154*C, "medium spring green" }, + { 72*C, 209*C, 204*C, "medium turquoise" }, + { 199*C, 21*C, 133*C, "medium violet red" }, + { 102*C, 205*C, 170*C, "MediumAquamarine" }, + { 0*C, 0*C, 205*C, "MediumBlue" }, + { 186*C, 85*C, 211*C, "MediumOrchid" }, + { 224*C, 102*C, 255*C, "MediumOrchid1" }, + { 209*C, 95*C, 238*C, "MediumOrchid2" }, + { 180*C, 82*C, 205*C, "MediumOrchid3" }, + { 122*C, 55*C, 139*C, "MediumOrchid4" }, + { 147*C, 112*C, 219*C, "MediumPurple" }, + { 171*C, 130*C, 255*C, "MediumPurple1" }, + { 159*C, 121*C, 238*C, "MediumPurple2" }, + { 137*C, 104*C, 205*C, "MediumPurple3" }, + { 93*C, 71*C, 139*C, "MediumPurple4" }, + { 60*C, 179*C, 113*C, "MediumSeaGreen" }, + { 123*C, 104*C, 238*C, "MediumSlateBlue" }, + { 0*C, 250*C, 154*C, "MediumSpringGreen" }, + { 72*C, 209*C, 204*C, "MediumTurquoise" }, + { 199*C, 21*C, 133*C, "MediumVioletRed" }, + { 25*C, 25*C, 112*C, "midnight blue" }, + { 25*C, 25*C, 112*C, "MidnightBlue" }, + { 245*C, 255*C, 250*C, "mint cream" }, + { 245*C, 255*C, 250*C, "MintCream" }, + { 255*C, 228*C, 225*C, "misty rose" }, + { 255*C, 228*C, 225*C, "MistyRose" }, + { 255*C, 228*C, 225*C, "MistyRose1" }, + { 238*C, 213*C, 210*C, "MistyRose2" }, + { 205*C, 183*C, 181*C, "MistyRose3" }, + { 139*C, 125*C, 123*C, "MistyRose4" }, + { 255*C, 228*C, 181*C, "moccasin" }, + { 255*C, 222*C, 173*C, "navajo white" }, + { 255*C, 222*C, 173*C, "NavajoWhite" }, + { 255*C, 222*C, 173*C, "NavajoWhite1" }, + { 238*C, 207*C, 161*C, "NavajoWhite2" }, + { 205*C, 179*C, 139*C, "NavajoWhite3" }, + { 139*C, 121*C, 94*C, "NavajoWhite4" }, + { 0*C, 0*C, 128*C, "navy" }, + { 0*C, 0*C, 128*C, "navy blue" }, + { 0*C, 0*C, 128*C, "NavyBlue" }, + { 253*C, 245*C, 230*C, "old lace" }, + { 253*C, 245*C, 230*C, "OldLace" }, + { 107*C, 142*C, 35*C, "olive drab" }, + { 107*C, 142*C, 35*C, "OliveDrab" }, + { 192*C, 255*C, 62*C, "OliveDrab1" }, + { 179*C, 238*C, 58*C, "OliveDrab2" }, + { 154*C, 205*C, 50*C, "OliveDrab3" }, + { 105*C, 139*C, 34*C, "OliveDrab4" }, + { 255*C, 165*C, 0*C, "orange" }, + { 255*C, 69*C, 0*C, "orange red" }, + { 255*C, 165*C, 0*C, "orange1" }, + { 238*C, 154*C, 0*C, "orange2" }, + { 205*C, 133*C, 0*C, "orange3" }, + { 139*C, 90*C, 0*C, "orange4" }, + { 255*C, 69*C, 0*C, "OrangeRed" }, + { 255*C, 69*C, 0*C, "OrangeRed1" }, + { 238*C, 64*C, 0*C, "OrangeRed2" }, + { 205*C, 55*C, 0*C, "OrangeRed3" }, + { 139*C, 37*C, 0*C, "OrangeRed4" }, + { 218*C, 112*C, 214*C, "orchid" }, + { 255*C, 131*C, 250*C, "orchid1" }, + { 238*C, 122*C, 233*C, "orchid2" }, + { 205*C, 105*C, 201*C, "orchid3" }, + { 139*C, 71*C, 137*C, "orchid4" }, + { 238*C, 232*C, 170*C, "pale goldenrod" }, + { 152*C, 251*C, 152*C, "pale green" }, + { 175*C, 238*C, 238*C, "pale turquoise" }, + { 219*C, 112*C, 147*C, "pale violet red" }, + { 238*C, 232*C, 170*C, "PaleGoldenrod" }, + { 152*C, 251*C, 152*C, "PaleGreen" }, + { 154*C, 255*C, 154*C, "PaleGreen1" }, + { 144*C, 238*C, 144*C, "PaleGreen2" }, + { 124*C, 205*C, 124*C, "PaleGreen3" }, + { 84*C, 139*C, 84*C, "PaleGreen4" }, + { 175*C, 238*C, 238*C, "PaleTurquoise" }, + { 187*C, 255*C, 255*C, "PaleTurquoise1" }, + { 174*C, 238*C, 238*C, "PaleTurquoise2" }, + { 150*C, 205*C, 205*C, "PaleTurquoise3" }, + { 102*C, 139*C, 139*C, "PaleTurquoise4" }, + { 219*C, 112*C, 147*C, "PaleVioletRed" }, + { 255*C, 130*C, 171*C, "PaleVioletRed1" }, + { 238*C, 121*C, 159*C, "PaleVioletRed2" }, + { 205*C, 104*C, 137*C, "PaleVioletRed3" }, + { 139*C, 71*C, 93*C, "PaleVioletRed4" }, + { 255*C, 239*C, 213*C, "papaya whip" }, + { 255*C, 239*C, 213*C, "PapayaWhip" }, + { 255*C, 218*C, 185*C, "peach puff" }, + { 255*C, 218*C, 185*C, "PeachPuff" }, + { 255*C, 218*C, 185*C, "PeachPuff1" }, + { 238*C, 203*C, 173*C, "PeachPuff2" }, + { 205*C, 175*C, 149*C, "PeachPuff3" }, + { 139*C, 119*C, 101*C, "PeachPuff4" }, + { 205*C, 133*C, 63*C, "peru" }, + { 255*C, 192*C, 203*C, "pink" }, + { 255*C, 181*C, 197*C, "pink1" }, + { 238*C, 169*C, 184*C, "pink2" }, + { 205*C, 145*C, 158*C, "pink3" }, + { 139*C, 99*C, 108*C, "pink4" }, + { 221*C, 160*C, 221*C, "plum" }, + { 255*C, 187*C, 255*C, "plum1" }, + { 238*C, 174*C, 238*C, "plum2" }, + { 205*C, 150*C, 205*C, "plum3" }, + { 139*C, 102*C, 139*C, "plum4" }, + { 176*C, 224*C, 230*C, "powder blue" }, + { 176*C, 224*C, 230*C, "PowderBlue" }, + { 160*C, 32*C, 240*C, "purple" }, + { 155*C, 48*C, 255*C, "purple1" }, + { 145*C, 44*C, 238*C, "purple2" }, + { 125*C, 38*C, 205*C, "purple3" }, + { 85*C, 26*C, 139*C, "purple4" }, + { 255*C, 0*C, 0*C, "red" }, + { 255*C, 0*C, 0*C, "red1" }, + { 238*C, 0*C, 0*C, "red2" }, + { 205*C, 0*C, 0*C, "red3" }, + { 139*C, 0*C, 0*C, "red4" }, + { 188*C, 143*C, 143*C, "rosy brown" }, + { 188*C, 143*C, 143*C, "RosyBrown" }, + { 255*C, 193*C, 193*C, "RosyBrown1" }, + { 238*C, 180*C, 180*C, "RosyBrown2" }, + { 205*C, 155*C, 155*C, "RosyBrown3" }, + { 139*C, 105*C, 105*C, "RosyBrown4" }, + { 65*C, 105*C, 225*C, "royal blue" }, + { 65*C, 105*C, 225*C, "RoyalBlue" }, + { 72*C, 118*C, 255*C, "RoyalBlue1" }, + { 67*C, 110*C, 238*C, "RoyalBlue2" }, + { 58*C, 95*C, 205*C, "RoyalBlue3" }, + { 39*C, 64*C, 139*C, "RoyalBlue4" }, + { 139*C, 69*C, 19*C, "saddle brown" }, + { 139*C, 69*C, 19*C, "SaddleBrown" }, + { 250*C, 128*C, 114*C, "salmon" }, + { 255*C, 140*C, 105*C, "salmon1" }, + { 238*C, 130*C, 98*C, "salmon2" }, + { 205*C, 112*C, 84*C, "salmon3" }, + { 139*C, 76*C, 57*C, "salmon4" }, + { 244*C, 164*C, 96*C, "sandy brown" }, + { 244*C, 164*C, 96*C, "SandyBrown" }, + { 46*C, 139*C, 87*C, "sea green" }, + { 46*C, 139*C, 87*C, "SeaGreen" }, + { 84*C, 255*C, 159*C, "SeaGreen1" }, + { 78*C, 238*C, 148*C, "SeaGreen2" }, + { 67*C, 205*C, 128*C, "SeaGreen3" }, + { 46*C, 139*C, 87*C, "SeaGreen4" }, + { 255*C, 245*C, 238*C, "seashell" }, + { 255*C, 245*C, 238*C, "seashell1" }, + { 238*C, 229*C, 222*C, "seashell2" }, + { 205*C, 197*C, 191*C, "seashell3" }, + { 139*C, 134*C, 130*C, "seashell4" }, + { 160*C, 82*C, 45*C, "sienna" }, + { 255*C, 130*C, 71*C, "sienna1" }, + { 238*C, 121*C, 66*C, "sienna2" }, + { 205*C, 104*C, 57*C, "sienna3" }, + { 139*C, 71*C, 38*C, "sienna4" }, + { 135*C, 206*C, 235*C, "sky blue" }, + { 135*C, 206*C, 235*C, "SkyBlue" }, + { 135*C, 206*C, 255*C, "SkyBlue1" }, + { 126*C, 192*C, 238*C, "SkyBlue2" }, + { 108*C, 166*C, 205*C, "SkyBlue3" }, + { 74*C, 112*C, 139*C, "SkyBlue4" }, + { 106*C, 90*C, 205*C, "slate blue" }, + { 112*C, 128*C, 144*C, "slate gray" }, + { 112*C, 128*C, 144*C, "slate grey" }, + { 106*C, 90*C, 205*C, "SlateBlue" }, + { 131*C, 111*C, 255*C, "SlateBlue1" }, + { 122*C, 103*C, 238*C, "SlateBlue2" }, + { 105*C, 89*C, 205*C, "SlateBlue3" }, + { 71*C, 60*C, 139*C, "SlateBlue4" }, + { 112*C, 128*C, 144*C, "SlateGray" }, + { 198*C, 226*C, 255*C, "SlateGray1" }, + { 185*C, 211*C, 238*C, "SlateGray2" }, + { 159*C, 182*C, 205*C, "SlateGray3" }, + { 108*C, 123*C, 139*C, "SlateGray4" }, + { 112*C, 128*C, 144*C, "SlateGrey" }, + { 255*C, 250*C, 250*C, "snow" }, + { 255*C, 250*C, 250*C, "snow1" }, + { 238*C, 233*C, 233*C, "snow2" }, + { 205*C, 201*C, 201*C, "snow3" }, + { 139*C, 137*C, 137*C, "snow4" }, + { 0*C, 255*C, 127*C, "spring green" }, + { 0*C, 255*C, 127*C, "SpringGreen" }, + { 0*C, 255*C, 127*C, "SpringGreen1" }, + { 0*C, 238*C, 118*C, "SpringGreen2" }, + { 0*C, 205*C, 102*C, "SpringGreen3" }, + { 0*C, 139*C, 69*C, "SpringGreen4" }, + { 70*C, 130*C, 180*C, "steel blue" }, + { 70*C, 130*C, 180*C, "SteelBlue" }, + { 99*C, 184*C, 255*C, "SteelBlue1" }, + { 92*C, 172*C, 238*C, "SteelBlue2" }, + { 79*C, 148*C, 205*C, "SteelBlue3" }, + { 54*C, 100*C, 139*C, "SteelBlue4" }, + { 210*C, 180*C, 140*C, "tan" }, + { 255*C, 165*C, 79*C, "tan1" }, + { 238*C, 154*C, 73*C, "tan2" }, + { 205*C, 133*C, 63*C, "tan3" }, + { 139*C, 90*C, 43*C, "tan4" }, + { 216*C, 191*C, 216*C, "thistle" }, + { 255*C, 225*C, 255*C, "thistle1" }, + { 238*C, 210*C, 238*C, "thistle2" }, + { 205*C, 181*C, 205*C, "thistle3" }, + { 139*C, 123*C, 139*C, "thistle4" }, + { 255*C, 99*C, 71*C, "tomato" }, + { 255*C, 99*C, 71*C, "tomato1" }, + { 238*C, 92*C, 66*C, "tomato2" }, + { 205*C, 79*C, 57*C, "tomato3" }, + { 139*C, 54*C, 38*C, "tomato4" }, + { 64*C, 224*C, 208*C, "turquoise" }, + { 0*C, 245*C, 255*C, "turquoise1" }, + { 0*C, 229*C, 238*C, "turquoise2" }, + { 0*C, 197*C, 205*C, "turquoise3" }, + { 0*C, 134*C, 139*C, "turquoise4" }, + { 238*C, 130*C, 238*C, "violet" }, + { 208*C, 32*C, 144*C, "violet red" }, + { 208*C, 32*C, 144*C, "VioletRed" }, + { 255*C, 62*C, 150*C, "VioletRed1" }, + { 238*C, 58*C, 140*C, "VioletRed2" }, + { 205*C, 50*C, 120*C, "VioletRed3" }, + { 139*C, 34*C, 82*C, "VioletRed4" }, + { 245*C, 222*C, 179*C, "wheat" }, + { 255*C, 231*C, 186*C, "wheat1" }, + { 238*C, 216*C, 174*C, "wheat2" }, + { 205*C, 186*C, 150*C, "wheat3" }, + { 139*C, 126*C, 102*C, "wheat4" }, + { 255*C, 255*C, 255*C, "white" }, + { 245*C, 245*C, 245*C, "white smoke" }, + { 245*C, 245*C, 245*C, "WhiteSmoke" }, + { 255*C, 255*C, 0*C, "yellow" }, + { 154*C, 205*C, 50*C, "yellow green" }, + { 255*C, 255*C, 0*C, "yellow1" }, + { 238*C, 238*C, 0*C, "yellow2" }, + { 205*C, 205*C, 0*C, "yellow3" }, + { 139*C, 139*C, 0*C, "yellow4" }, + { 154*C, 205*C, 50*C, "YellowGreen" } +}; + +#undef C + +#define NUM_KD_COLORS (sizeof (KdColors) / sizeof (KdColors[0])) + +Bool +OsInitColors() +{ + return TRUE; +} + +Bool +OsLookupColor(int screen, + char *s_name, + unsigned int len, + unsigned short *pred, + unsigned short *pgreen, + unsigned short *pblue) +{ + const KdNamedColor *c; + unsigned char *name = (unsigned char *) s_name; + int low, mid, high; + int r; + + low = 0; + high = NUM_KD_COLORS; + while (high - low > 0) + { + mid = (low + high) / 2; + c = &KdColors[mid]; + r = KdStrCaseCmp (c->name, name, len); + if (r == 0) + { + *pred = c->red; + *pgreen = c->green; + *pblue = c->blue; + return TRUE; + } + if (r < 0) + { + if (high == mid) + break; + high = mid; + } + else + { + if (low == mid) + break; + low = mid; + } + } + return FALSE; +} --- xorg-server-1.4.2.orig/hw/kdrive/src/Makefile.in +++ xorg-server-1.4.2/hw/kdrive/src/Makefile.in @@ -159,7 +159,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -293,10 +293,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/kdrive/src/kkeymap.h +++ xorg-server-1.4.2/hw/kdrive/src/kkeymap.h @@ -0,0 +1,55 @@ +/* + * 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. + */ +/* + * All global variables and functions pertaining to keyboard key mapping + * live in this header file. + */ + +#ifndef _KKEYMAP_H +#define _KKEYMAP_H + +/* Offset of MIN_SCANCODE to 8 (X minimum scancode value) */ +#define KD_KEY_OFFSET (8 - kdMinScanCode) + +#define KD_MIN_KEYCODE 8 +#define KD_MAX_KEYCODE 254 +#define KD_MAX_WIDTH 4 +#define KD_MAX_LENGTH (KD_MAX_KEYCODE - KD_MIN_KEYCODE + 1) + +extern int kdMinScanCode; +extern int kdMaxScanCode; +extern int kdMinKeyCode; +extern int kdMaxKeyCode; +extern int kdKeymapWidth; + +extern KeySym kdKeymap[KD_MAX_LENGTH * KD_MAX_WIDTH]; + +extern CARD8 kdModMap[MAP_LENGTH]; + +extern KeySymsRec kdKeySyms; + +typedef struct { + KeySym modsym; + int modbit; +} KdKeySymModsRec; + +#endif /* _KKEYMAP_H */ --- xorg-server-1.4.2.orig/hw/kdrive/src/kloadmap.c +++ xorg-server-1.4.2/hw/kdrive/src/kloadmap.c @@ -0,0 +1,199 @@ +/* + * 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_CONFIG_H +#include +#endif +#include "kdrive.h" + +#ifdef WINDOWS +#define KM_BUF 1024 +#define KM_EOF -1 + +typedef struct _km_file { + HANDLE handle; + char buf[KM_BUF]; + char *bufptr; + DWORD remain; +} km_file; + +int +km_fill (km_file *kf) +{ + BOOL r; + + NCD_DEBUG ((DEBUG_INIT, "km_fill")); + r = ReadFile (kf->handle, kf->buf, KM_BUF, + &kf->remain, NULL); + NCD_DEBUG ((DEBUG_INIT, "Got %d", kf->remain)); + if (!r || !kf->remain) + return KM_EOF; + kf->bufptr = kf->buf; + --kf->remain; + return *kf->bufptr++; +} + +#define km_getchar(kf) ((kf)->remain-- ? *kf->bufptr++ : km_fill (kf)) +#else +#define km_getchar(kf) getc(kf) +#endif + +BOOL +km_word (km_file *kf, char *buf, int len) +{ + int c; + + for (;;) + { + switch (c = km_getchar (kf)) { + case KM_EOF: + return FALSE; + case ' ': + case '\t': + case '\n': + case '\r': + continue; + } + break; + } + len--; + while (len--) + { + *buf++ = c; + switch (c = km_getchar (kf)) { + case KM_EOF: + case ' ': + case '\t': + case '\n': + case '\r': + *buf++ = '\0'; + return TRUE; + } + } + return FALSE; +} + +BOOL +km_int (km_file *kf, int *r) +{ + char word[64]; + + if (km_word (kf, word, sizeof (word))) + { + *r = strtol (word, NULL, 0); + return TRUE; + } + return FALSE; +} + +WCHAR *winKbdExtensions[] = { + L".xku", + L".xkb" +}; + +#define NUM_KBD_EXTENSIONS (sizeof (winKbdExtensions) / sizeof (winKbdExtensions[0])) + +BOOL +winLoadKeymap (void) +{ + WCHAR file[32 + KL_NAMELENGTH]; + WCHAR name[KL_NAMELENGTH]; + HKL layout; + km_file kf; + int width; + BOOL ret; + KeySym *m; + int scancode; + int w; + int e; + + layout = GetKeyboardLayout (0); + /* + * Pre-build 46 versions of ThinSTAR software return 0 + * for all layouts + */ + if (!layout) + return FALSE; + NCD_DEBUG ((DEBUG_INIT, "Keyboard layout 0x%x", layout)); + for (e = 0; e < NUM_KBD_EXTENSIONS; e++) + { + wstrcpy (file, L"\\Storage Card\\"); + wsprintf (name, TEXT("%08x"), layout); + wstrcat (file, name); + wstrcat (file, winKbdExtensions[e]); + NCD_DEBUG ((DEBUG_INIT, "Loading keymap from %S", file)); + kf.handle = CreateFile (file, + GENERIC_READ, + FILE_SHARE_READ|FILE_SHARE_WRITE, + NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + NULL); + if (kf.handle != INVALID_HANDLE_VALUE) + break; + } + if (kf.handle == INVALID_HANDLE_VALUE) + { + NCD_DEBUG ((DEBUG_INIT, "No such file")); + return FALSE; + } + ret = FALSE; + kf.remain = 0; + /* + * Keymap format: + * + * flags (optional) + * width + * keycode -> keysym array (num_keycodes * width) + */ + if (!km_int (&kf, &width)) + goto bail1; + if (width & KEYMAP_FLAGS) + { + CEKeymapFlags = (unsigned long) width; + if (!km_int (&kf, &width)) + goto bail1; + } + else + CEKeymapFlags = 0; + if (width > MAX_WIDTH) + goto bail1; + NCD_DEBUG ((DEBUG_INIT, "Keymap width %d flags 0x%x", + width, CEKeymapFlags)); + m = CEKeymap; + for (scancode = MIN_SCANCODE; scancode <= MAX_SCANCODE; scancode++) + { + for (w = 0; w < width; w++) + { + if (!km_int (&kf, m)) + break; + m++; + } + if (w != width) + break; + } + CEKeySyms.mapWidth = width; + ret = TRUE; +bail1: + CloseHandle (kf.handle); + return ret; +} --- xorg-server-1.4.2.orig/hw/kdrive/ati/ati_dri.h +++ xorg-server-1.4.2/hw/kdrive/ati/ati_dri.h @@ -0,0 +1,97 @@ +/* + * Copyright © 2003 Eric Anholt + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Eric Anholt not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Eric Anholt makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER 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 _ATI_DRI_H_ +#define _ATI_DRI_H_ + +typedef struct { + /* DRI screen private data */ + int deviceID; /* PCI device ID */ + int width; /* Width in pixels of display */ + int height; /* Height in scanlines of display */ + int depth; /* Depth of display (8, 15, 16, 24) */ + int bpp; /* Bit depth of display (8, 16, 24, 32) */ + + int IsPCI; /* Current card is a PCI card */ + int AGPMode; + + int frontOffset; /* Start of front buffer */ + int frontPitch; + int backOffset; /* Start of shared back buffer */ + int backPitch; + int depthOffset; /* Start of shared depth buffer */ + int depthPitch; + int spanOffset; /* Start of scratch spanline */ + int textureOffset; /* Start of texture data in frame buffer */ + int textureSize; + int log2TexGran; + + /* MMIO register data */ + drmHandle registerHandle; + drmSize registerSize; + + /* CCE AGP Texture data */ + drmHandle gartTexHandle; + drmSize gartTexMapSize; + int log2AGPTexGran; + int gartTexOffset; + unsigned int sarea_priv_offset; +} R128DRIRec, *R128DRIPtr; + +typedef struct { + /* DRI screen private data */ + int deviceID; /* PCI device ID */ + int width; /* Width in pixels of display */ + int height; /* Height in scanlines of display */ + int depth; /* Depth of display (8, 15, 16, 24) */ + int bpp; /* Bit depth of display (8, 16, 24, 32) */ + + int IsPCI; /* Current card is a PCI card */ + int AGPMode; + + int frontOffset; /* Start of front buffer */ + int frontPitch; + int backOffset; /* Start of shared back buffer */ + int backPitch; + int depthOffset; /* Start of shared depth buffer */ + int depthPitch; + int textureOffset; /* Start of texture data in frame buffer */ + int textureSize; + int log2TexGran; + + /* MMIO register data */ + drmHandle registerHandle; + drmSize registerSize; + + /* CP in-memory status information */ + drmHandle statusHandle; + drmSize statusSize; + + /* CP GART Texture data */ + drmHandle gartTexHandle; + drmSize gartTexMapSize; + int log2GARTTexGran; + int gartTexOffset; + unsigned int sarea_priv_offset; +} RADEONDRIRec, *RADEONDRIPtr; + +#endif /* _ATI_DRI_H_ */ --- xorg-server-1.4.2.orig/hw/kdrive/ati/r128_blendtmp.h +++ xorg-server-1.4.2/hw/kdrive/ati/r128_blendtmp.h @@ -0,0 +1,134 @@ +/* + * Copyright © 2003 Eric Anholt, Anders Carlsson + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Eric Anholt not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Eric Anholt makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER 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 USE_DMA +#define TAG(x) x##DMA +#define LOCALS RING_LOCALS; \ + (void)atic +#define BEGIN(x) BEGIN_RING(x * 2) +#define OUT_REG(reg, val) OUT_RING_REG(reg, val) +#define END() ADVANCE_RING() +#else +#define TAG(x) x##MMIO +#define LOCALS char *mmio = atic->reg_base +#define BEGIN(x) ATIWaitAvailMMIO(x) +#define OUT_REG(reg, val) MMIO_OUT32(mmio, (reg), (val)) +#define END() +#endif + +static Bool +TAG(R128PrepareBlend)(int op, PicturePtr pSrcPicture, PicturePtr pDstPicture, + PixmapPtr pSrc, PixmapPtr pDst) +{ + KdScreenPriv(pDst->drawable.pScreen); + ATIScreenInfo(pScreenPriv); + ATICardInfo(pScreenPriv); + CARD32 dstDatatype, srcDatatype; + LOCALS; + + accel_atis = atis; + + if (!TAG(ATISetup)(pDst, pSrc)) + return FALSE; + + src_bpp = pSrc->drawable.bitsPerPixel; + is_repeat = pSrcPicture->repeat; + + if (op >= sizeof(R128BlendOp)/sizeof(R128BlendOp[0])) + ATI_FALLBACK(("Unsupported op 0x%x\n", op)); + if (pSrcPicture->repeat && (pSrc->drawable.width != 1 || + pSrc->drawable.height != 1)) + ATI_FALLBACK(("repeat unsupported\n")); + if (pSrcPicture->transform != NULL) + ATI_FALLBACK(("transform unsupported\n")); + if (!R128GetDatatypePict(pDstPicture->format, &dstDatatype)) + ATI_FALLBACK(("Unsupported dest format 0x%x\n", + pDstPicture->format)); + if (!R128GetDatatypePict(pSrcPicture->format, &srcDatatype)) + ATI_FALLBACK(("Unsupported src format 0x%x\n", + pSrcPicture->format)); + + BEGIN(11); + OUT_REG(RADEON_REG_DP_GUI_MASTER_CNTL, + (dstDatatype << 8) | + RADEON_GMC_SRC_DATATYPE_COLOR | + RADEON_GMC_DST_PITCH_OFFSET_CNTL | + RADEON_GMC_CLR_CMP_CNTL_DIS | + RADEON_GMC_AUX_CLIP_DIS | + (ATIBltRop[3] << 16) | + RADEON_GMC_3D_FCN_EN); + OUT_REG(R128_REG_TEX_CNTL_C, R128_TEX_ALPHA_EN | R128_TEX_CACHE_FLUSH); + OUT_REG(R128_REG_PRIM_TEXTURE_COMBINE_CNTL_C, 0); + OUT_REG(R128_REG_SCALE_3D_CNTL, + R128_SCALE_3D_SCALE | + R128BlendOp[op] | + R128_TEX_MAP_ALPHA_IN_TEXTURE); + OUT_REG(R128_REG_SCALE_3D_DATATYPE, srcDatatype); + OUT_REG(R128_REG_SCALE_PITCH, src_pitch / src_bpp); + /* 4.16 fixed point scaling factor? */ + if (is_repeat) { + OUT_REG(R128_REG_SCALE_X_INC, 0); + OUT_REG(R128_REG_SCALE_Y_INC, 0); + } else { + OUT_REG(R128_REG_SCALE_X_INC, 65536); + OUT_REG(R128_REG_SCALE_Y_INC, 65536); + } + OUT_REG(R128_REG_SCALE_HACC, 0x00000000); + OUT_REG(R128_REG_SCALE_VACC, 0x00000000); + OUT_REG(RADEON_REG_DP_CNTL, + RADEON_DST_X_LEFT_TO_RIGHT | RADEON_DST_Y_TOP_TO_BOTTOM ); + END(); + + return TRUE; +} + +static void +TAG(R128Blend)(int srcX, int srcY, int dstX, int dstY, int width, int height) +{ + ATIScreenInfo *atis = accel_atis; + ATICardInfo *atic = atis->atic; + LOCALS; + + if (is_repeat) { + srcX = 0; + srcY = 0; + } + + BEGIN(4); + OUT_REG(R128_REG_SCALE_OFFSET_0, src_offset + srcY * src_pitch + srcX * + (src_bpp >> 3)); + OUT_REG(R128_REG_SCALE_SRC_HEIGHT_WIDTH, (height << 16) | width); + OUT_REG(R128_REG_SCALE_DST_X_Y, (dstX << 16) | dstY); + OUT_REG(R128_REG_SCALE_DST_HEIGHT_WIDTH, (height << 16) | width); + END(); +} + +static void +TAG(R128DoneBlend)(void) +{ +} + +#undef TAG +#undef LOCALS +#undef BEGIN +#undef OUT_REG +#undef END --- xorg-server-1.4.2.orig/hw/kdrive/ati/ati_sarea.h +++ xorg-server-1.4.2/hw/kdrive/ati/ati_sarea.h @@ -0,0 +1,38 @@ +/* + * Copyright © 2003 Eric Anholt + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Eric Anholt not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Eric Anholt makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER 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 _ATI_SAREA_H_ +#define _ATI_SAREA_H_ + +/* There are 2 heaps (local/AGP). Each region within a heap is a + * minimum of 64k, and there are at most 64 of them per heap. + */ +#define ATI_CARD_HEAP 0 +#define ATI_GART_HEAP 1 +#define ATI_NR_TEX_HEAPS 2 +#define ATI_NR_TEX_REGIONS 64 +#define ATI_LOG_TEX_GRANULARITY 16 + +#include "r128_sarea.h" +#include "radeon_sarea.h" + +#endif /* _ATI_SAREA_H_ */ --- xorg-server-1.4.2.orig/hw/kdrive/ati/Makefile.in +++ xorg-server-1.4.2/hw/kdrive/ati/Makefile.in @@ -168,7 +168,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -302,10 +302,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/kdrive/ati/r128_sarea.h +++ xorg-server-1.4.2/hw/kdrive/ati/r128_sarea.h @@ -0,0 +1,185 @@ +/* + * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, + * Precision Insight, Inc., Cedar Park, Texas, and + * VA Linux Systems Inc., Fremont, California. + * + * 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 ATI, PRECISION INSIGHT, VA LINUX + * SYSTEMS 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 + * Gareth Hughes + * + */ + +#ifndef _R128_SAREA_H_ +#define _R128_SAREA_H_ + +/* WARNING: If you change any of these defines, make sure to change the + * defines in the kernel file (r128_drm.h) + */ +#ifndef __R128_SAREA_DEFINES__ +#define __R128_SAREA_DEFINES__ + +/* What needs to be changed for the current vertex buffer? + */ +#define R128_UPLOAD_CONTEXT 0x001 +#define R128_UPLOAD_SETUP 0x002 +#define R128_UPLOAD_TEX0 0x004 +#define R128_UPLOAD_TEX1 0x008 +#define R128_UPLOAD_TEX0IMAGES 0x010 +#define R128_UPLOAD_TEX1IMAGES 0x020 +#define R128_UPLOAD_CORE 0x040 +#define R128_UPLOAD_MASKS 0x080 +#define R128_UPLOAD_WINDOW 0x100 +#define R128_UPLOAD_CLIPRECTS 0x200 /* handled client-side */ +#define R128_REQUIRE_QUIESCENCE 0x400 +#define R128_UPLOAD_ALL 0x7ff + +#define R128_FRONT 0x1 +#define R128_BACK 0x2 +#define R128_DEPTH 0x4 + +/* Primitive types + */ +#define R128_POINTS 0x1 +#define R128_LINES 0x2 +#define R128_LINE_STRIP 0x3 +#define R128_TRIANGLES 0x4 +#define R128_TRIANGLE_FAN 0x5 +#define R128_TRIANGLE_STRIP 0x6 + +/* Vertex/indirect buffer size + */ +#define R128_BUFFER_SIZE 16384 + +/* Byte offsets for indirect buffer data + */ +#define R128_INDEX_PRIM_OFFSET 20 +#define R128_HOSTDATA_BLIT_OFFSET 32 + +/* Keep these small for testing + */ +#define R128_NR_SAREA_CLIPRECTS 12 + +#define R128_NR_CONTEXT_REGS 12 + +#define R128_MAX_TEXTURE_LEVELS 11 +#define R128_MAX_TEXTURE_UNITS 2 + +#endif /* __R128_SAREA_DEFINES__ */ + +typedef struct { + /* Context state - can be written in one large chunk */ + unsigned int dst_pitch_offset_c; + unsigned int dp_gui_master_cntl_c; + unsigned int sc_top_left_c; + unsigned int sc_bottom_right_c; + unsigned int z_offset_c; + unsigned int z_pitch_c; + unsigned int z_sten_cntl_c; + unsigned int tex_cntl_c; + unsigned int misc_3d_state_cntl_reg; + unsigned int texture_clr_cmp_clr_c; + unsigned int texture_clr_cmp_msk_c; + unsigned int fog_color_c; + + /* Texture state */ + unsigned int tex_size_pitch_c; + unsigned int constant_color_c; + + /* Setup state */ + unsigned int pm4_vc_fpu_setup; + unsigned int setup_cntl; + + /* Mask state */ + unsigned int dp_write_mask; + unsigned int sten_ref_mask_c; + unsigned int plane_3d_mask_c; + + /* Window state */ + unsigned int window_xy_offset; + + /* Core state */ + unsigned int scale_3d_cntl; +} r128_context_regs_t; + +/* Setup registers for each texture unit + */ +typedef struct { + unsigned int tex_cntl; + unsigned int tex_combine_cntl; + unsigned int tex_size_pitch; + unsigned int tex_offset[R128_MAX_TEXTURE_LEVELS]; + unsigned int tex_border_color; +} r128_texture_regs_t; + +typedef struct { + /* The channel for communication of state information to the kernel + * on firing a vertex buffer. + */ + r128_context_regs_t ContextState; + r128_texture_regs_t TexState[R128_MAX_TEXTURE_UNITS]; + unsigned int dirty; + unsigned int vertsize; + unsigned int vc_format; + +#ifdef XF86DRI + /* The current cliprects, or a subset thereof. + */ + XF86DRIClipRectRec boxes[R128_NR_SAREA_CLIPRECTS]; + unsigned int nbox; +#endif + + /* Counters for throttling of rendering clients. + */ + unsigned int last_frame; + unsigned int last_dispatch; + + /* Maintain an LRU of contiguous regions of texture space. If you + * think you own a region of texture memory, and it has an age + * different to the one you set, then you are mistaken and it has + * been stolen by another client. If global texAge hasn't changed, + * there is no need to walk the list. + * + * These regions can be used as a proxy for the fine-grained texture + * information of other clients - by maintaining them in the same + * lru which is used to age their own textures, clients have an + * approximate lru for the whole of global texture space, and can + * make informed decisions as to which areas to kick out. There is + * no need to choose whether to kick out your own texture or someone + * else's - simply eject them all in LRU order. + */ + /* Last elt is sentinal */ + drmTextureRegion texList[ATI_NR_TEX_HEAPS][ATI_NR_TEX_REGIONS+1]; + /* last time texture was uploaded */ + unsigned int texAge[ATI_NR_TEX_HEAPS]; + + int ctxOwner; /* last context to upload state */ + int pfAllowPageFlip; /* set by the 2d driver, read by the client */ + int pfCurrentPage; /* set by kernel, read by others */ +} R128SAREAPriv, *R128SAREAPrivPtr; + +#endif --- xorg-server-1.4.2.orig/hw/kdrive/ati/ati_drawtmp.h +++ xorg-server-1.4.2/hw/kdrive/ati/ati_drawtmp.h @@ -0,0 +1,237 @@ +/* + * Copyright © 2003 Eric Anholt + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Eric Anholt not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Eric Anholt makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER 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 USE_DMA +#define TAG(x) x##DMA +#define LOCALS RING_LOCALS; \ + (void)atic +#define BEGIN(x) BEGIN_RING(x * 2) +#define OUT_REG(reg, val) OUT_RING_REG(reg, val) +#define END() ADVANCE_RING() +#else +#define TAG(x) x##MMIO +#define LOCALS char *mmio = atic->reg_base; \ + (void)atis +#define BEGIN(x) ATIWaitAvailMMIO(x) +#define OUT_REG(reg, val) MMIO_OUT32((mmio), (reg), (val)) +#define END() +#endif + +static Bool +TAG(ATISetup)(PixmapPtr pDst, PixmapPtr pSrc) +{ + KdScreenPriv(pDst->drawable.pScreen); + ATIScreenInfo(pScreenPriv); + ATICardInfo(pScreenPriv); + int dst_offset, dst_pitch; + int bpp = pDst->drawable.bitsPerPixel; + LOCALS; + + accel_atis = atis; + + dst_pitch = pDst->devKind; + dst_offset = ((CARD8 *)pDst->devPrivate.ptr - + pScreenPriv->screen->memory_base); + if ((dst_pitch & (atis->kaa.offscreenPitch - 1)) != 0) + ATI_FALLBACK(("Bad dst pitch 0x%x\n", dst_pitch)); + if ((dst_offset & (atis->kaa.offscreenByteAlign - 1)) != 0) + ATI_FALLBACK(("Bad dst offset 0x%x\n", dst_offset)); + + if (pSrc != NULL) { + src_pitch = pSrc->devKind; + src_offset = ((CARD8 *)pSrc->devPrivate.ptr - + pScreenPriv->screen->memory_base); + if ((src_pitch & (atis->kaa.offscreenPitch - 1)) != 0) + ATI_FALLBACK(("Bad src pitch 0x%x\n", src_pitch)); + if ((src_offset & (atis->kaa.offscreenByteAlign - 1)) != 0) + ATI_FALLBACK(("Bad src offset 0x%x\n", src_offset)); + } + +#ifdef USE_DMA + if (atic->is_radeon && !atic->is_r200) + RadeonSwitchTo2D(); +#endif + BEGIN((pSrc != NULL) ? 3 : 2); + if (atic->is_radeon) { + OUT_REG(RADEON_REG_DST_PITCH_OFFSET, + ((dst_pitch >> 6) << 22) | (dst_offset >> 10)); + if (pSrc != NULL) { + OUT_REG(RADEON_REG_SRC_PITCH_OFFSET, + ((src_pitch >> 6) << 22) | (src_offset >> 10)); + } + } else { + if (is_24bpp) { + dst_pitch *= 3; + src_pitch *= 3; + } + /* R128 pitch is in units of 8 pixels, offset in 32 bytes */ + OUT_REG(RADEON_REG_DST_PITCH_OFFSET, + ((dst_pitch/bpp) << 21) | (dst_offset >> 5)); + if (pSrc != NULL) { + OUT_REG(RADEON_REG_SRC_PITCH_OFFSET, + ((src_pitch/bpp) << 21) | (src_offset >> 5)); + } + } + OUT_REG(RADEON_REG_DEFAULT_SC_BOTTOM_RIGHT, + (RADEON_DEFAULT_SC_RIGHT_MAX | RADEON_DEFAULT_SC_BOTTOM_MAX)); + END(); + + return TRUE; +} + +static Bool +TAG(ATIPrepareSolid)(PixmapPtr pPixmap, int alu, Pixel pm, Pixel fg) +{ + KdScreenPriv(pPixmap->drawable.pScreen); + ATIScreenInfo(pScreenPriv); + ATICardInfo(pScreenPriv); + CARD32 datatype; + LOCALS; + + if (is_24bpp) { + /* Solid fills in fake-24bpp mode only work if the pixel color + * and planemask are all the same byte. + */ + if ((fg & 0xffffff) != (((fg & 0xff) << 16) | ((fg >> 8) & + 0xffff))) + ATI_FALLBACK(("Can't do solid color %d in 24bpp\n")); + if ((pm & 0xffffff) != (((pm & 0xff) << 16) | ((pm >> 8) & + 0xffff))) + ATI_FALLBACK(("Can't do planemask %d in 24bpp\n")); + } + + if (!ATIGetDatatypeBpp(pPixmap->drawable.bitsPerPixel, &datatype)) + return FALSE; + if (!TAG(ATISetup)(pPixmap, NULL)) + return FALSE; + + BEGIN(4); + OUT_REG(RADEON_REG_DP_GUI_MASTER_CNTL, + (datatype << 8) | + RADEON_GMC_CLR_CMP_CNTL_DIS | + RADEON_GMC_AUX_CLIP_DIS | + RADEON_GMC_BRUSH_SOLID_COLOR | + RADEON_GMC_DST_PITCH_OFFSET_CNTL | + RADEON_GMC_SRC_DATATYPE_COLOR | + (ATISolidRop[alu] << 16)); + OUT_REG(RADEON_REG_DP_BRUSH_FRGD_CLR, fg); + OUT_REG(RADEON_REG_DP_WRITE_MASK, pm); + OUT_REG(RADEON_REG_DP_CNTL, RADEON_DST_X_LEFT_TO_RIGHT | + RADEON_DST_Y_TOP_TO_BOTTOM); + END(); + + return TRUE; +} + +static void +TAG(ATISolid)(int x1, int y1, int x2, int y2) +{ + ATIScreenInfo *atis = accel_atis; + ATICardInfo *atic = atis->atic; + LOCALS; + + if (is_24bpp) { + x1 *= 3; + x2 *= 3; + } + BEGIN(2); + OUT_REG(RADEON_REG_DST_Y_X, (y1 << 16) | x1); + OUT_REG(RADEON_REG_DST_WIDTH_HEIGHT, ((x2 - x1) << 16) | (y2 - y1)); + END(); +} + +static Bool +TAG(ATIPrepareCopy)(PixmapPtr pSrc, PixmapPtr pDst, int dx, int dy, int alu, Pixel pm) +{ + KdScreenPriv(pDst->drawable.pScreen); + ATIScreenInfo(pScreenPriv); + ATICardInfo(pScreenPriv); + CARD32 datatype; + LOCALS; + + copydx = dx; + copydy = dy; + + if (is_24bpp && ((pm & 0xffffff) != (((pm & 0xff) << 16) | ((pm >> 8) & + 0xffff)))) + ATI_FALLBACK(("Can't do planemask %d in 24bpp\n")); + + if (!ATIGetDatatypeBpp(pDst->drawable.bitsPerPixel, &datatype)) + return FALSE; + if (!TAG(ATISetup)(pDst, pSrc)) + return FALSE; + + BEGIN(3); + OUT_REG(RADEON_REG_DP_GUI_MASTER_CNTL, + (datatype << 8) | + RADEON_GMC_CLR_CMP_CNTL_DIS | + RADEON_GMC_AUX_CLIP_DIS | + RADEON_GMC_BRUSH_SOLID_COLOR | + RADEON_GMC_SRC_DATATYPE_COLOR | + (ATIBltRop[alu] << 16) | + RADEON_GMC_SRC_PITCH_OFFSET_CNTL | + RADEON_GMC_DST_PITCH_OFFSET_CNTL | + RADEON_DP_SRC_SOURCE_MEMORY); + OUT_REG(RADEON_REG_DP_WRITE_MASK, pm); + OUT_REG(RADEON_REG_DP_CNTL, + (dx >= 0 ? RADEON_DST_X_LEFT_TO_RIGHT : 0) | + (dy >= 0 ? RADEON_DST_Y_TOP_TO_BOTTOM : 0)); + END(); + + return TRUE; +} + +static void +TAG(ATICopy)(int srcX, int srcY, int dstX, int dstY, int w, int h) +{ + ATIScreenInfo *atis = accel_atis; + ATICardInfo *atic = atis->atic; + LOCALS; + + if (is_24bpp) { + srcX *= 3; + dstX *= 3; + w *= 3; + } + + if (copydx < 0) { + srcX += w - 1; + dstX += w - 1; + } + + if (copydy < 0) { + srcY += h - 1; + dstY += h - 1; + } + + BEGIN(3); + OUT_REG(RADEON_REG_SRC_Y_X, (srcY << 16) | srcX); + OUT_REG(RADEON_REG_DST_Y_X, (dstY << 16) | dstX); + OUT_REG(RADEON_REG_DST_HEIGHT_WIDTH, (h << 16) | w); + END(); +} + +#undef TAG +#undef LOCALS +#undef BEGIN +#undef OUT_REG +#undef END --- xorg-server-1.4.2.orig/hw/kdrive/ati/radeon_sarea.h +++ xorg-server-1.4.2/hw/kdrive/ati/radeon_sarea.h @@ -0,0 +1,221 @@ +/* + * Copyright 2000 ATI Technologies Inc., Markham, Ontario, + * VA Linux Systems Inc., Fremont, California. + * + * 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 ATI, VA LINUX SYSTEMS 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 + * Gareth Hughes + * + */ + +#ifndef _RADEON_SAREA_H_ +#define _RADEON_SAREA_H_ + +/* WARNING: If you change any of these defines, make sure to change the + * defines in the kernel file (radeon_drm.h) + */ +#ifndef __RADEON_SAREA_DEFINES__ +#define __RADEON_SAREA_DEFINES__ + +/* What needs to be changed for the current vertex buffer? */ +#define RADEON_UPLOAD_CONTEXT 0x00000001 +#define RADEON_UPLOAD_VERTFMT 0x00000002 +#define RADEON_UPLOAD_LINE 0x00000004 +#define RADEON_UPLOAD_BUMPMAP 0x00000008 +#define RADEON_UPLOAD_MASKS 0x00000010 +#define RADEON_UPLOAD_VIEWPORT 0x00000020 +#define RADEON_UPLOAD_SETUP 0x00000040 +#define RADEON_UPLOAD_TCL 0x00000080 +#define RADEON_UPLOAD_MISC 0x00000100 +#define RADEON_UPLOAD_TEX0 0x00000200 +#define RADEON_UPLOAD_TEX1 0x00000400 +#define RADEON_UPLOAD_TEX2 0x00000800 +#define RADEON_UPLOAD_TEX0IMAGES 0x00001000 +#define RADEON_UPLOAD_TEX1IMAGES 0x00002000 +#define RADEON_UPLOAD_TEX2IMAGES 0x00004000 +#define RADEON_UPLOAD_CLIPRECTS 0x00008000 /* handled client-side */ +#define RADEON_REQUIRE_QUIESCENCE 0x00010000 +#define RADEON_UPLOAD_ZBIAS 0x00020000 +#define RADEON_UPLOAD_ALL 0x0002ffff +#define RADEON_UPLOAD_CONTEXT_ALL 0x000201ff + +#define RADEON_FRONT 0x1 +#define RADEON_BACK 0x2 +#define RADEON_DEPTH 0x4 +#define RADEON_STENCIL 0x8 + +/* Primitive types */ +#define RADEON_POINTS 0x1 +#define RADEON_LINES 0x2 +#define RADEON_LINE_STRIP 0x3 +#define RADEON_TRIANGLES 0x4 +#define RADEON_TRIANGLE_FAN 0x5 +#define RADEON_TRIANGLE_STRIP 0x6 +#define RADEON_3VTX_POINTS 0x9 +#define RADEON_3VTX_LINES 0xa + +/* Vertex/indirect buffer size */ +#define RADEON_BUFFER_SIZE 65536 + +/* Byte offsets for indirect buffer data */ +#define RADEON_INDEX_PRIM_OFFSET 20 +#define RADEON_HOSTDATA_BLIT_OFFSET 32 + +#define RADEON_SCRATCH_REG_OFFSET 32 + +/* Keep these small for testing */ +#define RADEON_NR_SAREA_CLIPRECTS 12 + +#define RADEON_MAX_TEXTURE_LEVELS 12 +#define RADEON_MAX_TEXTURE_UNITS 3 + +/* Blits have strict offset rules. All blit offset must be aligned on + * a 1K-byte boundary. + */ +#define RADEON_OFFSET_SHIFT 10 +#define RADEON_OFFSET_ALIGN (1 << RADEON_OFFSET_SHIFT) +#define RADEON_OFFSET_MASK (RADEON_OFFSET_ALIGN - 1) + +#endif /* __RADEON_SAREA_DEFINES__ */ + +typedef struct { + unsigned int red; + unsigned int green; + unsigned int blue; + unsigned int alpha; +} radeon_color_regs_t; + +typedef struct { + /* Context state */ + unsigned int pp_misc; + unsigned int pp_fog_color; + unsigned int re_solid_color; + unsigned int rb3d_blendcntl; + unsigned int rb3d_depthoffset; + unsigned int rb3d_depthpitch; + unsigned int rb3d_zstencilcntl; + + unsigned int pp_cntl; + unsigned int rb3d_cntl; + unsigned int rb3d_coloroffset; + unsigned int re_width_height; + unsigned int rb3d_colorpitch; + unsigned int se_cntl; + + /* Vertex format state */ + unsigned int se_coord_fmt; + + /* Line state */ + unsigned int re_line_pattern; + unsigned int re_line_state; + + unsigned int se_line_width; + + /* Bumpmap state */ + unsigned int pp_lum_matrix; + + unsigned int pp_rot_matrix_0; + unsigned int pp_rot_matrix_1; + + /* Mask state */ + unsigned int rb3d_stencilrefmask; + unsigned int rb3d_ropcntl; + unsigned int rb3d_planemask; + + /* Viewport state */ + unsigned int se_vport_xscale; + unsigned int se_vport_xoffset; + unsigned int se_vport_yscale; + unsigned int se_vport_yoffset; + unsigned int se_vport_zscale; + unsigned int se_vport_zoffset; + + /* Setup state */ + unsigned int se_cntl_status; + + /* Misc state */ + unsigned int re_top_left; + unsigned int re_misc; +} radeon_context_regs_t; + +/* Setup registers for each texture unit */ +typedef struct { + unsigned int pp_txfilter; + unsigned int pp_txformat; + unsigned int pp_txoffset; + unsigned int pp_txcblend; + unsigned int pp_txablend; + unsigned int pp_tfactor; + unsigned int pp_border_color; +} radeon_texture_regs_t; + +typedef struct { + /* The channel for communication of state information to the kernel + * on firing a vertex buffer. + */ + radeon_context_regs_t ContextState; + radeon_texture_regs_t TexState[RADEON_MAX_TEXTURE_UNITS]; + unsigned int dirty; + unsigned int vertsize; + unsigned int vc_format; + + /* The current cliprects, or a subset thereof */ + XF86DRIClipRectRec boxes[RADEON_NR_SAREA_CLIPRECTS]; + unsigned int nbox; + + /* Counters for throttling of rendering clients */ + unsigned int last_frame; + unsigned int last_dispatch; + unsigned int last_clear; + + /* Maintain an LRU of contiguous regions of texture space. If you + * think you own a region of texture memory, and it has an age + * different to the one you set, then you are mistaken and it has + * been stolen by another client. If global texAge hasn't changed, + * there is no need to walk the list. + * + * These regions can be used as a proxy for the fine-grained texture + * information of other clients - by maintaining them in the same + * lru which is used to age their own textures, clients have an + * approximate lru for the whole of global texture space, and can + * make informed decisions as to which areas to kick out. There is + * no need to choose whether to kick out your own texture or someone + * else's - simply eject them all in LRU order. + */ + /* Last elt is sentinal */ + drmTextureRegion texList[ATI_NR_TEX_HEAPS][ATI_NR_TEX_REGIONS+1]; + /* last time texture was uploaded */ + unsigned int texAge[ATI_NR_TEX_HEAPS]; + + int ctxOwner; /* last context to upload state */ + int pfAllowPageFlip; /* set by the 2d driver, read by the client */ + int pfCurrentPage; /* set by kernel, read by others */ + int crtc2_base; /* for pageflipping with CloneMode */ +} RADEONSAREAPriv, *RADEONSAREAPrivPtr; + +#endif --- xorg-server-1.4.2.orig/hw/kdrive/ati/ati_dri.c +++ xorg-server-1.4.2/hw/kdrive/ati/ati_dri.c @@ -0,0 +1,1138 @@ +/* + * Copyright © 2003 Eric Anholt + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Eric Anholt not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Eric Anholt makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER 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 + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "ati.h" +#include "ati_reg.h" +#include "ati_dma.h" +#include "ati_dri.h" +#include "ati_dripriv.h" +#include "sarea.h" +#include "ati_sarea.h" +#include "ati_draw.h" +#include "r128_common.h" +#include "radeon_common.h" +#include "kaa.h" + +/* ?? HACK - for now, put this here... */ +/* ?? Alpha - this may need to be a variable to handle UP1x00 vs TITAN */ +#if defined(__alpha__) +# define DRM_PAGE_SIZE 8192 +#elif defined(__ia64__) +# define DRM_PAGE_SIZE getpagesize() +#else +# define DRM_PAGE_SIZE 4096 +#endif + +#ifdef GLXEXT +/* Initialize the visual configs that are supported by the hardware. + * These are combined with the visual configs that the indirect + * rendering core supports, and the intersection is exported to the + * client. + */ +static Bool ATIInitVisualConfigs(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + ATIScreenInfo(pScreenPriv); + int numConfigs = 0; + __GLXvisualConfig *pConfigs = NULL; + ATIConfigPrivPtr pATIConfigs = NULL; + ATIConfigPrivPtr *pATIConfigPtrs = NULL; + int i, accum, stencil, db, use_db; + int depth = pScreenPriv->screen->fb[0].depth; + int bpp = pScreenPriv->screen->fb[0].bitsPerPixel; + + if (depth != 16 && (depth != 24 || bpp != 32)) + ErrorF("DRI GLX unsupported at %d/%d depth/bpp\n", depth, bpp); + + if (atis->depthOffset != 0) + use_db = 1; + else + use_db = 0; + + numConfigs = 4; + if (use_db) + numConfigs *= 2; + + pConfigs = xcalloc(sizeof(__GLXvisualConfig), numConfigs); + pATIConfigs = xcalloc(sizeof(ATIConfigPrivRec), numConfigs); + pATIConfigPtrs = xcalloc(sizeof(ATIConfigPrivPtr), numConfigs); + if (pConfigs == NULL || pATIConfigs == NULL || pATIConfigPtrs == NULL) { + xfree(pConfigs); + xfree(pATIConfigs); + xfree(pATIConfigPtrs); + return FALSE; + } + + i = 0; + for (db = 0; db <= use_db; db++) { + for (accum = 0; accum <= 1; accum++) { + for (stencil = 0; stencil <= 1; stencil++) { + pATIConfigPtrs[i] = &pATIConfigs[i]; + + pConfigs[i].vid = (VisualID)(-1); + pConfigs[i].class = -1; + pConfigs[i].rgba = TRUE; + if (depth == 16) { + pConfigs[i].redSize = 5; + pConfigs[i].greenSize = 6; + pConfigs[i].blueSize = 5; + pConfigs[i].alphaSize = 0; + pConfigs[i].redMask = 0x0000F800; + pConfigs[i].greenMask = 0x000007E0; + pConfigs[i].blueMask = 0x0000001F; + pConfigs[i].alphaMask = 0x00000000; + } else { + pConfigs[i].redSize = 8; + pConfigs[i].greenSize = 8; + pConfigs[i].blueSize = 8; + pConfigs[i].alphaSize = 8; + pConfigs[i].redMask = 0x00FF0000; + pConfigs[i].greenMask = 0x0000FF00; + pConfigs[i].blueMask = 0x000000FF; + pConfigs[i].alphaMask = 0xFF000000; + } + if (accum) { /* Simulated in software */ + pConfigs[i].accumRedSize = 16; + pConfigs[i].accumGreenSize = 16; + pConfigs[i].accumBlueSize = 16; + if (depth == 16) + pConfigs[i].accumAlphaSize = 0; + else + pConfigs[i].accumAlphaSize = 16; + } else { + pConfigs[i].accumRedSize = 0; + pConfigs[i].accumGreenSize = 0; + pConfigs[i].accumBlueSize = 0; + pConfigs[i].accumAlphaSize = 0; + } + if (db) + pConfigs[i].doubleBuffer = TRUE; + else + pConfigs[i].doubleBuffer = FALSE; + pConfigs[i].stereo = FALSE; + if (depth == 16) { + pConfigs[i].bufferSize = 16; + pConfigs[i].depthSize = 16; + if (stencil) + pConfigs[i].stencilSize = 8; + else + pConfigs[i].stencilSize = 0; + } else { + pConfigs[i].bufferSize = 32; + if (stencil) { + pConfigs[i].depthSize = 24; + pConfigs[i].stencilSize = 8; + } else { + pConfigs[i].depthSize = 24; + pConfigs[i].stencilSize = 0; + } + } + pConfigs[i].auxBuffers = 0; + pConfigs[i].level = 0; + if (accum) { + pConfigs[i].visualRating = GLX_SLOW_CONFIG; + } else { + pConfigs[i].visualRating = GLX_NONE; + } + pConfigs[i].transparentPixel = GLX_NONE; + pConfigs[i].transparentRed = 0; + pConfigs[i].transparentGreen = 0; + pConfigs[i].transparentBlue = 0; + pConfigs[i].transparentAlpha = 0; + pConfigs[i].transparentIndex = 0; + i++; + } + } + } + + atis->numVisualConfigs = numConfigs; + atis->pVisualConfigs = pConfigs; + atis->pVisualConfigsPriv = pATIConfigs; + GlxSetVisualConfigs(numConfigs, pConfigs, (void**)pATIConfigPtrs); + return TRUE; +} +#endif /* GLXEXT */ + +static void +ATIDRIInitGARTValues(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + ATIScreenInfo(pScreenPriv); + int s, l; + + atis->gartOffset = 0; + + /* Initialize the ring buffer data */ + atis->ringStart = atis->gartOffset; + atis->ringMapSize = atis->ringSize * 1024 * 1024 + DRM_PAGE_SIZE; + + atis->ringReadOffset = atis->ringStart + atis->ringMapSize; + atis->ringReadMapSize = DRM_PAGE_SIZE; + + /* Reserve space for vertex/indirect buffers */ + atis->bufStart = atis->ringReadOffset + atis->ringReadMapSize; + atis->bufMapSize = atis->bufSize * 1024 * 1024; + + /* Reserve the rest for GART textures */ + atis->gartTexStart = atis->bufStart + atis->bufMapSize; + s = (atis->gartSize * 1024 * 1024 - atis->gartTexStart); + l = ATILog2((s-1) / ATI_NR_TEX_REGIONS); + if (l < ATI_LOG_TEX_GRANULARITY) l = ATI_LOG_TEX_GRANULARITY; + atis->gartTexMapSize = (s >> l) << l; + atis->log2GARTTexGran = l; +} + +static int +ATIDRIAddAndMap(int fd, drmHandle offset, drmSize size, + drmMapType type, drmMapFlags flags, drmHandlePtr handle, + drmAddressPtr address, char *desc) +{ + char *name; + + name = (type == DRM_AGP) ? "agp" : "pci"; + + if (drmAddMap(fd, offset, size, type, flags, handle) < 0) { + ErrorF("[%s] Could not add %s mapping\n", name, desc); + return FALSE; + } + ErrorF("[%s] %s handle = 0x%08lx\n", name, desc, *handle); + + if (drmMap(fd, *handle, size, address) < 0) { + ErrorF("[%s] Could not map %s\n", name, desc); + return FALSE; + } + ErrorF("[%s] %s mapped at 0x%08lx\n", name, desc, *address); + + return TRUE; +} + +/* Initialize the AGP state. Request memory for use in AGP space, and + initialize the Rage 128 registers to point to that memory. */ +static Bool +ATIDRIAgpInit(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + ATIScreenInfo(pScreenPriv); + ATICardInfo(pScreenPriv); + unsigned char *mmio = atic->reg_base; + unsigned long mode; + int ret; + CARD32 cntl, chunk; + + if (drmAgpAcquire(atic->drmFd) < 0) { + ErrorF("[agp] AGP not available\n"); + return FALSE; + } + + ATIDRIInitGARTValues(pScreen); + + mode = drmAgpGetMode(atic->drmFd); + if (atic->is_radeon) { + mode &= ~RADEON_AGP_MODE_MASK; + mode |= RADEON_AGP_1X_MODE; + } else { + mode &= ~R128_AGP_MODE_MASK; + mode |= R128_AGP_1X_MODE; + } + + if (drmAgpEnable(atic->drmFd, mode) < 0) { + ErrorF("[agp] AGP not enabled\n"); + drmAgpRelease(atic->drmFd); + return FALSE; + } + ErrorF("[agp] Mode 0x%08x selected\n", drmAgpGetMode(atic->drmFd)); + + if ((ret = drmAgpAlloc(atic->drmFd, atis->gartSize * 1024 * 1024, 0, + NULL, &atis->agpMemHandle)) < 0) { + ErrorF("[agp] Out of memory (%d)\n", ret); + drmAgpRelease(atic->drmFd); + return FALSE; + } + ErrorF("[agp] %d kB allocated with handle 0x%08lx\n", + atis->gartSize * 1024, (long)atis->agpMemHandle); + + if (drmAgpBind(atic->drmFd, atis->agpMemHandle, atis->gartOffset) < 0) { + ErrorF("[agp] Could not bind\n"); + drmAgpFree(atic->drmFd, atis->agpMemHandle); + drmAgpRelease(atic->drmFd); + return FALSE; + } + + if (!ATIDRIAddAndMap(atic->drmFd, atis->ringStart, atis->ringMapSize, + DRM_AGP, DRM_READ_ONLY, &atis->ringHandle, + (drmAddressPtr)&atis->ring, "ring")) + return FALSE; + + if (!ATIDRIAddAndMap(atic->drmFd, atis->ringReadOffset, + atis->ringReadMapSize, DRM_AGP, DRM_READ_ONLY, + &atis->ringReadPtrHandle, (drmAddressPtr)&atis->ringReadPtr, + "ring read ptr")) + return FALSE; + + if (!ATIDRIAddAndMap(atic->drmFd, atis->bufStart, atis->bufMapSize, + DRM_AGP, 0, &atis->bufHandle, (drmAddressPtr)&atis->buf, + "vertex/indirect buffers")) + return FALSE; + + if (!ATIDRIAddAndMap(atic->drmFd, atis->gartTexStart, + atis->gartTexMapSize, DRM_AGP, 0, &atis->gartTexHandle, + (drmAddressPtr)&atis->gartTex, "AGP texture map")) + return FALSE; + + if (atic->is_r100) { + /* Workaround for some hardware bugs */ + cntl = MMIO_IN32(mmio, ATI_REG_AGP_CNTL); + MMIO_OUT32(mmio, ATI_REG_AGP_CNTL, cntl | + RADEON_PENDING_SLOTS_VAL | RADEON_PENDING_SLOTS_SEL); + } else if (!atic->is_radeon) { + cntl = MMIO_IN32(mmio, ATI_REG_AGP_CNTL); + cntl &= ~R128_AGP_APER_SIZE_MASK; + switch (atis->gartSize) { + case 256: cntl |= R128_AGP_APER_SIZE_256MB; break; + case 128: cntl |= R128_AGP_APER_SIZE_128MB; break; + case 64: cntl |= R128_AGP_APER_SIZE_64MB; break; + case 32: cntl |= R128_AGP_APER_SIZE_32MB; break; + case 16: cntl |= R128_AGP_APER_SIZE_16MB; break; + case 8: cntl |= R128_AGP_APER_SIZE_8MB; break; + case 4: cntl |= R128_AGP_APER_SIZE_4MB; break; + default: + ErrorF("[agp] Illegal aperture size %d kB\n", atis->gartSize * + 1024); + return FALSE; + } + MMIO_OUT32(mmio, ATI_REG_AGP_CNTL, cntl); + + /* Disable Rage 128 PCIGART registers */ + chunk = MMIO_IN32(mmio, R128_REG_BM_CHUNK_0_VAL); + chunk &= ~(R128_BM_PTR_FORCE_TO_PCI | + R128_BM_PM4_RD_FORCE_TO_PCI | + R128_BM_GLOBAL_FORCE_TO_PCI); + MMIO_OUT32(mmio, R128_REG_BM_CHUNK_0_VAL, chunk); + + /* Ensure AGP GART is used (for now) */ + MMIO_OUT32(mmio, R128_REG_PCI_GART_PAGE, 1); + } + + MMIO_OUT32(mmio, ATI_REG_AGP_BASE, drmAgpBase(atic->drmFd)); + + return TRUE; +} + +static Bool +ATIDRIPciInit(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + ATIScreenInfo(pScreenPriv); + ATICardInfo(pScreenPriv); + unsigned char *mmio = atic->reg_base; + CARD32 chunk; + int ret; + + ATIDRIInitGARTValues(pScreen); + + ret = drmScatterGatherAlloc(atic->drmFd, atis->gartSize * 1024 * 1024, + &atis->pciMemHandle); + if (ret < 0) { + ErrorF("[pci] Out of memory (%d)\n", ret); + return FALSE; + } + ErrorF("[pci] %d kB allocated with handle 0x%08lx\n", + atis->gartSize * 1024, (long)atis->pciMemHandle); + + if (!ATIDRIAddAndMap(atic->drmFd, atis->ringStart, atis->ringMapSize, + DRM_SCATTER_GATHER, DRM_READ_ONLY | DRM_LOCKED | DRM_KERNEL, + &atis->ringHandle, (drmAddressPtr)&atis->ring, "ring")) + return FALSE; + + if (!ATIDRIAddAndMap(atic->drmFd, atis->ringReadOffset, + atis->ringReadMapSize, DRM_SCATTER_GATHER, + DRM_READ_ONLY | DRM_LOCKED | DRM_KERNEL, + &atis->ringReadPtrHandle, (drmAddressPtr)&atis->ringReadPtr, + "ring read ptr")) + return FALSE; + + if (!ATIDRIAddAndMap(atic->drmFd, atis->bufStart, atis->bufMapSize, + DRM_SCATTER_GATHER, 0, &atis->bufHandle, (drmAddressPtr)&atis->buf, + "vertex/indirect buffers")) + return FALSE; + + if (!ATIDRIAddAndMap(atic->drmFd, atis->gartTexStart, + atis->gartTexMapSize, DRM_SCATTER_GATHER, 0, &atis->gartTexHandle, + (drmAddressPtr)&atis->gartTex, "PCI texture map")) + return FALSE; + + if (!atic->is_radeon) { + /* Force PCI GART mode */ + chunk = MMIO_IN32(mmio, R128_REG_BM_CHUNK_0_VAL); + chunk |= (R128_BM_PTR_FORCE_TO_PCI | + R128_BM_PM4_RD_FORCE_TO_PCI | R128_BM_GLOBAL_FORCE_TO_PCI); + MMIO_OUT32(mmio, R128_REG_BM_CHUNK_0_VAL, chunk); + /* Ensure PCI GART is used */ + MMIO_OUT32(mmio, R128_REG_PCI_GART_PAGE, 0); + } + return TRUE; +} + + +/* Initialize the kernel data structures. */ +static int +R128DRIKernelInit(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + ATIScreenInfo(pScreenPriv); + ATICardInfo(pScreenPriv); + drmR128Init drmInfo; + int bpp = pScreenPriv->screen->fb[0].bitsPerPixel; + + memset(&drmInfo, 0, sizeof(drmR128Init) ); + + drmInfo.func = DRM_R128_INIT_CCE; + drmInfo.sarea_priv_offset = sizeof(XF86DRISAREARec); + drmInfo.is_pci = !atis->using_agp; + drmInfo.cce_mode = R128_PM4_64BM_64VCBM_64INDBM; + drmInfo.cce_secure = TRUE; + drmInfo.ring_size = atis->ringSize * 1024 * 1024; + drmInfo.usec_timeout = atis->DMAusecTimeout; + + drmInfo.front_offset = atis->frontOffset; + drmInfo.front_pitch = atis->frontPitch / (bpp / 8); + drmInfo.back_offset = atis->backOffset; + drmInfo.back_pitch = atis->backPitch / (bpp / 8); + drmInfo.fb_bpp = bpp; + + drmInfo.depth_offset = atis->depthOffset; + drmInfo.depth_pitch = atis->depthPitch / (bpp / 8); + drmInfo.depth_bpp = bpp; + + drmInfo.span_offset = atis->spanOffset; + + drmInfo.fb_offset = atis->fbHandle; + drmInfo.mmio_offset = atis->registerHandle; + drmInfo.ring_offset = atis->ringHandle; + drmInfo.ring_rptr_offset = atis->ringReadPtrHandle; + drmInfo.buffers_offset = atis->bufHandle; + drmInfo.agp_textures_offset = atis->gartTexHandle; + + if (drmCommandWrite(atic->drmFd, DRM_R128_INIT, &drmInfo, + sizeof(drmR128Init)) < 0) + return FALSE; + + return TRUE; +} + +/* Initialize the kernel data structures */ +static int +RadeonDRIKernelInit(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + ATIScreenInfo(pScreenPriv); + ATICardInfo(pScreenPriv); + drmRadeonInit drmInfo; + + memset(&drmInfo, 0, sizeof(drmRadeonInit)); + + if (atic->is_r200) + drmInfo.func = DRM_RADEON_INIT_R200_CP; + else + drmInfo.func = DRM_RADEON_INIT_CP; + + drmInfo.sarea_priv_offset = sizeof(XF86DRISAREARec); + drmInfo.is_pci = !atis->using_agp; + drmInfo.cp_mode = RADEON_CSQ_PRIBM_INDBM; + drmInfo.gart_size = atis->gartSize * 1024 * 1024; + drmInfo.ring_size = atis->ringSize * 1024 * 1024; + drmInfo.usec_timeout = atis->DMAusecTimeout; + + drmInfo.front_offset = atis->frontOffset; + drmInfo.front_pitch = atis->frontPitch; + drmInfo.back_offset = atis->backOffset; + drmInfo.back_pitch = atis->backPitch; + drmInfo.fb_bpp = pScreenPriv->screen->fb[0].bitsPerPixel; + drmInfo.depth_offset = atis->depthOffset; + drmInfo.depth_pitch = atis->depthPitch; + drmInfo.depth_bpp = pScreenPriv->screen->fb[0].bitsPerPixel; + + drmInfo.fb_offset = atis->fbHandle; + drmInfo.mmio_offset = atis->registerHandle; + drmInfo.ring_offset = atis->ringHandle; + drmInfo.ring_rptr_offset = atis->ringReadPtrHandle; + drmInfo.buffers_offset = atis->bufHandle; + drmInfo.gart_textures_offset = atis->gartTexHandle; + + if (drmCommandWrite(atic->drmFd, DRM_RADEON_CP_INIT, + &drmInfo, sizeof(drmRadeonInit)) < 0) + return FALSE; + + return TRUE; +} + +/* Add a map for the vertex buffers that will be accessed by any + DRI-based clients. */ +static Bool +ATIDRIBufInit(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + ATIScreenInfo(pScreenPriv); + ATICardInfo(pScreenPriv); + int type, size; + + if (atic->is_radeon) + size = RADEON_BUFFER_SIZE; + else + size = R128_BUFFER_SIZE; + + if (atis->using_agp) + type = DRM_AGP_BUFFER; + else + type = DRM_SG_BUFFER; + + /* Initialize vertex buffers */ + atis->bufNumBufs = drmAddBufs(atic->drmFd, atis->bufMapSize / size, + size, type, atis->bufStart); + + if (atis->bufNumBufs <= 0) { + ErrorF("[drm] Could not create vertex/indirect buffers list\n"); + return FALSE; + } + ErrorF("[drm] Added %d %d byte vertex/indirect buffers\n", + atis->bufNumBufs, size); + + atis->buffers = drmMapBufs(atic->drmFd); + if (atis->buffers == NULL) { + ErrorF("[drm] Failed to map vertex/indirect buffers list\n"); + return FALSE; + } + ErrorF("[drm] Mapped %d vertex/indirect buffers\n", + atis->buffers->count); + + return TRUE; +} + +static int +ATIDRIIrqInit(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + ATIScreenInfo(pScreenPriv); + ATICardInfo(pScreenPriv); + + if (atis->irqEnabled) + return FALSE; + + atis->irqEnabled = drmCtlInstHandler(atic->drmFd, 0); + + if (!atis->irqEnabled) + return FALSE; + + return TRUE; +} + +static void ATIDRISwapContext(ScreenPtr pScreen, DRISyncType syncType, + DRIContextType oldContextType, void *oldContext, + DRIContextType newContextType, void *newContext) +{ + KdScreenPriv(pScreen); + ATIScreenInfo(pScreenPriv); + + if ((syncType==DRI_3D_SYNC) && (oldContextType==DRI_2D_CONTEXT) && + (newContextType==DRI_2D_CONTEXT)) { + /* Entering from Wakeup */ + kaaMarkSync(pScreen); + } + if ((syncType==DRI_2D_SYNC) && (oldContextType==DRI_NO_CONTEXT) && + (newContextType==DRI_2D_CONTEXT)) { + /* Exiting from Block Handler */ + if (atis->dma_started) + ATIFlushIndirect(atis, 1); + } +} + +static Bool ATIDRIFinishScreenInit(ScreenPtr pScreen); + +/* Initialize the screen-specific data structures for the Radeon or + Rage 128. This is the main entry point to the device-specific + initialization code. It calls device-independent DRI functions to + create the DRI data structures and initialize the DRI state. */ +Bool +ATIDRIScreenInit(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + ATIScreenInfo(pScreenPriv); + ATICardInfo(pScreenPriv); + void *scratch_ptr; + int scratch_int; + DRIInfoPtr pDRIInfo; + int devSareaSize; + drmSetVersion sv; + + if (pScreenPriv->screen->fb[0].depth < 16 || + pScreenPriv->screen->fb[0].bitsPerPixel == 24) { + ErrorF("DRI unsupported at this depth/bpp, disabling.\n"); + return FALSE; + } + + atis->agpMode = 1; + atis->gartSize = 8; + atis->ringSize = 1; + atis->bufSize = 2; + atis->gartTexSize = 1; + atis->DMAusecTimeout = 10000; + + if (atic->drmFd < 0) + return FALSE; + + sv.drm_di_major = -1; + sv.drm_dd_major = -1; + drmSetInterfaceVersion(atic->drmFd, &sv); + if (atic->is_radeon) { + if (sv.drm_dd_major != 1 || sv.drm_dd_minor < 6) { + ErrorF("[dri] radeon kernel module version is %d.%d " + "but version 1.6 or greater is needed.\n", + sv.drm_dd_major, sv.drm_dd_minor); + return FALSE; + } + } else { + if (sv.drm_dd_major != 2 || sv.drm_dd_minor < 2) { + ErrorF("[dri] r128 kernel module version is %d.%d " + "but version 2.2 or greater is needed.\n", + sv.drm_dd_major, sv.drm_dd_minor); + return FALSE; + } + } + + /* Create the DRI data structure, and fill it in before calling the + * DRIScreenInit(). + */ + pDRIInfo = DRICreateInfoRec(); + if (pDRIInfo == NULL) + return FALSE; + + atis->pDRIInfo = pDRIInfo; + pDRIInfo->busIdString = atic->busid; + if (atic->is_radeon) { + pDRIInfo->drmDriverName = "radeon"; + if (atic->is_r100) + pDRIInfo->clientDriverName = "radeon"; + else + pDRIInfo->clientDriverName = "r200"; + } else { + pDRIInfo->drmDriverName = "r128"; + pDRIInfo->clientDriverName = "r128"; + } + pDRIInfo->ddxDriverMajorVersion = 4; + pDRIInfo->ddxDriverMinorVersion = 0; + pDRIInfo->ddxDriverPatchVersion = 0; + pDRIInfo->frameBufferPhysicalAddress = + pScreenPriv->card->attr.address[0] & 0xfc000000; + pDRIInfo->frameBufferSize = pScreenPriv->screen->memory_size; + pDRIInfo->frameBufferStride = pScreenPriv->screen->fb[0].byteStride; + pDRIInfo->ddxDrawableTableEntry = SAREA_MAX_DRAWABLES; + pDRIInfo->maxDrawableTableEntry = SAREA_MAX_DRAWABLES; + + /* For now the mapping works by using a fixed size defined + * in the SAREA header + */ + pDRIInfo->SAREASize = SAREA_MAX; + + if (atic->is_radeon) { + pDRIInfo->devPrivateSize = sizeof(RADEONDRIRec); + devSareaSize = sizeof(RADEONSAREAPriv); + } else { + pDRIInfo->devPrivateSize = sizeof(R128DRIRec); + devSareaSize = sizeof(R128SAREAPriv); + } + + if (sizeof(XF86DRISAREARec) + devSareaSize > SAREA_MAX) { + ErrorF("[dri] Data does not fit in SAREA. Disabling DRI.\n"); + return FALSE; + } + + pDRIInfo->devPrivate = xcalloc(pDRIInfo->devPrivateSize, 1); + if (pDRIInfo->devPrivate == NULL) { + DRIDestroyInfoRec(atis->pDRIInfo); + atis->pDRIInfo = NULL; + return FALSE; + } + + pDRIInfo->contextSize = sizeof(ATIDRIContextRec); + + pDRIInfo->SwapContext = ATIDRISwapContext; + /*pDRIInfo->InitBuffers = R128DRIInitBuffers;*/ /* XXX Appears unnecessary */ + /*pDRIInfo->MoveBuffers = R128DRIMoveBuffers;*/ /* XXX Badness */ + pDRIInfo->bufferRequests = DRI_ALL_WINDOWS; + /*pDRIInfo->TransitionTo2d = R128DRITransitionTo2d; + pDRIInfo->TransitionTo3d = R128DRITransitionTo3d; + pDRIInfo->TransitionSingleToMulti3D = R128DRITransitionSingleToMulti3d; + pDRIInfo->TransitionMultiToSingle3D = R128DRITransitionMultiToSingle3d;*/ + + pDRIInfo->createDummyCtx = TRUE; + pDRIInfo->createDummyCtxPriv = FALSE; + + if (!DRIScreenInit(pScreen, pDRIInfo, &atic->drmFd)) { + ErrorF("[dri] DRIScreenInit failed. Disabling DRI.\n"); + xfree(pDRIInfo->devPrivate); + pDRIInfo->devPrivate = NULL; + DRIDestroyInfoRec(pDRIInfo); + pDRIInfo = NULL; + return FALSE; + } + + /* Add a map for the MMIO registers that will be accessed by any + * DRI-based clients. + */ + atis->registerSize = ATI_REG_SIZE(pScreenPriv->screen->card); + if (drmAddMap(atic->drmFd, ATI_REG_BASE(pScreenPriv->screen->card), + atis->registerSize, DRM_REGISTERS, DRM_READ_ONLY, + &atis->registerHandle) < 0) { + ATIDRICloseScreen(pScreen); + return FALSE; + } + ErrorF("[drm] register handle = 0x%08lx\n", atis->registerHandle); + + /* DRIScreenInit adds the frame buffer map, but we need it as well */ + DRIGetDeviceInfo(pScreen, &atis->fbHandle, &scratch_int, &scratch_int, + &scratch_int, &scratch_int, &scratch_ptr); + + /* Initialize AGP */ + atis->using_agp = atic->is_agp; + if (atic->is_agp && !ATIDRIAgpInit(pScreen)) { + atis->using_agp = FALSE; + ErrorF("[agp] AGP failed to initialize; falling back to PCI mode.\n"); + ErrorF("[agp] Make sure your kernel's AGP support is loaded and functioning.\n"); + } + + /* Initialize PCIGART */ + if (!atis->using_agp && !ATIDRIPciInit(pScreen)) { + ATIDRICloseScreen(pScreen); + return FALSE; + } + +#ifdef GLXEXT + if (!ATIInitVisualConfigs(pScreen)) { + ATIDRICloseScreen(pScreen); + return FALSE; + } + ErrorF("[dri] Visual configs initialized\n"); +#endif + + atis->serverContext = DRIGetContext(pScreen); + + return ATIDRIFinishScreenInit(pScreen); +} + +/* Finish initializing the device-dependent DRI state, and call + DRIFinishScreenInit() to complete the device-independent DRI + initialization. */ +static Bool +R128DRIFinishScreenInit(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + ATIScreenInfo(pScreenPriv); + R128SAREAPrivPtr pSAREAPriv; + R128DRIPtr pR128DRI; + int bpp = pScreenPriv->screen->fb[0].bitsPerPixel; + + /* Initialize the kernel data structures */ + if (!R128DRIKernelInit(pScreen)) { + ATIDRICloseScreen(pScreen); + return FALSE; + } + + /* Initialize the vertex buffers list */ + if (!ATIDRIBufInit(pScreen)) { + ATIDRICloseScreen(pScreen); + return FALSE; + } + + /* Initialize IRQ */ + ATIDRIIrqInit(pScreen); + + pSAREAPriv = (R128SAREAPrivPtr)DRIGetSAREAPrivate(pScreen); + memset(pSAREAPriv, 0, sizeof(*pSAREAPriv)); + + pR128DRI = (R128DRIPtr)atis->pDRIInfo->devPrivate; + + pR128DRI->deviceID = pScreenPriv->screen->card->attr.deviceID; + pR128DRI->width = pScreenPriv->screen->width; + pR128DRI->height = pScreenPriv->screen->height; + pR128DRI->depth = pScreenPriv->screen->fb[0].depth; + pR128DRI->bpp = pScreenPriv->screen->fb[0].bitsPerPixel; + + pR128DRI->IsPCI = !atis->using_agp; + pR128DRI->AGPMode = atis->agpMode; + + pR128DRI->frontOffset = atis->frontOffset; + pR128DRI->frontPitch = atis->frontPitch / (bpp / 8); + pR128DRI->backOffset = atis->backOffset; + pR128DRI->backPitch = atis->backPitch / (bpp / 8); + pR128DRI->depthOffset = atis->depthOffset; + pR128DRI->depthPitch = atis->depthPitch / (bpp / 8); + pR128DRI->spanOffset = atis->spanOffset; + pR128DRI->textureOffset = atis->textureOffset; + pR128DRI->textureSize = atis->textureSize; + pR128DRI->log2TexGran = atis->log2TexGran; + + pR128DRI->registerHandle = atis->registerHandle; + pR128DRI->registerSize = atis->registerSize; + + pR128DRI->gartTexHandle = atis->gartTexHandle; + pR128DRI->gartTexMapSize = atis->gartTexMapSize; + pR128DRI->log2AGPTexGran = atis->log2GARTTexGran; + pR128DRI->gartTexOffset = atis->gartTexStart; + pR128DRI->sarea_priv_offset = sizeof(XF86DRISAREARec); + + return TRUE; +} + +/* Finish initializing the device-dependent DRI state, and call + * DRIFinishScreenInit() to complete the device-independent DRI + * initialization. + */ +static Bool +RadeonDRIFinishScreenInit(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + ATIScreenInfo(pScreenPriv); + ATICardInfo(pScreenPriv); + RADEONSAREAPrivPtr pSAREAPriv; + RADEONDRIPtr pRADEONDRI; + drmRadeonMemInitHeap drmHeap; + + /* Initialize the kernel data structures */ + if (!RadeonDRIKernelInit(pScreen)) { + ATIDRICloseScreen(pScreen); + return FALSE; + } + + /* Initialize the vertex buffers list */ + if (!ATIDRIBufInit(pScreen)) { + ATIDRICloseScreen(pScreen); + return FALSE; + } + + /* Initialize IRQ */ + ATIDRIIrqInit(pScreen); + + drmHeap.region = RADEON_MEM_REGION_GART; + drmHeap.start = 0; + drmHeap.size = atis->gartTexMapSize; + + if (drmCommandWrite(atic->drmFd, DRM_RADEON_INIT_HEAP, &drmHeap, + sizeof(drmHeap))) { + ErrorF("[drm] Failed to initialize GART heap manager\n"); + } + + /* Initialize the SAREA private data structure */ + pSAREAPriv = (RADEONSAREAPrivPtr)DRIGetSAREAPrivate(pScreen); + memset(pSAREAPriv, 0, sizeof(*pSAREAPriv)); + + pRADEONDRI = (RADEONDRIPtr)atis->pDRIInfo->devPrivate; + + pRADEONDRI->deviceID = pScreenPriv->screen->card->attr.deviceID; + pRADEONDRI->width = pScreenPriv->screen->width; + pRADEONDRI->height = pScreenPriv->screen->height; + pRADEONDRI->depth = pScreenPriv->screen->fb[0].depth; + pRADEONDRI->bpp = pScreenPriv->screen->fb[0].bitsPerPixel; + + pRADEONDRI->IsPCI = !atis->using_agp; + pRADEONDRI->AGPMode = atis->agpMode; + + pRADEONDRI->frontOffset = atis->frontOffset; + pRADEONDRI->frontPitch = atis->frontPitch; + pRADEONDRI->backOffset = atis->backOffset; + pRADEONDRI->backPitch = atis->backPitch; + pRADEONDRI->depthOffset = atis->depthOffset; + pRADEONDRI->depthPitch = atis->depthPitch; + pRADEONDRI->textureOffset = atis->textureOffset; + pRADEONDRI->textureSize = atis->textureSize; + pRADEONDRI->log2TexGran = atis->log2TexGran; + + pRADEONDRI->registerHandle = atis->registerHandle; + pRADEONDRI->registerSize = atis->registerSize; + + pRADEONDRI->statusHandle = atis->ringReadPtrHandle; + pRADEONDRI->statusSize = atis->ringReadMapSize; + + pRADEONDRI->gartTexHandle = atis->gartTexHandle; + pRADEONDRI->gartTexMapSize = atis->gartTexMapSize; + pRADEONDRI->log2GARTTexGran = atis->log2GARTTexGran; + pRADEONDRI->gartTexOffset = atis->gartTexStart; + + pRADEONDRI->sarea_priv_offset = sizeof(XF86DRISAREARec); + + return TRUE; +} + +static Bool +ATIDRIFinishScreenInit(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + ATIScreenInfo(pScreenPriv); + ATICardInfo (pScreenPriv); + + atis->pDRIInfo->driverSwapMethod = DRI_HIDE_X_CONTEXT; + + /* NOTE: DRIFinishScreenInit must be called before *DRIKernelInit + * because *DRIKernelInit requires that the hardware lock is held by + * the X server, and the first time the hardware lock is grabbed is + * in DRIFinishScreenInit. + */ + if (!DRIFinishScreenInit(pScreen)) { + ATIDRICloseScreen(pScreen); + return FALSE; + } + + if (atic->is_radeon) { + if (!RadeonDRIFinishScreenInit(pScreen)) { + ATIDRICloseScreen(pScreen); + return FALSE; + } + } else { + if (!R128DRIFinishScreenInit(pScreen)) { + ATIDRICloseScreen(pScreen); + return FALSE; + } + } + + return TRUE; +} + +/* The screen is being closed, so clean up any state and free any + resources used by the DRI. */ +void +ATIDRICloseScreen(ScreenPtr pScreen) +{ + KdScreenPriv (pScreen); + ATIScreenInfo (pScreenPriv); + ATICardInfo (pScreenPriv); + drmR128Init drmR128Info; + drmRadeonInit drmRadeonInfo; + + if (atis->indirectBuffer != NULL) { + /* Flush any remaining commands and free indirect buffers. + * Two steps are used because ATIFlushIndirect gets a + * new buffer after discarding. + */ + ATIFlushIndirect(atis, 1); + ATIDRIDispatchIndirect(atis, 1); + xfree(atis->indirectBuffer); + atis->indirectBuffer = NULL; + atis->indirectStart = 0; + } + ATIDRIDMAStop(atis); + + if (atis->irqEnabled) { + drmCtlUninstHandler(atic->drmFd); + atis->irqEnabled = FALSE; + } + + /* De-allocate vertex buffers */ + if (atis->buffers) { + drmUnmapBufs(atis->buffers); + atis->buffers = NULL; + } + + /* De-allocate all kernel resources */ + if (!atic->is_radeon) { + memset(&drmR128Info, 0, sizeof(drmR128Init)); + drmR128Info.func = DRM_R128_CLEANUP_CCE; + drmCommandWrite(atic->drmFd, DRM_R128_INIT, &drmR128Info, + sizeof(drmR128Init)); + } else { + memset(&drmRadeonInfo, 0, sizeof(drmRadeonInfo)); + drmRadeonInfo.func = DRM_RADEON_CLEANUP_CP; + drmCommandWrite(atic->drmFd, DRM_RADEON_CP_INIT, &drmRadeonInfo, + sizeof(drmR128Init)); + } + + /* De-allocate all AGP resources */ + if (atis->gartTex) { + drmUnmap(atis->gartTex, atis->gartTexMapSize); + atis->gartTex = NULL; + } + if (atis->buf) { + drmUnmap(atis->buf, atis->bufMapSize); + atis->buf = NULL; + } + if (atis->ringReadPtr) { + drmUnmap(atis->ringReadPtr, atis->ringReadMapSize); + atis->ringReadPtr = NULL; + } + if (atis->ring) { + drmUnmap(atis->ring, atis->ringMapSize); + atis->ring = NULL; + } + if (atis->agpMemHandle != DRM_AGP_NO_HANDLE) { + drmAgpUnbind(atic->drmFd, atis->agpMemHandle); + drmAgpFree(atic->drmFd, atis->agpMemHandle); + atis->agpMemHandle = DRM_AGP_NO_HANDLE; + drmAgpRelease(atic->drmFd); + } + if (atis->pciMemHandle) { + drmScatterGatherFree(atic->drmFd, atis->pciMemHandle); + atis->pciMemHandle = 0; + } + + /* De-allocate all DRI resources */ + DRICloseScreen(pScreen); + + /* De-allocate all DRI data structures */ + if (atis->pDRIInfo) { + if (atis->pDRIInfo->devPrivate) { + xfree(atis->pDRIInfo->devPrivate); + atis->pDRIInfo->devPrivate = NULL; + } + DRIDestroyInfoRec(atis->pDRIInfo); + atis->pDRIInfo = NULL; + } + +#ifdef GLXEXT + if (atis->pVisualConfigs) { + xfree(atis->pVisualConfigs); + atis->pVisualConfigs = NULL; + } + if (atis->pVisualConfigsPriv) { + xfree(atis->pVisualConfigsPriv); + atis->pVisualConfigsPriv = NULL; + } +#endif /* GLXEXT */ + atic->drmFd = -1; +} + +void +ATIDRIDMAStart(ATIScreenInfo *atis) +{ + ATICardInfo *atic = atis->atic; + int ret; + + if (atic->is_radeon) + ret = drmCommandNone(atic->drmFd, DRM_RADEON_CP_START); + else + ret = drmCommandNone(atic->drmFd, DRM_R128_CCE_START); + + if (ret == 0) + atis->dma_started = TRUE; + else + FatalError("%s: DMA start returned %d\n", __FUNCTION__, ret); +} + +/* Attempts to idle the DMA engine and stops it. Note that the ioctl is the + * same for both R128 and Radeon, so we can just use the name of one of them. + */ +void +ATIDRIDMAStop(ATIScreenInfo *atis) +{ + ATICardInfo *atic = atis->atic; + drmRadeonCPStop stop; + int ret; + + stop.flush = 1; + stop.idle = 1; + ret = drmCommandWrite(atic->drmFd, DRM_RADEON_CP_STOP, &stop, + sizeof(drmRadeonCPStop)); + + if (ret != 0 && errno == EBUSY) { + ErrorF("Failed to idle the DMA engine\n"); + + stop.idle = 0; + ret = drmCommandWrite(atic->drmFd, DRM_RADEON_CP_STOP, &stop, + sizeof(drmRadeonCPStop)); + } + atis->dma_started = FALSE; +} + +void +ATIDRIDMAReset(ATIScreenInfo *atis) +{ + ATICardInfo *atic = atis->atic; + int ret; + + ret = drmCommandNone(atic->drmFd, atic->is_radeon ? + DRM_RADEON_CP_RESET : DRM_R128_CCE_RESET); + + if (ret != 0) + FatalError("Failed to reset CCE/CP\n"); + + atis->dma_started = FALSE; +} + +/* The R128 and Radeon Indirect ioctls differ only in the ioctl number */ +void +ATIDRIDispatchIndirect(ATIScreenInfo *atis, Bool discard) +{ + ATICardInfo *atic = atis->atic; + drmBufPtr buffer = atis->indirectBuffer->drmBuf; + drmR128Indirect indirect; + int cmd; + + indirect.idx = buffer->idx; + indirect.start = atis->indirectStart; + indirect.end = buffer->used; + indirect.discard = discard; + cmd = atic->is_radeon ? DRM_RADEON_INDIRECT : DRM_R128_INDIRECT; + drmCommandWriteRead(atic->drmFd, cmd, &indirect, + sizeof(drmR128Indirect)); +} + +/* Get an indirect buffer for the DMA 2D acceleration commands */ +drmBufPtr +ATIDRIGetBuffer(ATIScreenInfo *atis) +{ + ATICardInfo *atic = atis->atic; + drmDMAReq dma; + drmBufPtr buf = NULL; + int indx = 0, size = 0, ret = 0; + TIMEOUT_LOCALS; + + dma.context = atis->serverContext; + dma.send_count = 0; + dma.send_list = NULL; + dma.send_sizes = NULL; + dma.flags = 0; + dma.request_count = 1; + if (atic->is_radeon) + dma.request_size = RADEON_BUFFER_SIZE; + else + dma.request_size = R128_BUFFER_SIZE; + dma.request_list = &indx; + dma.request_sizes = &size; + dma.granted_count = 0; + + WHILE_NOT_TIMEOUT(.2) { + ret = drmDMA(atic->drmFd, &dma); + if (ret != -EBUSY) + break; + } + if (TIMEDOUT()) + FatalError("Timeout fetching DMA buffer (card hung)\n"); + if (ret != 0) + FatalError("Error fetching DMA buffer: %d\n", ret); + + buf = &atis->buffers->list[indx]; + buf->used = 0; + return buf; +} --- xorg-server-1.4.2.orig/hw/kdrive/ati/r128_common.h +++ xorg-server-1.4.2/hw/kdrive/ati/r128_common.h @@ -0,0 +1,170 @@ +/* r128_common.h -- common header definitions for R128 2D/3D/DRM suite + * Created: Sun Apr 9 18:16:28 2000 by kevin@precisioninsight.com + * + * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2002 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 + * 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. + * + * Author: + * Gareth Hughes + * Kevin E. Martin + * + * Converted to common header format: + * Jens Owen + * + * + */ + +#ifndef _R128_COMMON_H_ +#define _R128_COMMON_H_ + +#include "X11/Xmd.h" + +/* + * WARNING: If you change any of these defines, make sure to change + * the kernel include file as well (r128_drm.h) + */ + +/* Driver specific DRM command indices + * NOTE: these are not OS specific, but they are driver specific + */ +#define DRM_R128_INIT 0x00 +#define DRM_R128_CCE_START 0x01 +#define DRM_R128_CCE_STOP 0x02 +#define DRM_R128_CCE_RESET 0x03 +#define DRM_R128_CCE_IDLE 0x04 +#define DRM_R128_UNDEFINED1 0x05 +#define DRM_R128_RESET 0x06 +#define DRM_R128_SWAP 0x07 +#define DRM_R128_CLEAR 0x08 +#define DRM_R128_VERTEX 0x09 +#define DRM_R128_INDICES 0x0a +#define DRM_R128_BLIT 0x0b +#define DRM_R128_DEPTH 0x0c +#define DRM_R128_STIPPLE 0x0d +#define DRM_R128_UNDEFINED2 0x0e +#define DRM_R128_INDIRECT 0x0f +#define DRM_R128_FULLSCREEN 0x10 +#define DRM_R128_CLEAR2 0x11 +#define DRM_R128_GETPARAM 0x12 +#define DRM_R128_FLIP 0x13 + +#define DRM_R128_FRONT_BUFFER 0x1 +#define DRM_R128_BACK_BUFFER 0x2 +#define DRM_R128_DEPTH_BUFFER 0x4 + +typedef struct { + enum { + DRM_R128_INIT_CCE = 0x01, + DRM_R128_CLEANUP_CCE = 0x02 + } func; + unsigned long sarea_priv_offset; + int is_pci; + int cce_mode; + int cce_secure; /* FIXME: Deprecated, we should remove this */ + int ring_size; + int usec_timeout; + + unsigned int fb_bpp; + unsigned int front_offset, front_pitch; + unsigned int back_offset, back_pitch; + unsigned int depth_bpp; + unsigned int depth_offset, depth_pitch; + unsigned int span_offset; + + unsigned long fb_offset; + unsigned long mmio_offset; + unsigned long ring_offset; + unsigned long ring_rptr_offset; + unsigned long buffers_offset; + unsigned long agp_textures_offset; +} drmR128Init; + +typedef struct { + int flush; + int idle; +} drmR128CCEStop; + +typedef struct { + int idx; + int start; + int end; + int discard; +} drmR128Indirect; + +typedef struct { + int idx; + int pitch; + int offset; + int format; + unsigned short x, y; + unsigned short width, height; +} drmR128Blit; + +typedef struct { + enum { + DRM_R128_WRITE_SPAN = 0x01, + DRM_R128_WRITE_PIXELS = 0x02, + DRM_R128_READ_SPAN = 0x03, + DRM_R128_READ_PIXELS = 0x04 + } func; + int n; + int *x; + int *y; + unsigned int *buffer; + unsigned char *mask; +} drmR128Depth; + +typedef struct { + int prim; + int idx; /* Index of vertex buffer */ + int count; /* Number of vertices in buffer */ + int discard; /* Client finished with buffer? */ +} drmR128Vertex; + +typedef struct { + unsigned int *mask; +} drmR128Stipple; + +typedef struct { + unsigned int flags; + unsigned int clear_color; + unsigned int clear_depth; + unsigned int color_mask; + unsigned int depth_mask; +} drmR128Clear; + +typedef struct { + enum { + DRM_R128_INIT_FULLSCREEN = 0x01, + DRM_R128_CLEANUP_FULLSCREEN = 0x02 + } func; +} drmR128Fullscreen; + +typedef struct drm_r128_getparam { + int param; + int *value; +} drmR128GetParam; + +#define R128_PARAM_IRQ_NR 1 + +#endif --- xorg-server-1.4.2.orig/hw/kdrive/ati/radeon_common.h +++ xorg-server-1.4.2/hw/kdrive/ati/radeon_common.h @@ -0,0 +1,460 @@ +/* radeon_common.h -- common header definitions for Radeon 2D/3D/DRM suite + * + * Copyright 2000 VA Linux Systems, Inc., Fremont, California. + * Copyright 2002 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 + * 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. + * + * Author: + * Gareth Hughes + * Kevin E. Martin + * Keith Whitwell + * + * Converted to common header format: + * Jens Owen + * + * + */ + +#ifndef _RADEON_COMMON_H_ +#define _RADEON_COMMON_H_ + +#include + +/* WARNING: If you change any of these defines, make sure to change + * the kernel include file as well (radeon_drm.h) + */ + +/* Driver specific DRM command indices + * NOTE: these are not OS specific, but they are driver specific + */ +#define DRM_RADEON_CP_INIT 0x00 +#define DRM_RADEON_CP_START 0x01 +#define DRM_RADEON_CP_STOP 0x02 +#define DRM_RADEON_CP_RESET 0x03 +#define DRM_RADEON_CP_IDLE 0x04 +#define DRM_RADEON_RESET 0x05 +#define DRM_RADEON_FULLSCREEN 0x06 +#define DRM_RADEON_SWAP 0x07 +#define DRM_RADEON_CLEAR 0x08 +#define DRM_RADEON_VERTEX 0x09 +#define DRM_RADEON_INDICES 0x0a +#define DRM_RADEON_STIPPLE 0x0c +#define DRM_RADEON_INDIRECT 0x0d +#define DRM_RADEON_TEXTURE 0x0e +#define DRM_RADEON_VERTEX2 0x0f +#define DRM_RADEON_CMDBUF 0x10 +#define DRM_RADEON_GETPARAM 0x11 +#define DRM_RADEON_FLIP 0x12 +#define DRM_RADEON_ALLOC 0x13 +#define DRM_RADEON_FREE 0x14 +#define DRM_RADEON_INIT_HEAP 0x15 +#define DRM_RADEON_IRQ_EMIT 0x16 +#define DRM_RADEON_IRQ_WAIT 0x17 +#define DRM_RADEON_CP_RESUME 0x18 +#define DRM_RADEON_SETPARAM 0x19 +#define DRM_RADEON_MAX_DRM_COMMAND_INDEX 0x39 + + +#define RADEON_FRONT 0x1 +#define RADEON_BACK 0x2 +#define RADEON_DEPTH 0x4 +#define RADEON_STENCIL 0x8 + +#define RADEON_CLEAR_X1 0 +#define RADEON_CLEAR_Y1 1 +#define RADEON_CLEAR_X2 2 +#define RADEON_CLEAR_Y2 3 +#define RADEON_CLEAR_DEPTH 4 + + +typedef struct { + enum { + DRM_RADEON_INIT_CP = 0x01, + DRM_RADEON_CLEANUP_CP = 0x02, + DRM_RADEON_INIT_R200_CP = 0x03 + } func; + unsigned long sarea_priv_offset; + int is_pci; + int cp_mode; + int gart_size; + int ring_size; + int usec_timeout; + + unsigned int fb_bpp; + unsigned int front_offset, front_pitch; + unsigned int back_offset, back_pitch; + unsigned int depth_bpp; + unsigned int depth_offset, depth_pitch; + + unsigned long fb_offset; + unsigned long mmio_offset; + unsigned long ring_offset; + unsigned long ring_rptr_offset; + unsigned long buffers_offset; + unsigned long gart_textures_offset; +} drmRadeonInit; + +typedef struct { + int flush; + int idle; +} drmRadeonCPStop; + +typedef struct { + int idx; + int start; + int end; + int discard; +} drmRadeonIndirect; + +typedef union drmRadeonClearR { + float f[5]; + unsigned int ui[5]; +} drmRadeonClearRect; + +typedef struct drmRadeonClearT { + unsigned int flags; + unsigned int clear_color; + unsigned int clear_depth; + unsigned int color_mask; + unsigned int depth_mask; /* misnamed field: should be stencil */ + drmRadeonClearRect *depth_boxes; +} drmRadeonClearType; + +typedef struct drmRadeonFullscreenT { + enum { + RADEON_INIT_FULLSCREEN = 0x01, + RADEON_CLEANUP_FULLSCREEN = 0x02 + } func; +} drmRadeonFullscreenType; + +typedef struct { + unsigned int *mask; +} drmRadeonStipple; + +typedef struct { + unsigned int x; + unsigned int y; + unsigned int width; + unsigned int height; + const void *data; +} drmRadeonTexImage; + +typedef struct { + unsigned int offset; + int pitch; + int format; + int width; /* Texture image coordinates */ + int height; + drmRadeonTexImage *image; +} drmRadeonTexture; + + +#define RADEON_MAX_TEXTURE_UNITS 3 + +/* Layout matches drm_radeon_state_t in linux drm_radeon.h. + */ +typedef struct { + struct { + unsigned int pp_misc; /* 0x1c14 */ + unsigned int pp_fog_color; + unsigned int re_solid_color; + unsigned int rb3d_blendcntl; + unsigned int rb3d_depthoffset; + unsigned int rb3d_depthpitch; + unsigned int rb3d_zstencilcntl; + unsigned int pp_cntl; /* 0x1c38 */ + unsigned int rb3d_cntl; + unsigned int rb3d_coloroffset; + unsigned int re_width_height; + unsigned int rb3d_colorpitch; + } context; + struct { + unsigned int se_cntl; + } setup1; + struct { + unsigned int se_coord_fmt; /* 0x1c50 */ + } vertex; + struct { + unsigned int re_line_pattern; /* 0x1cd0 */ + unsigned int re_line_state; + unsigned int se_line_width; /* 0x1db8 */ + } line; + struct { + unsigned int pp_lum_matrix; /* 0x1d00 */ + unsigned int pp_rot_matrix_0; /* 0x1d58 */ + unsigned int pp_rot_matrix_1; + } bumpmap; + struct { + unsigned int rb3d_stencilrefmask; /* 0x1d7c */ + unsigned int rb3d_ropcntl; + unsigned int rb3d_planemask; + } mask; + struct { + unsigned int se_vport_xscale; /* 0x1d98 */ + unsigned int se_vport_xoffset; + unsigned int se_vport_yscale; + unsigned int se_vport_yoffset; + unsigned int se_vport_zscale; + unsigned int se_vport_zoffset; + } viewport; + struct { + unsigned int se_cntl_status; /* 0x2140 */ + } setup2; + struct { + unsigned int re_top_left; /*ignored*/ /* 0x26c0 */ + unsigned int re_misc; + } misc; + struct { + unsigned int pp_txfilter; + unsigned int pp_txformat; + unsigned int pp_txoffset; + unsigned int pp_txcblend; + unsigned int pp_txablend; + unsigned int pp_tfactor; + unsigned int pp_border_color; + } texture[RADEON_MAX_TEXTURE_UNITS]; + struct { + unsigned int se_zbias_factor; + unsigned int se_zbias_constant; + } zbias; + unsigned int dirty; +} drmRadeonState; + +/* 1.1 vertex ioctl. Used in compatibility modes. + */ +typedef struct { + int prim; + int idx; /* Index of vertex buffer */ + int count; /* Number of vertices in buffer */ + int discard; /* Client finished with buffer? */ +} drmRadeonVertex; + +typedef struct { + unsigned int start; + unsigned int finish; + unsigned int prim:8; + unsigned int stateidx:8; + unsigned int numverts:16; /* overloaded as offset/64 for elt prims */ + unsigned int vc_format; +} drmRadeonPrim; + +typedef struct { + int idx; /* Index of vertex buffer */ + int discard; /* Client finished with buffer? */ + int nr_states; + drmRadeonState *state; + int nr_prims; + drmRadeonPrim *prim; +} drmRadeonVertex2; + +#define RADEON_MAX_STATES 16 +#define RADEON_MAX_PRIMS 64 + +/* Command buffer. Replace with true dma stream? + */ +typedef struct { + int bufsz; + char *buf; + int nbox; + drmClipRect *boxes; +} drmRadeonCmdBuffer; + +/* New style per-packet identifiers for use in cmd_buffer ioctl with + * the RADEON_EMIT_PACKET command. Comments relate new packets to old + * state bits and the packet size: + */ +#define RADEON_EMIT_PP_MISC 0 /* context/7 */ +#define RADEON_EMIT_PP_CNTL 1 /* context/3 */ +#define RADEON_EMIT_RB3D_COLORPITCH 2 /* context/1 */ +#define RADEON_EMIT_RE_LINE_PATTERN 3 /* line/2 */ +#define RADEON_EMIT_SE_LINE_WIDTH 4 /* line/1 */ +#define RADEON_EMIT_PP_LUM_MATRIX 5 /* bumpmap/1 */ +#define RADEON_EMIT_PP_ROT_MATRIX_0 6 /* bumpmap/2 */ +#define RADEON_EMIT_RB3D_STENCILREFMASK 7 /* masks/3 */ +#define RADEON_EMIT_SE_VPORT_XSCALE 8 /* viewport/6 */ +#define RADEON_EMIT_SE_CNTL 9 /* setup/2 */ +#define RADEON_EMIT_SE_CNTL_STATUS 10 /* setup/1 */ +#define RADEON_EMIT_RE_MISC 11 /* misc/1 */ +#define RADEON_EMIT_PP_TXFILTER_0 12 /* tex0/6 */ +#define RADEON_EMIT_PP_BORDER_COLOR_0 13 /* tex0/1 */ +#define RADEON_EMIT_PP_TXFILTER_1 14 /* tex1/6 */ +#define RADEON_EMIT_PP_BORDER_COLOR_1 15 /* tex1/1 */ +#define RADEON_EMIT_PP_TXFILTER_2 16 /* tex2/6 */ +#define RADEON_EMIT_PP_BORDER_COLOR_2 17 /* tex2/1 */ +#define RADEON_EMIT_SE_ZBIAS_FACTOR 18 /* zbias/2 */ +#define RADEON_EMIT_SE_TCL_OUTPUT_VTX_FMT 19 /* tcl/11 */ +#define RADEON_EMIT_SE_TCL_MATERIAL_EMMISSIVE_RED 20 /* material/17 */ +#define R200_EMIT_PP_TXCBLEND_0 21 /* tex0/4 */ +#define R200_EMIT_PP_TXCBLEND_1 22 /* tex1/4 */ +#define R200_EMIT_PP_TXCBLEND_2 23 /* tex2/4 */ +#define R200_EMIT_PP_TXCBLEND_3 24 /* tex3/4 */ +#define R200_EMIT_PP_TXCBLEND_4 25 /* tex4/4 */ +#define R200_EMIT_PP_TXCBLEND_5 26 /* tex5/4 */ +#define R200_EMIT_PP_TXCBLEND_6 27 /* /4 */ +#define R200_EMIT_PP_TXCBLEND_7 28 /* /4 */ +#define R200_EMIT_TCL_LIGHT_MODEL_CTL_0 29 /* tcl/6 */ +#define R200_EMIT_TFACTOR_0 30 /* tf/6 */ +#define R200_EMIT_VTX_FMT_0 31 /* vtx/4 */ +#define R200_EMIT_VAP_CTL 32 /* vap/1 */ +#define R200_EMIT_MATRIX_SELECT_0 33 /* msl/5 */ +#define R200_EMIT_TEX_PROC_CTL_2 34 /* tcg/5 */ +#define R200_EMIT_TCL_UCP_VERT_BLEND_CTL 35 /* tcl/1 */ +#define R200_EMIT_PP_TXFILTER_0 36 /* tex0/6 */ +#define R200_EMIT_PP_TXFILTER_1 37 /* tex1/6 */ +#define R200_EMIT_PP_TXFILTER_2 38 /* tex2/6 */ +#define R200_EMIT_PP_TXFILTER_3 39 /* tex3/6 */ +#define R200_EMIT_PP_TXFILTER_4 40 /* tex4/6 */ +#define R200_EMIT_PP_TXFILTER_5 41 /* tex5/6 */ +#define R200_EMIT_PP_TXOFFSET_0 42 /* tex0/1 */ +#define R200_EMIT_PP_TXOFFSET_1 43 /* tex1/1 */ +#define R200_EMIT_PP_TXOFFSET_2 44 /* tex2/1 */ +#define R200_EMIT_PP_TXOFFSET_3 45 /* tex3/1 */ +#define R200_EMIT_PP_TXOFFSET_4 46 /* tex4/1 */ +#define R200_EMIT_PP_TXOFFSET_5 47 /* tex5/1 */ +#define R200_EMIT_VTE_CNTL 48 /* vte/1 */ +#define R200_EMIT_OUTPUT_VTX_COMP_SEL 49 /* vtx/1 */ +#define R200_EMIT_PP_TAM_DEBUG3 50 /* tam/1 */ +#define R200_EMIT_PP_CNTL_X 51 /* cst/1 */ +#define R200_EMIT_RB3D_DEPTHXY_OFFSET 52 /* cst/1 */ +#define R200_EMIT_RE_AUX_SCISSOR_CNTL 53 /* cst/1 */ +#define R200_EMIT_RE_SCISSOR_TL_0 54 /* cst/2 */ +#define R200_EMIT_RE_SCISSOR_TL_1 55 /* cst/2 */ +#define R200_EMIT_RE_SCISSOR_TL_2 56 /* cst/2 */ +#define R200_EMIT_SE_VAP_CNTL_STATUS 57 /* cst/1 */ +#define R200_EMIT_SE_VTX_STATE_CNTL 58 /* cst/1 */ +#define R200_EMIT_RE_POINTSIZE 59 /* cst/1 */ +#define R200_EMIT_TCL_INPUT_VTX_VECTOR_ADDR_0 60 /* cst/4 */ +#define R200_EMIT_PP_CUBIC_FACES_0 61 +#define R200_EMIT_PP_CUBIC_OFFSETS_0 62 +#define R200_EMIT_PP_CUBIC_FACES_1 63 +#define R200_EMIT_PP_CUBIC_OFFSETS_1 64 +#define R200_EMIT_PP_CUBIC_FACES_2 65 +#define R200_EMIT_PP_CUBIC_OFFSETS_2 66 +#define R200_EMIT_PP_CUBIC_FACES_3 67 +#define R200_EMIT_PP_CUBIC_OFFSETS_3 68 +#define R200_EMIT_PP_CUBIC_FACES_4 69 +#define R200_EMIT_PP_CUBIC_OFFSETS_4 70 +#define R200_EMIT_PP_CUBIC_FACES_5 71 +#define R200_EMIT_PP_CUBIC_OFFSETS_5 72 +#define RADEON_EMIT_PP_TEX_SIZE_0 73 +#define RADEON_EMIT_PP_TEX_SIZE_1 74 +#define RADEON_EMIT_PP_TEX_SIZE_2 75 +#define RADEON_MAX_STATE_PACKETS 76 + + +/* Commands understood by cmd_buffer ioctl. More can be added but + * obviously these can't be removed or changed: + */ +#define RADEON_CMD_PACKET 1 /* emit one of the register packets above */ +#define RADEON_CMD_SCALARS 2 /* emit scalar data */ +#define RADEON_CMD_VECTORS 3 /* emit vector data */ +#define RADEON_CMD_DMA_DISCARD 4 /* discard current dma buf */ +#define RADEON_CMD_PACKET3 5 /* emit hw packet */ +#define RADEON_CMD_PACKET3_CLIP 6 /* emit hw packet wrapped in cliprects */ +#define RADEON_CMD_SCALARS2 7 /* R200 stopgap */ +#define RADEON_CMD_WAIT 8 /* synchronization */ + +typedef union { + int i; + struct { + unsigned char cmd_type, pad0, pad1, pad2; + } header; + struct { + unsigned char cmd_type, packet_id, pad0, pad1; + } packet; + struct { + unsigned char cmd_type, offset, stride, count; + } scalars; + struct { + unsigned char cmd_type, offset, stride, count; + } vectors; + struct { + unsigned char cmd_type, buf_idx, pad0, pad1; + } dma; + struct { + unsigned char cmd_type, flags, pad0, pad1; + } wait; +} drmRadeonCmdHeader; + + +#define RADEON_WAIT_2D 0x1 +#define RADEON_WAIT_3D 0x2 + + +typedef struct drm_radeon_getparam { + int param; + int *value; +} drmRadeonGetParam; + +#define RADEON_PARAM_GART_BUFFER_OFFSET 1 +#define RADEON_PARAM_LAST_FRAME 2 +#define RADEON_PARAM_LAST_DISPATCH 3 +#define RADEON_PARAM_LAST_CLEAR 4 +#define RADEON_PARAM_IRQ_NR 5 +#define RADEON_PARAM_GART_BASE 6 + + +#define RADEON_MEM_REGION_GART 1 +#define RADEON_MEM_REGION_FB 2 + +typedef struct drm_radeon_mem_alloc { + int region; + int alignment; + int size; + int *region_offset; /* offset from start of fb or GART */ +} drmRadeonMemAlloc; + +typedef struct drm_radeon_mem_free { + int region; + int region_offset; +} drmRadeonMemFree; + +typedef struct drm_radeon_mem_init_heap { + int region; + int size; + int start; +} drmRadeonMemInitHeap; + +/* 1.6: Userspace can request & wait on irq's: + */ +typedef struct drm_radeon_irq_emit { + int *irq_seq; +} drmRadeonIrqEmit; + +typedef struct drm_radeon_irq_wait { + int irq_seq; +} drmRadeonIrqWait; + + +/* 1.10: Clients tell the DRM where they think the framebuffer is located in + * the card's address space, via a new generic ioctl to set parameters + */ + +typedef struct drm_radeon_set_param { + unsigned int param; + int64_t value; +} drmRadeonSetParam; + +#define RADEON_SETPARAM_FB_LOCATION 1 + + +#endif --- xorg-server-1.4.2.orig/hw/kdrive/ati/ati_dripriv.h +++ xorg-server-1.4.2/hw/kdrive/ati/ati_dripriv.h @@ -0,0 +1,57 @@ +/* + * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, + * Precision Insight, Inc., Cedar Park, Texas, and + * VA Linux Systems Inc., Fremont, California. + * + * 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 ATI, PRECISION INSIGHT, VA LINUX + * SYSTEMS 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. Faith + * Kevin E. Martin + * + */ + +#ifndef _ATI_DRIPRIV_H_ +#define _ATI_DRIPRIV_H_ + +#ifdef GLXEXT +#include "GL/glxint.h" + +extern void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, + void **configprivs); +#endif + +typedef struct { + /* Nothing here yet */ + int dummy; +} ATIConfigPrivRec, *ATIConfigPrivPtr; + +typedef struct { + /* Nothing here yet */ + int dummy; +} ATIDRIContextRec, *ATIDRIContextPtr; + +#endif --- xorg-server-1.4.2.orig/hw/kdrive/mach64/Makefile.in +++ xorg-server-1.4.2/hw/kdrive/mach64/Makefile.in @@ -151,7 +151,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -285,10 +285,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/kdrive/mach64/mach64curs.c +++ xorg-server-1.4.2/hw/kdrive/mach64/mach64curs.c @@ -0,0 +1,389 @@ +/* + * 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_CONFIG_H +#include +#endif +#include "trident.h" +#include "cursorstr.h" + +#define SetupCursor(s) KdScreenPriv(s); \ + tridentCardInfo(pScreenPriv); \ + tridentScreenInfo(pScreenPriv); \ + TridentCursor *pCurPriv = &tridents->cursor + +static void +_tridentMoveCursor (ScreenPtr pScreen, int x, int y) +{ + SetupCursor(pScreen); + CARD8 xlow, xhigh, ylow, yhigh; + CARD8 xoff, yoff; + + x -= pCurPriv->xhot; + xoff = 0; + if (x < 0) + { + xoff = -x; + x = 0; + } + y -= pCurPriv->yhot; + yoff = 0; + if (y < 0) + { + yoff = -y; + y = 0; + } + xlow = (CARD8) x; + xhigh = (CARD8) (x >> 8); + ylow = (CARD8) y; + yhigh = (CARD8) (y >> 8); + + + /* This is the recommended order to move the cursor */ + + tridentWriteIndex (tridentc, 0x3d4, 0x41, xhigh); + tridentWriteIndex (tridentc, 0x3d4, 0x40, xlow); + tridentWriteIndex (tridentc, 0x3d4, 0x42, ylow); + tridentWriteIndex (tridentc, 0x3d4, 0x46, xoff); + tridentWriteIndex (tridentc, 0x3d4, 0x47, yoff); + tridentWriteIndex (tridentc, 0x3d4, 0x43, yhigh); +} + +static void +tridentMoveCursor (ScreenPtr pScreen, int x, int y) +{ + SetupCursor (pScreen); + + if (!pCurPriv->has_cursor) + return; + + if (!pScreenPriv->enabled) + return; + + _tridentMoveCursor (pScreen, x, y); +} + +static void +tridentAllocCursorColors (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + CursorPtr pCursor = pCurPriv->pCursor; + + KdAllocateCursorPixels (pScreen, 0, pCursor, + &pCurPriv->source, &pCurPriv->mask); + switch (pScreenPriv->screen->fb[0].bitsPerPixel) { + case 4: + pCurPriv->source |= pCurPriv->source << 4; + pCurPriv->mask |= pCurPriv->mask << 4; + case 8: + pCurPriv->source |= pCurPriv->source << 8; + pCurPriv->mask |= pCurPriv->mask << 8; + case 16: + pCurPriv->source |= pCurPriv->source << 16; + pCurPriv->mask |= pCurPriv->mask << 16; + } +} + +static void +tridentSetCursorColors (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + CursorPtr pCursor = pCurPriv->pCursor; + CARD32 fg, bg; + + fg = pCurPriv->source; + bg = pCurPriv->mask; + tridentWriteIndex (tridentc, 0x3d4, 0x48, fg); + tridentWriteIndex (tridentc, 0x3d4, 0x49, fg >> 8); + tridentWriteIndex (tridentc, 0x3d4, 0x4a, fg >> 16); + + tridentWriteIndex (tridentc, 0x3d4, 0x4c, bg); + tridentWriteIndex (tridentc, 0x3d4, 0x4d, bg >> 8); + tridentWriteIndex (tridentc, 0x3d4, 0x4e, bg >> 16); +} + +void +tridentRecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef) +{ + SetupCursor (pScreen); + CursorPtr pCursor = pCurPriv->pCursor; + xColorItem sourceColor, maskColor; + + if (!pCurPriv->has_cursor || !pCursor) + return; + + if (!pScreenPriv->enabled) + return; + + if (pdef) + { + while (ndef) + { + if (pdef->pixel == pCurPriv->source || + pdef->pixel == pCurPriv->mask) + break; + ndef--; + } + if (!ndef) + return; + } + tridentAllocCursorColors (pScreen); + tridentSetCursorColors (pScreen); +} + +#define InvertBits32(v) { \ + v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \ + v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \ + v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \ +} + +static void +tridentLoadCursor (ScreenPtr pScreen, int x, int y) +{ + SetupCursor(pScreen); + CursorPtr pCursor = pCurPriv->pCursor; + CursorBitsPtr bits = pCursor->bits; + int w, h; + CARD32 *ram, *msk, *mskLine, *src, *srcLine; + int i, j; + int cursor_address; + int lwsrc; + unsigned char ramdac_control_; + CARD32 offset; + + /* + * Allocate new colors + */ + tridentAllocCursorColors (pScreen); + + pCurPriv->pCursor = pCursor; + pCurPriv->xhot = pCursor->bits->xhot; + pCurPriv->yhot = pCursor->bits->yhot; + + /* + * Stick new image into cursor memory + */ + ram = (CARD32 *) tridents->cursor_base; + mskLine = (CARD32 *) bits->mask; + srcLine = (CARD32 *) bits->source; + + h = bits->height; + if (h > TRIDENT_CURSOR_HEIGHT) + h = TRIDENT_CURSOR_HEIGHT; + + lwsrc = BitmapBytePad(bits->width) / 4; /* words per line */ + + for (i = 0; i < TRIDENT_CURSOR_HEIGHT; i++) { + msk = mskLine; + src = srcLine; + mskLine += lwsrc; + srcLine += lwsrc; + for (j = 0; j < TRIDENT_CURSOR_WIDTH / 32; j++) { + + CARD32 m, s; + +#if 1 + if (i < h && j < lwsrc) + { + m = *msk++; + s = *src++; + InvertBits32(m); + InvertBits32(s); + } + else + { + m = 0; + s = 0; + } +#endif + *ram++ = m; + *ram++ = s; + } + } + + /* Set address for cursor bits */ + offset = tridents->cursor_base - (CARD8 *) tridents->screen; + offset >>= 10; + tridentWriteIndex (tridentc, 0x3d4, 0x44, (CARD8) (offset & 0xff)); + tridentWriteIndex (tridentc, 0x3d4, 0x45, (CARD8) (offset >> 8)); + + /* Set new color */ + tridentSetCursorColors (pScreen); + + /* Enable the cursor */ + tridentWriteIndex (tridentc, 0x3d4, 0x50, 0xc1); + + /* Move to new position */ + tridentMoveCursor (pScreen, x, y); +} + +static void +tridentUnloadCursor (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + /* Disable cursor */ + tridentWriteIndex (tridentc, 0x3d4, 0x50, 0); +} + +static Bool +tridentRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) +{ + SetupCursor(pScreen); + + if (!pScreenPriv->enabled) + return TRUE; + + /* miRecolorCursor does this */ + if (pCurPriv->pCursor == pCursor) + { + if (pCursor) + { + int x, y; + + miPointerPosition (&x, &y); + tridentLoadCursor (pScreen, x, y); + } + } + return TRUE; +} + +static Bool +tridentUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) +{ + return TRUE; +} + +static void +tridentSetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y) +{ + SetupCursor(pScreen); + + pCurPriv->pCursor = pCursor; + + if (!pScreenPriv->enabled) + return; + + if (pCursor) + tridentLoadCursor (pScreen, x, y); + else + tridentUnloadCursor (pScreen); +} + +miPointerSpriteFuncRec tridentPointerSpriteFuncs = { + tridentRealizeCursor, + tridentUnrealizeCursor, + tridentSetCursor, + tridentMoveCursor, +}; + +static void +tridentQueryBestSize (int class, + unsigned short *pwidth, unsigned short *pheight, + ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + switch (class) + { + case CursorShape: + if (*pwidth > pCurPriv->width) + *pwidth = pCurPriv->width; + if (*pheight > pCurPriv->height) + *pheight = pCurPriv->height; + if (*pwidth > pScreen->width) + *pwidth = pScreen->width; + if (*pheight > pScreen->height) + *pheight = pScreen->height; + break; + default: + fbQueryBestSize (class, pwidth, pheight, pScreen); + break; + } +} + +Bool +tridentCursorInit (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + if (!tridents->cursor_base) + { + pCurPriv->has_cursor = FALSE; + return FALSE; + } + + pCurPriv->width = TRIDENT_CURSOR_WIDTH; + pCurPriv->height= TRIDENT_CURSOR_HEIGHT; + pScreen->QueryBestSize = tridentQueryBestSize; + miPointerInitialize (pScreen, + &tridentPointerSpriteFuncs, + &kdPointerScreenFuncs, + FALSE); + pCurPriv->has_cursor = TRUE; + pCurPriv->pCursor = NULL; + return TRUE; +} + +void +tridentCursorEnable (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + if (pCurPriv->has_cursor) + { + if (pCurPriv->pCursor) + { + int x, y; + + miPointerPosition (&x, &y); + tridentLoadCursor (pScreen, x, y); + } + else + tridentUnloadCursor (pScreen); + } +} + +void +tridentCursorDisable (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + if (!pScreenPriv->enabled) + return; + + if (pCurPriv->has_cursor) + { + if (pCurPriv->pCursor) + { + tridentUnloadCursor (pScreen); + } + } +} + +void +tridentCursorFini (ScreenPtr pScreen) +{ + SetupCursor (pScreen); + + pCurPriv->pCursor = NULL; +} --- xorg-server-1.4.2.orig/hw/kdrive/via/Makefile.in +++ xorg-server-1.4.2/hw/kdrive/via/Makefile.in @@ -150,7 +150,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -284,10 +284,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/kdrive/sis300/Makefile.in +++ xorg-server-1.4.2/hw/kdrive/sis300/Makefile.in @@ -151,7 +151,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -285,10 +285,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/kdrive/linux/Makefile.in +++ xorg-server-1.4.2/hw/kdrive/linux/Makefile.in @@ -151,7 +151,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -285,10 +285,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xprint/Makefile.in +++ xorg-server-1.4.2/hw/xprint/Makefile.in @@ -60,10 +60,13 @@ Xprt-miinitext-wrapper.$(OBJEXT) \ Xprt-dpmsstubs-wrapper.$(OBJEXT) Xprt-fbcmap_mi.$(OBJEXT) Xprt_OBJECTS = $(am_Xprt_OBJECTS) -Xprt_DEPENDENCIES = ps/libps.la raster/libraster.la pcl/libpcl.la \ +am__DEPENDENCIES_1 = +am__DEPENDENCIES_2 = ps/libps.la raster/libraster.la pcl/libpcl.la \ pcl-mono/libpcl.la $(top_builddir)/fb/libfb.la \ - $(top_builddir)/render/librender.la \ - $(top_builddir)/mi/libmi.la $(top_builddir)/Xext/libXext.la + $(top_builddir)/render/librender.la $(am__DEPENDENCIES_1) \ + $(top_builddir)/mi/libmi.la $(top_builddir)/Xext/libXext.la \ + $(top_builddir)/xkb/libxkb.la \ + $(top_builddir)/xkb/libxkbstubs.la $(top_builddir)/os/libos.la Xprt_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(Xprt_CFLAGS) $(CFLAGS) $(Xprt_LDFLAGS) \ $(LDFLAGS) -o $@ @@ -165,7 +168,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -299,10 +302,27 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ -XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_LIBS = \ + @XPRINT_LIBS@ \ + ps/libps.la \ + raster/libraster.la \ + pcl/libpcl.la \ + pcl-mono/libpcl.la \ + $(top_builddir)/fb/libfb.la \ + $(top_builddir)/render/librender.la \ + $(XSERVER_LIBS) \ + $(top_builddir)/mi/libmi.la \ + $(top_builddir)/Xext/libXext.la \ + $(top_builddir)/xkb/libxkb.la \ + $(top_builddir)/xkb/libxkbstubs.la \ + $(top_builddir)/os/libos.la # for Xprintf + +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ @@ -390,11 +410,8 @@ -DXFree86Server Xprt_LDFLAGS = -L$(top_srcdir) -Xprt_LDADD = @XPRINT_LIBS@ ps/libps.la raster/libraster.la \ - pcl/libpcl.la pcl-mono/libpcl.la $(top_builddir)/fb/libfb.la \ - $(top_builddir)/render/librender.la $(top_builddir)/mi/libmi.la \ - $(top_builddir)/Xext/libXext.la @FREETYPE_LIBS@ @XSERVER_LIBS@ - +Xprt_DEPENDENCIES = $(XPRINT_LIBS) +Xprt_LDADD = $(XPRINT_LIBS) $(XPRINT_SYS_LIBS) $(XSERVER_SYS_LIBS) Xprt_SOURCES = \ attributes.c \ attributes.h \ --- xorg-server-1.4.2.orig/hw/xprint/Makefile.am +++ xorg-server-1.4.2/hw/xprint/Makefile.am @@ -9,10 +9,22 @@ -DXFree86Server Xprt_LDFLAGS = -L$(top_srcdir) -Xprt_LDADD = @XPRINT_LIBS@ ps/libps.la raster/libraster.la \ - pcl/libpcl.la pcl-mono/libpcl.la $(top_builddir)/fb/libfb.la \ - $(top_builddir)/render/librender.la $(top_builddir)/mi/libmi.la \ - $(top_builddir)/Xext/libXext.la @FREETYPE_LIBS@ @XSERVER_LIBS@ +XPRINT_LIBS = \ + @XPRINT_LIBS@ \ + ps/libps.la \ + raster/libraster.la \ + pcl/libpcl.la \ + pcl-mono/libpcl.la \ + $(top_builddir)/fb/libfb.la \ + $(top_builddir)/render/librender.la \ + $(XSERVER_LIBS) \ + $(top_builddir)/Xext/libXext.la \ + $(top_builddir)/xkb/libxkb.la \ + $(top_builddir)/xkb/libxkbstubs.la \ + $(top_builddir)/os/libos.la # for Xprintf + +Xprt_DEPENDENCIES = $(XPRINT_LIBS) +Xprt_LDADD = $(XPRINT_LIBS) $(XPRINT_SYS_LIBS) $(XSERVER_SYS_LIBS) miinitext-wrapper.c: echo "#include \"$(top_srcdir)/mi/miinitext.c\"" >> $@ --- xorg-server-1.4.2.orig/hw/xprint/ps/Makefile.in +++ xorg-server-1.4.2/hw/xprint/ps/Makefile.in @@ -32,8 +32,8 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -@XP_USE_FREETYPE_TRUE@am__append_1 = -DXP_USE_FREETYPE -@XP_USE_FREETYPE_TRUE@am__append_2 = $(EXTRA_DIST) +@XP_USE_FREETYPE_TRUE@am__append_1 = -DXP_USE_FREETYPE -DUSE_FREETYPE -DXP_ONLY_BLOCKS +@XP_USE_FREETYPE_TRUE@am__append_2 = $(FREETYPE_SRCS) $(TTF2PT1SRCS) subdir = hw/xprint/ps DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -58,15 +58,19 @@ PsImageUtil.c PsInit.c PsLine.c PsMisc.c psout.c psout.h \ PsPixel.c PsPixmap.c PsPolygon.c PsPrint.c PsSpans.c PsText.c \ PsWindow.c PsFTFonts.c psout_ft.c psout_ftpstype1.c \ - psout_ftpstype3.c ttf2pt1wrap.c + psout_ftpstype3.c ft.c pt1.c runt1asm.c ttf2pt1.c am__objects_1 = PsFTFonts.lo psout_ft.lo psout_ftpstype1.lo \ - psout_ftpstype3.lo ttf2pt1wrap.lo -@XP_USE_FREETYPE_TRUE@am__objects_2 = $(am__objects_1) + psout_ftpstype3.lo +@XP_USE_FREETYPE_TRUE@am__objects_2 = ttf2pt1.lo +@XP_USE_FREETYPE_TRUE@am__objects_3 = ft.lo pt1.lo runt1asm.lo \ +@XP_USE_FREETYPE_TRUE@ $(am__objects_2) +@XP_USE_FREETYPE_TRUE@am__objects_4 = $(am__objects_1) \ +@XP_USE_FREETYPE_TRUE@ $(am__objects_3) am_libps_la_OBJECTS = PsArc.lo PsArea.lo PsAttr.lo PsAttVal.lo \ PsCache.lo PsColor.lo PsFonts.lo PsGC.lo PsImageUtil.lo \ PsInit.lo PsLine.lo PsMisc.lo psout.lo PsPixel.lo PsPixmap.lo \ PsPolygon.lo PsPrint.lo PsSpans.lo PsText.lo PsWindow.lo \ - $(am__objects_2) + $(am__objects_4) libps_la_OBJECTS = $(am_libps_la_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp @@ -156,7 +160,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -290,10 +294,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ @@ -382,12 +389,18 @@ PsLine.c PsMisc.c psout.c psout.h PsPixel.c PsPixmap.c \ PsPolygon.c PsPrint.c PsSpans.c PsText.c PsWindow.c \ $(am__append_2) -EXTRA_DIST = PsFTFonts.c \ +FREETYPE_SRCS = PsFTFonts.c \ psout_ft.c \ psout_ftpstype1.c \ - psout_ftpstype3.c \ - ttf2pt1wrap.c + psout_ftpstype3.c +EXTRA_DIST = ttf2pt1wrap.c +@XP_USE_FREETYPE_TRUE@TTF2PT1OURCEDIR = $(top_srcdir)/hw/xprint/extras/ttf2pt1 +@XP_USE_FREETYPE_TRUE@TTF2PT1SRCFILE = ttf2pt1.c +@XP_USE_FREETYPE_TRUE@TTF2PT1OBJFILE = ttf2pt1.o +@XP_USE_FREETYPE_TRUE@TTF2PT1SRCS_EXTRA = pt1.h t1asm.c ttf.h global.h version.h +@XP_USE_FREETYPE_TRUE@TTF2PT1SRCS = ft.c pt1.c runt1asm.c $(TTF2PT1SRCFILE) +@XP_USE_FREETYPE_TRUE@TTF2PT1OBJS = ft.o pt1.o runt1asm.o $(TTF2PT1OBJFILE) all: all-am .SUFFIXES: @@ -459,11 +472,14 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PsSpans.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PsText.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PsWindow.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ft.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/psout.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/psout_ft.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/psout_ftpstype1.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/psout_ftpstype3.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ttf2pt1wrap.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pt1.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/runt1asm.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ttf2pt1.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -667,6 +683,14 @@ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags uninstall uninstall-am + +@XP_USE_FREETYPE_TRUE@$(TTF2PT1SRCS_EXTRA): +@XP_USE_FREETYPE_TRUE@ -rm -f $@ +@XP_USE_FREETYPE_TRUE@ $(LN_S) $(TTF2PT1OURCEDIR)/$@ + +@XP_USE_FREETYPE_TRUE@$(TTF2PT1SRCS): $(TTF2PT1SRCS_EXTRA) +@XP_USE_FREETYPE_TRUE@ -rm -f $@ +@XP_USE_FREETYPE_TRUE@ $(LN_S) $(TTF2PT1OURCEDIR)/$@ # 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.4.2.orig/hw/xprint/config/Makefile.in +++ xorg-server-1.4.2/hw/xprint/config/Makefile.in @@ -147,7 +147,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -281,10 +281,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xprint/config/en_US/Makefile.in +++ xorg-server-1.4.2/hw/xprint/config/en_US/Makefile.in @@ -134,7 +134,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -268,10 +268,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xprint/config/en_US/print/Makefile.in +++ xorg-server-1.4.2/hw/xprint/config/en_US/print/Makefile.in @@ -134,7 +134,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -268,10 +268,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xprint/config/en_US/print/attributes/Makefile.in +++ xorg-server-1.4.2/hw/xprint/config/en_US/print/attributes/Makefile.in @@ -133,7 +133,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -267,10 +267,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xprint/config/C/Makefile.in +++ xorg-server-1.4.2/hw/xprint/config/C/Makefile.in @@ -134,7 +134,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -268,10 +268,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xprint/config/C/print/Makefile.in +++ xorg-server-1.4.2/hw/xprint/config/C/print/Makefile.in @@ -146,7 +146,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -280,10 +280,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ @@ -722,7 +725,7 @@ Xprinters.ghostscript: $(srcdir)/Xprinters - sed < $(srcdir)/Xprinters "s/#Printer xp_pdf_spooldir_tmp_Xprintjobs/Printer xp_pdf_spooldir_tmp_Xprintjobs/" > Xprinters.ghostscript + sed < $(srcdir)/Xprinters "s/#Printer xp_pdf_spooldir_HOME_Xprintjobs/Printer xp_pdf_spooldir_HOME_Xprintjobs/" > Xprinters.ghostscript # 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.4.2.orig/hw/xprint/config/C/print/attributes/Makefile.in +++ xorg-server-1.4.2/hw/xprint/config/C/print/attributes/Makefile.in @@ -133,7 +133,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -267,10 +267,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xprint/config/C/print/models/Makefile.in +++ xorg-server-1.4.2/hw/xprint/config/C/print/models/Makefile.in @@ -134,7 +134,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -268,10 +268,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xprint/config/C/print/models/HPLJ4050-PS/Makefile.in +++ xorg-server-1.4.2/hw/xprint/config/C/print/models/HPLJ4050-PS/Makefile.in @@ -145,7 +145,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -279,10 +279,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xprint/config/C/print/models/HPLJ4050-PS/fonts/Makefile.in +++ xorg-server-1.4.2/hw/xprint/config/C/print/models/HPLJ4050-PS/fonts/Makefile.in @@ -122,7 +122,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -256,10 +256,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xprint/config/C/print/models/HPDJ1600C/Makefile.in +++ xorg-server-1.4.2/hw/xprint/config/C/print/models/HPDJ1600C/Makefile.in @@ -145,7 +145,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -279,10 +279,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xprint/config/C/print/models/HPDJ1600C/fonts/Makefile.in +++ xorg-server-1.4.2/hw/xprint/config/C/print/models/HPDJ1600C/fonts/Makefile.in @@ -133,7 +133,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -267,10 +267,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xprint/config/C/print/models/PSspooldir/Makefile.in +++ xorg-server-1.4.2/hw/xprint/config/C/print/models/PSspooldir/Makefile.in @@ -136,7 +136,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -270,10 +270,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xprint/config/C/print/models/CANONC3200-PS/Makefile.in +++ xorg-server-1.4.2/hw/xprint/config/C/print/models/CANONC3200-PS/Makefile.in @@ -145,7 +145,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -279,10 +279,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xprint/config/C/print/models/CANONC3200-PS/fonts/Makefile.in +++ xorg-server-1.4.2/hw/xprint/config/C/print/models/CANONC3200-PS/fonts/Makefile.in @@ -122,7 +122,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -256,10 +256,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xprint/config/C/print/models/SPSPARC2/Makefile.in +++ xorg-server-1.4.2/hw/xprint/config/C/print/models/SPSPARC2/Makefile.in @@ -145,7 +145,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -279,10 +279,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xprint/config/C/print/models/SPSPARC2/fonts/Makefile.in +++ xorg-server-1.4.2/hw/xprint/config/C/print/models/SPSPARC2/fonts/Makefile.in @@ -122,7 +122,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -256,10 +256,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xprint/config/C/print/models/GSdefault/Makefile.in +++ xorg-server-1.4.2/hw/xprint/config/C/print/models/GSdefault/Makefile.in @@ -133,7 +133,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -267,10 +267,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xprint/config/C/print/models/PSdefault/Makefile.in +++ xorg-server-1.4.2/hw/xprint/config/C/print/models/PSdefault/Makefile.in @@ -145,7 +145,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -279,10 +279,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xprint/config/C/print/models/PSdefault/fonts/Makefile.in +++ xorg-server-1.4.2/hw/xprint/config/C/print/models/PSdefault/fonts/Makefile.in @@ -133,7 +133,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -267,10 +267,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xprint/config/C/print/models/CANONBJ10E-GS/Makefile.in +++ xorg-server-1.4.2/hw/xprint/config/C/print/models/CANONBJ10E-GS/Makefile.in @@ -133,7 +133,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -267,10 +267,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xprint/config/C/print/models/HPLJ4family/Makefile.in +++ xorg-server-1.4.2/hw/xprint/config/C/print/models/HPLJ4family/Makefile.in @@ -145,7 +145,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -279,10 +279,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xprint/config/C/print/models/HPLJ4family/fonts/Makefile.in +++ xorg-server-1.4.2/hw/xprint/config/C/print/models/HPLJ4family/fonts/Makefile.in @@ -133,7 +133,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -267,10 +267,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/Makefile.in +++ xorg-server-1.4.2/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/Makefile.in @@ -136,7 +136,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -270,10 +270,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xprint/config/C/print/ddx-config/Makefile.in +++ xorg-server-1.4.2/hw/xprint/config/C/print/ddx-config/Makefile.in @@ -134,7 +134,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -268,10 +268,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xprint/config/C/print/ddx-config/raster/Makefile.in +++ xorg-server-1.4.2/hw/xprint/config/C/print/ddx-config/raster/Makefile.in @@ -133,7 +133,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -267,10 +267,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xprint/doc/Makefile.in +++ xorg-server-1.4.2/hw/xprint/doc/Makefile.in @@ -137,7 +137,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -271,10 +271,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xprint/raster/Makefile.in +++ xorg-server-1.4.2/hw/xprint/raster/Makefile.in @@ -141,7 +141,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -275,10 +275,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xprint/pcl-mono/Makefile.in +++ xorg-server-1.4.2/hw/xprint/pcl-mono/Makefile.in @@ -145,7 +145,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -279,10 +279,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xprint/etc/Makefile.in +++ xorg-server-1.4.2/hw/xprint/etc/Makefile.in @@ -134,7 +134,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -268,10 +268,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xprint/etc/init.d/Makefile.in +++ xorg-server-1.4.2/hw/xprint/etc/init.d/Makefile.in @@ -127,7 +127,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -261,10 +261,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xprint/etc/profile.d/Makefile.in +++ xorg-server-1.4.2/hw/xprint/etc/profile.d/Makefile.in @@ -122,7 +122,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -256,10 +256,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xprint/etc/Xsession.d/Makefile.in +++ xorg-server-1.4.2/hw/xprint/etc/Xsession.d/Makefile.in @@ -133,7 +133,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -267,10 +267,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xprint/pcl/Makefile.in +++ xorg-server-1.4.2/hw/xprint/pcl/Makefile.in @@ -145,7 +145,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -279,10 +279,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xwin/Makefile.in +++ xorg-server-1.4.2/hw/xwin/Makefile.in @@ -239,7 +239,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -373,10 +373,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xwin/xlaunch/Makefile +++ xorg-server-1.4.2/hw/xwin/xlaunch/Makefile @@ -0,0 +1,79 @@ +# +# 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. +# +WINDRES=windres + +TARGET=mingw +#DEBUG_FLAGS=-D_DEBUG + +OS_FLAGS_mingw=-mno-cygwin +OS_FLAGS=$(OS_FLAGS_$(TARGET)) $(DEBUG_FLAGS) + +X11_DIR_$(TARGET)=/usr/X11R6 +X11_DIR_mingw=../../../../../exports +X11_DIR=$(X11_DIR_$(TARGET)) +X11_INCLUDE=-I$(X11_DIR)/include +X11_LIBDIR=-L$(X11_DIR)/lib +X11_LIBS_$(TARGET)=-lX11 +X11_LIBS_mingw=-lX11 -lwsock32 +X11_LIBS=$(X11_LIBS_$(TARGET)) + +PROGRAMFILES:=$(shell cygpath -u $(PROGRAMFILES)) +#MSXML_DIR=$(PROGRAMFILES)/MSXML 4.0 +MSXML_DIR=$(PROGRAMFILES)/Microsoft XML Parser SDK +MSXML_INCLUDE="-I$(MSXML_DIR)/inc" +MSXML_LIBDIR="-L$(MSXML_DIR)/lib" +MSXML_LIBS= + + +CXXFLAGS=-g $(OS_FLAGS) $(X11_INCLUDE) $(MSXML_INCLUDE) +LDFLAGS=-mwindows $(X11_LIBDIR) $(MSXML_LIBDIR) +LIBS=-lcomctl32 -lole32 -loleaut32 $(X11_LIBS) $(MSXML_LIBS) +all:xlaunch.exe +%.res: %.rc + $(WINDRES) -O coff -o $@ $< + +WINDOW_PARTS=window util dialog wizard +WINDOW_OBJECTS=$(foreach file,$(WINDOW_PARTS),window/$(file).o) + +RESOURCES_IMAGES=resources/multiwindow.bmp resources/fullscreen.bmp \ + resources/windowed.bmp resources/nodecoration.bmp + +resources/resources.res: resources/resources.rc resources/resources.h \ + resources/images.rc resources/dialog.rc resources/strings.rc \ + $(RESOURCES_IMAGES) +xlaunch.exe: $(WINDOW_OBJECTS) main.o config.o resources/resources.res + $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) + + +window/dialog.o: window/dialog.cc window/dialog.h window/window.h window/util.h +window/frame.o: window/frame.cc window/frame.h window/window.h +window/util.o: window/util.cc window/util.h +window/window.o: window/window.cc window/window.h window/util.h +window/wizard.o: window/wizard.cc window/wizard.h window/dialog.h \ + window/window.h window/util.h +main.o: main.cc window/util.h window/wizard.h window/dialog.h \ + window/window.h resources/resources.h config.h +config.o: config.cc config.h --- xorg-server-1.4.2.orig/hw/xwin/xlaunch/config.h +++ xorg-server-1.4.2/hw/xwin/xlaunch/config.h @@ -0,0 +1,60 @@ +/* + * 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. + */ +#ifndef __CONFIG_H__ +#define __CONFIG_H__ + +#include +struct CConfig +{ + enum {MultiWindow, Fullscreen, Windowed, Nodecoration} window; + enum {NoClient, StartProgram, XDMCP} client; + bool local; + std::string display; + std::string protocol; + std::string program; + std::string host; + std::string user; + bool broadcast; + bool indirect; + std::string xdmcp_host; + bool clipboard; + std::string extra_params; +#ifdef _DEBUG + CConfig() : window(MultiWindow), client(StartProgram), local(false), display("1"), + protocol("Putty"), program("xterm"), host("lupus"), user("ago"), + broadcast(false), indirect(false), xdmcp_host("lupus"), + clipboard(true), extra_params() {}; +#else + CConfig() : window(MultiWindow), client(StartProgram), local(false), display("0"), + protocol("Putty"), program("xterm"), host(""), user(""), + broadcast(true), indirect(false), xdmcp_host(""), + clipboard(true), extra_params() {}; +#endif + void Load(const char* filename); + void Save(const char* filename); +}; + +#endif --- xorg-server-1.4.2.orig/hw/vfb/Makefile.in +++ xorg-server-1.4.2/hw/vfb/Makefile.in @@ -169,7 +169,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -303,10 +303,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xgl/Makefile.in +++ xorg-server-1.4.2/hw/xgl/Makefile.in @@ -175,7 +175,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -309,10 +309,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xgl/glxext/Makefile.in +++ xorg-server-1.4.2/hw/xgl/glxext/Makefile.in @@ -151,7 +151,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -285,10 +285,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xgl/glxext/module/Makefile.in +++ xorg-server-1.4.2/hw/xgl/glxext/module/Makefile.in @@ -158,7 +158,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -292,10 +292,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xgl/egl/Makefile.in +++ xorg-server-1.4.2/hw/xgl/egl/Makefile.in @@ -163,7 +163,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -297,10 +297,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xgl/egl/module/Makefile.in +++ xorg-server-1.4.2/hw/xgl/egl/module/Makefile.in @@ -154,7 +154,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -288,10 +288,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xgl/glx/Makefile.in +++ xorg-server-1.4.2/hw/xgl/glx/Makefile.in @@ -150,7 +150,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -284,10 +284,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xgl/glx/xglxinit.c +++ xorg-server-1.4.2/hw/xgl/glx/xglxinit.c @@ -0,0 +1,172 @@ +/* + * Copyright © 2004 David Reveman + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright 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 Reveman not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * David Reveman makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER 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: David Reveman + */ + +#include "xglx.h" +#include "xglglx.h" + +xglScreenInfoRec xglScreenInfo = { + NULL, 0, 0, 0, 0, 0, + DEFAULT_GEOMETRY_DATA_TYPE, + DEFAULT_GEOMETRY_USAGE, + FALSE, + XGL_DEFAULT_PBO_MASK, + FALSE, + { + { FALSE, FALSE, { 0, 0, 0, 0 } }, + { FALSE, FALSE, { 0, 0, 0, 0 } }, + { FALSE, FALSE, { 0, 0, 0, 0 } }, + { FALSE, FALSE, { 0, 0, 0, 0 } } + } +}; + +#ifdef GLXEXT +static Bool loadGlx = TRUE; + +#ifndef NGLXEXTLOG +static char *glxExtLogFile = 0; +#endif + +#endif + +void +InitOutput (ScreenInfo *pScreenInfo, + int argc, + char **argv) +{ + +#ifdef GLXEXT + if (loadGlx) + { + if (!xglLoadGLXModules ()) + FatalError ("No GLX modules loaded"); + +#ifndef NGLXEXTLOG + if (glxExtLogFile) + { + __xglGLXLogFp = fopen (glxExtLogFile, "w"); + if (!__xglGLXLogFp) + perror ("InitOutput"); + } + else + __xglGLXLogFp = 0; +#endif + + } +#endif + + xglxInitOutput (pScreenInfo, argc, argv); +} + +Bool +LegalModifier (unsigned int key, + DeviceIntPtr pDev) +{ + return xglxLegalModifier (key, pDev); +} + +void +ProcessInputEvents (void) +{ + xglxProcessInputEvents (); +} + +void +InitInput (int argc, + char **argv) +{ + xglxInitInput (argc, argv); +} + +void +ddxUseMsg (void) +{ + ErrorF ("\nXgl usage:\n"); + +#ifdef GLXEXT + ErrorF ("-noglx don't load glx extension\n"); + +#ifndef NGLXEXTLOG + ErrorF ("-glxlog file glx extension log file\n"); +#endif + +#endif + + xglUseMsg (); + ErrorF ("\nXglx usage:\n"); + xglxUseMsg (); +} + +int +ddxProcessArgument (int argc, + char **argv, + int i) +{ + int skip; + +#ifdef GLXEXT + if (!strcmp (argv[i], "-noglx")) + { + loadGlx = FALSE; + return 1; + } + +#ifndef NGLXEXTLOG + else if (!strcmp (argv[i], "-glxlog")) + { + if (++i < argc) + glxExtLogFile = argv[i]; + } +#endif + +#endif + + skip = xglProcessArgument (argc, argv, i); + if (skip) + return skip; + + return xglxProcessArgument (argc, argv, i); +} + +void +AbortDDX (void) +{ + xglxAbort (); +} + +void +ddxGiveUp (void) +{ + xglxGiveUp (); +} + +void +OsVendorInit (void) +{ + xglxOsVendorInit (); +} + +void ddxInitGlobals() +{ +} --- xorg-server-1.4.2.orig/hw/xgl/glx/module/Makefile.in +++ xorg-server-1.4.2/hw/xgl/glx/module/Makefile.in @@ -152,7 +152,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -286,10 +286,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/Makefile.in @@ -183,7 +183,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -330,10 +330,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/utils/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/utils/Makefile.in @@ -134,7 +134,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -268,10 +268,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/utils/gtf/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/utils/gtf/Makefile.in @@ -189,7 +189,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -323,10 +323,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/utils/cvt/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/utils/cvt/Makefile.in @@ -184,7 +184,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -318,10 +318,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/utils/ioport/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/utils/ioport/Makefile.in @@ -177,7 +177,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -311,10 +311,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/utils/pcitweak/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/utils/pcitweak/Makefile.in @@ -191,7 +191,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -325,10 +325,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/utils/kbd_mode/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/utils/kbd_mode/Makefile.in @@ -193,7 +193,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -327,10 +327,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/utils/xorgconfig/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/utils/xorgconfig/Makefile.in @@ -192,7 +192,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -326,10 +326,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/utils/scanpci/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/utils/scanpci/Makefile.in @@ -192,7 +192,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -326,10 +326,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/utils/xorgcfg/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/utils/xorgcfg/Makefile.in @@ -225,7 +225,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -359,10 +359,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/fbdevhw/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/fbdevhw/Makefile.in @@ -166,7 +166,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -300,10 +300,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/xf8_16bpp/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/xf8_16bpp/Makefile.in @@ -156,7 +156,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -290,10 +290,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/ddc/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/ddc/Makefile.in @@ -156,7 +156,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -290,10 +290,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/rac/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/rac/Makefile.in @@ -154,7 +154,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -288,10 +288,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/xf1bpp/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/xf1bpp/Makefile.in @@ -168,7 +168,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -302,10 +302,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/dixmods/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/dixmods/Makefile.in @@ -142,12 +142,6 @@ libshadow_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libshadow_la_LDFLAGS) $(LDFLAGS) -o $@ -libtype1_la_LIBADD = -am_libtype1_la_OBJECTS = type1mod.lo -libtype1_la_OBJECTS = $(am_libtype1_la_OBJECTS) -libtype1_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(libtype1_la_LDFLAGS) $(LDFLAGS) -o $@ libwfb_la_DEPENDENCIES = $(top_builddir)/fb/libwfb.la am_libwfb_la_OBJECTS = libwfb_la-fbcmap_mi.lo libwfb_la-fbmodule.lo libwfb_la_OBJECTS = $(am_libwfb_la_OBJECTS) @@ -182,16 +176,16 @@ $(libfb_la_SOURCES) $(libfreetype_la_SOURCES) \ $(libglx_la_SOURCES) $(libmfb_la_SOURCES) \ $(librecord_la_SOURCES) $(libshadow_la_SOURCES) \ - $(libtype1_la_SOURCES) $(libwfb_la_SOURCES) \ - $(libxorgxkb_la_SOURCES) $(libxtrap_la_SOURCES) + $(libwfb_la_SOURCES) $(libxorgxkb_la_SOURCES) \ + $(libxtrap_la_SOURCES) DIST_SOURCES = $(libGLcore_la_SOURCES) $(libafb_la_SOURCES) \ $(libcfb_la_SOURCES) $(libcfb32_la_SOURCES) \ $(libdbe_la_SOURCES) $(libdixmods_la_SOURCES) \ $(libfb_la_SOURCES) $(libfreetype_la_SOURCES) \ $(libglx_la_SOURCES) $(libmfb_la_SOURCES) \ $(librecord_la_SOURCES) $(libshadow_la_SOURCES) \ - $(libtype1_la_SOURCES) $(libwfb_la_SOURCES) \ - $(libxorgxkb_la_SOURCES) $(libxtrap_la_SOURCES) + $(libwfb_la_SOURCES) $(libxorgxkb_la_SOURCES) \ + $(libxtrap_la_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ @@ -276,7 +270,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -410,10 +404,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ @@ -515,9 +512,7 @@ $(XTRAPMOD) fontsmoduledir = $(moduledir)/fonts -fontsmodule_LTLIBRARIES = libfreetype.la \ - libtype1.la - +fontsmodule_LTLIBRARIES = libfreetype.la AM_CFLAGS = @XORG_CFLAGS@ @DIX_CFLAGS@ INCLUDES = @XORG_INCS@ \ -I$(top_srcdir)/dbe \ @@ -566,8 +561,6 @@ libshadow_la_SOURCES = shmodule.c libfreetype_la_LDFLAGS = -avoid-version libfreetype_la_SOURCES = ftmodule.c -libtype1_la_LDFLAGS = -avoid-version -libtype1_la_SOURCES = type1mod.c libdixmods_la_SOURCES = $(top_srcdir)/mi/miinitext.c libdixmods_la_CFLAGS = -DXFree86LOADER $(AM_CFLAGS) libxorgxkb_la_SOURCES = xkbVT.c xkbPrivate.c xkbKillSrv.c @@ -722,8 +715,6 @@ $(librecord_la_LINK) -rpath $(extsmoduledir) $(librecord_la_OBJECTS) $(librecord_la_LIBADD) $(LIBS) libshadow.la: $(libshadow_la_OBJECTS) $(libshadow_la_DEPENDENCIES) $(libshadow_la_LINK) -rpath $(moduledir) $(libshadow_la_OBJECTS) $(libshadow_la_LIBADD) $(LIBS) -libtype1.la: $(libtype1_la_OBJECTS) $(libtype1_la_DEPENDENCIES) - $(libtype1_la_LINK) -rpath $(fontsmoduledir) $(libtype1_la_OBJECTS) $(libtype1_la_LIBADD) $(LIBS) libwfb.la: $(libwfb_la_OBJECTS) $(libwfb_la_DEPENDENCIES) $(libwfb_la_LINK) -rpath $(moduledir) $(libwfb_la_OBJECTS) $(libwfb_la_LIBADD) $(LIBS) libxorgxkb.la: $(libxorgxkb_la_OBJECTS) $(libxorgxkb_la_DEPENDENCIES) @@ -752,7 +743,6 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbmodule.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/recordmod.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shmodule.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/type1mod.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86XTrapModule.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xkbKillSrv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xkbPrivate.Plo@am__quote@ --- xorg-server-1.4.2.orig/hw/xfree86/dixmods/extmod/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/dixmods/extmod/Makefile.in @@ -164,7 +164,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -298,10 +298,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/parser/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/parser/Makefile.in @@ -161,7 +161,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -295,10 +295,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/dri/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/dri/Makefile.in @@ -157,7 +157,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -291,10 +291,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/int10/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/int10/Makefile.in @@ -170,7 +170,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -304,10 +304,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/vgahw/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/vgahw/Makefile.in @@ -156,7 +156,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -290,10 +290,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/modes/xf86Modes.h +++ xorg-server-1.4.2/hw/xfree86/modes/xf86Modes.h @@ -95,4 +95,7 @@ DisplayModePtr xf86GetDefaultModes (Bool interlaceAllowed, Bool doubleScanAllowed); +void +xf86DDCApplyQuirks(int scrnIndex, xf86MonPtr DDC); + #endif /* _XF86MODES_H_ */ --- xorg-server-1.4.2.orig/hw/xfree86/modes/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/modes/Makefile.in @@ -156,7 +156,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -290,10 +290,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/modes/xf86Crtc.c +++ xorg-server-1.4.2/hw/xfree86/modes/xf86Crtc.c @@ -1068,10 +1068,10 @@ output->initial_x += xf86ModeWidth (modes[or], relative->initial_rotation); break; case OPTION_ABOVE: - output->initial_y -= xf86ModeHeight (modes[or], relative->initial_rotation); + output->initial_y -= xf86ModeHeight (modes[o], output->initial_rotation); break; case OPTION_LEFT_OF: - output->initial_x -= xf86ModeWidth (modes[or], relative->initial_rotation); + output->initial_x -= xf86ModeWidth (modes[o], output->initial_rotation); break; default: break; @@ -1214,6 +1214,23 @@ return output; } +static char * +preferredMode(ScrnInfoPtr pScrn, xf86OutputPtr output) +{ + char *preferred_mode = NULL; + + /* Check for a configured preference for a particular mode */ + preferred_mode = xf86GetOptValString (output->options, + OPTION_PREFERRED_MODE); + if (preferred_mode) + return preferred_mode; + + if (pScrn->display->modes && *pScrn->display->modes) + preferred_mode = *pScrn->display->modes; + + return preferred_mode; +} + _X_EXPORT void xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY) { @@ -1318,8 +1335,8 @@ if (sync_source == sync_default) sync_source = sync_edid; } - if (ranges->max_clock > max_clock) - max_clock = ranges->max_clock; + if (ranges->max_clock * 1000 > max_clock) + max_clock = ranges->max_clock * 1000; } } } @@ -1395,8 +1412,7 @@ output->probed_modes = xf86SortModes (output->probed_modes); /* Check for a configured preference for a particular mode */ - preferred_mode = xf86GetOptValString (output->options, - OPTION_PREFERRED_MODE); + preferred_mode = preferredMode(scrn, output); if (preferred_mode) { @@ -2134,8 +2150,13 @@ xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus) { ScrnInfoPtr scrn = output->scrn; + xf86MonPtr mon; + + mon = xf86DoEDID_DDC2 (scrn->scrnIndex, pDDCBus); + if (mon) + xf86DDCApplyQuirks (scrn->scrnIndex, mon); - return xf86DoEDID_DDC2 (scrn->scrnIndex, pDDCBus); + return mon; } static char *_xf86ConnectorNames[] = { "None", "VGA", "DVI-I", "DVI-D", --- xorg-server-1.4.2.orig/hw/xfree86/modes/xf86EdidModes.c +++ xorg-server-1.4.2/hw/xfree86/modes/xf86EdidModes.c @@ -54,13 +54,28 @@ 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, } ddc_quirk_t; static Bool quirk_prefer_large_60 (int scrnIndex, xf86MonPtr DDC) { /* Belinea 10 15 55 */ if (memcmp (DDC->vendor.name, "MAX", 4) == 0 && - DDC->vendor.prod_id == 1516) + ((DDC->vendor.prod_id == 1516) || + (DDC->vendor.prod_id == 0x77e))) return TRUE; /* Acer AL1706 */ @@ -78,6 +93,52 @@ 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; + + return FALSE; +} + +static Bool quirk_detailed_use_maximum_size (int scrnIndex, xf86MonPtr DDC) +{ + /* Bug #10304: LGPhilipsLCD LP154W01-A5 */ + if (memcmp (DDC->vendor.name, "LPL", 4) == 0 && + (DDC->vendor.prod_id == 0 || DDC->vendor.prod_id == 0x2a00)) + return TRUE; + return FALSE; } @@ -91,6 +152,35 @@ 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; + + 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; +} + typedef struct { Bool (*detect) (int scrnIndex, xf86MonPtr DDC); ddc_quirk_t quirk; @@ -106,6 +196,30 @@ 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, + "Detailed timings give sizes in cm." + }, + { + 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." + }, { NULL, DDC_QUIRK_NONE, "No known quirks" @@ -185,7 +299,7 @@ */ static DisplayModePtr DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing, - int preferred, ddc_quirk_t quirks) + Bool preferred, ddc_quirk_t quirks) { DisplayModePtr Mode; @@ -252,15 +366,19 @@ if (timing->interlaced) Mode->Flags |= V_INTERLACE; - 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; + 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; + } return Mode; } @@ -309,27 +427,116 @@ } } +static 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; +} + +/** + * 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++) { + struct detailed_monitor_section *det_mon = &DDC->det_mon[i]; + + if (det_mon->type != DT) + continue; + + 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 * DDC->features.hsize; + det_mon->section.d_timings.v_size = 10 * 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; +} + _X_EXPORT DisplayModePtr xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC) { - int preferred, i; + int i; DisplayModePtr Modes = NULL, Mode; ddc_quirk_t quirks; + Bool preferred; xf86DrvMsg (scrnIndex, X_INFO, "EDID vendor \"%s\", prod id %d\n", DDC->vendor.name, DDC->vendor.prod_id); - quirks = DDC_QUIRK_NONE; - for (i = 0; ddc_quirks[i].detect; i++) - if (ddc_quirks[i].detect (scrnIndex, DDC)) - { - xf86DrvMsg (scrnIndex, X_INFO, " EDID quirk: %s\n", - ddc_quirks[i].description); - quirks |= ddc_quirks[i].quirk; - } - + + quirks = xf86DDCDetectQuirks(scrnIndex, DDC, TRUE); + preferred = PREFERRED_TIMING_MODE(DDC->features.msc); - if (quirks & DDC_QUIRK_PREFER_LARGE_60) - preferred = 0; + if (quirks & DDC_QUIRK_FIRST_DETAILED_PREFERRED) + preferred = TRUE; + if (quirks & (DDC_QUIRK_PREFER_LARGE_60 | DDC_QUIRK_PREFER_LARGE_75)) + preferred = FALSE; for (i = 0; i < DET_TIMINGS; i++) { struct detailed_monitor_section *det_mon = &DDC->det_mon[i]; @@ -340,7 +547,7 @@ &det_mon->section.d_timings, preferred, quirks); - preferred = 0; + preferred = FALSE; Modes = xf86ModesAdd(Modes, Mode); break; case DS_STD_TIMINGS: @@ -363,32 +570,11 @@ Modes = xf86ModesAdd(Modes, Mode); if (quirks & DDC_QUIRK_PREFER_LARGE_60) - { - DisplayModePtr best = Modes; - for (Mode = Modes; Mode; Mode = Mode->next) - { - 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 - 60.0); - double best_dist = fabs(best_refresh - 60.0); - if (mode_dist < best_dist) - { - best = Mode; - continue; - } - } - } - if (best) - best->type |= M_T_PREFERRED; - } + xf86DDCSetPreferredRefresh(scrnIndex, Modes, 60); + + if (quirks & DDC_QUIRK_PREFER_LARGE_75) + xf86DDCSetPreferredRefresh(scrnIndex, Modes, 75); + return Modes; } --- xorg-server-1.4.2.orig/hw/xfree86/modes/xf86Rotate.c +++ xorg-server-1.4.2/hw/xfree86/modes/xf86Rotate.c @@ -494,7 +494,8 @@ { ScrnInfoPtr pScrn = crtc->scrn; xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); - ScreenPtr pScreen = pScrn->pScreen; + /* if this is called during ScreenInit() we don't have pScrn->pScreen yet */ + ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex]; PictTransform crtc_to_fb, fb_to_crtc; PictureTransformIdentity (&crtc_to_fb); --- xorg-server-1.4.2.orig/hw/xfree86/os-support/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/os-support/Makefile.in @@ -162,7 +162,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -296,10 +296,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/os-support/lynxos/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/os-support/lynxos/Makefile.in @@ -122,7 +122,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -256,10 +256,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/os-support/usl/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/os-support/usl/Makefile.in @@ -122,7 +122,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -256,10 +256,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/os-support/misc/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/os-support/misc/Makefile.in @@ -143,7 +143,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -277,10 +277,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/os-support/shared/ia64Pci.h +++ xorg-server-1.4.2/hw/xfree86/os-support/shared/ia64Pci.h @@ -0,0 +1,46 @@ +/* + * Copyright 2004, Egbert Eich + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to 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 + * EGBERT EICH 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. + * + * Except as contained in this notice, the name of Egbert Eich shall not + * be used in advertising or otherwise to promote the sale, use or other deal- + *ings in this Software without prior written authorization from Egbert Eich. + * + */ +#ifdef HAVE_XORG_CONFIG_H +#include +#endif + +#ifndef _IA64_PCI_H +# define _IA64_PCI_H + +#include "Pci.h" + +typedef enum { + NONE_CHIPSET, + I460GX_CHIPSET, + E8870_CHIPSET, + ZX1_CHIPSET, + ALTIX_CHIPSET +} IA64Chipset; + +# ifdef OS_PROBE_PCI_CHIPSET +extern IA64Chipset OS_PROBE_PCI_CHIPSET(scanpciWrapperOpt flags); +# endif +#endif --- xorg-server-1.4.2.orig/hw/xfree86/os-support/solaris/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/os-support/solaris/Makefile.in @@ -175,7 +175,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -309,10 +309,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/os-support/sco/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/os-support/sco/Makefile.in @@ -122,7 +122,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -256,10 +256,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/os-support/sysv/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/os-support/sysv/Makefile.in @@ -122,7 +122,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -256,10 +256,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/os-support/bsd/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/os-support/bsd/Makefile.in @@ -167,7 +167,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -301,10 +301,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/os-support/hurd/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/os-support/hurd/Makefile.in @@ -144,7 +144,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -278,10 +278,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/os-support/bus/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/os-support/bus/Makefile.in @@ -179,7 +179,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -313,10 +313,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/os-support/linux/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/os-support/linux/Makefile.in @@ -171,7 +171,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -305,10 +305,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/x86emu/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/x86emu/Makefile.in @@ -145,7 +145,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -279,10 +279,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/loader/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/loader/Makefile.in @@ -156,7 +156,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -290,10 +290,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/ramdac/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/ramdac/Makefile.in @@ -156,7 +156,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -290,10 +290,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/xaa/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/xaa/Makefile.in @@ -175,7 +175,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -309,10 +309,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/xf8_32bpp/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/xf8_32bpp/Makefile.in @@ -159,7 +159,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -293,10 +293,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/exa/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/exa/Makefile.in @@ -160,7 +160,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -294,10 +294,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/vbe/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/vbe/Makefile.in @@ -156,7 +156,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -290,10 +290,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/xf4bpp/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/xf4bpp/Makefile.in @@ -164,7 +164,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -298,10 +298,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/doc/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/doc/Makefile.in @@ -134,7 +134,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -268,10 +268,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/doc/README.modes +++ xorg-server-1.4.2/hw/xfree86/doc/README.modes @@ -0,0 +1,474 @@ + 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.4.2.orig/hw/xfree86/doc/devel/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/doc/devel/Makefile.in @@ -125,7 +125,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -259,10 +259,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/doc/man/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/doc/man/Makefile.in @@ -138,7 +138,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -272,10 +272,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/doc/sgml/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/doc/sgml/Makefile.in @@ -145,7 +145,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -279,10 +279,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/scanpci/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/scanpci/Makefile.in @@ -158,7 +158,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -292,10 +292,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/shadowfb/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/shadowfb/Makefile.in @@ -156,7 +156,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -290,10 +290,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/i2c/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/i2c/Makefile.in @@ -205,7 +205,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -339,10 +339,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/common/xf86Helper.c +++ xorg-server-1.4.2/hw/xfree86/common/xf86Helper.c @@ -326,12 +326,11 @@ return idx; } -/* Allocate a new InputInfoRec and add it to the head xf86InputDevs. */ - +/* Allocate a new InputInfoRec and append it to the tail of xf86InputDevs. */ _X_EXPORT InputInfoPtr xf86AllocateInput(InputDriverPtr drv, int flags) { - InputInfoPtr new; + InputInfoPtr new, *prev = NULL; if (!(new = xcalloc(sizeof(InputInfoRec), 1))) return NULL; @@ -339,8 +338,13 @@ new->drv = drv; drv->refCount++; new->module = DuplicateModule(drv->module, NULL); - new->next = xf86InputDevs; - xf86InputDevs = new; + + for (prev = &xf86InputDevs; *prev; prev = &(*prev)->next) + ; + + *prev = new; + new->next = NULL; + return new; } @@ -462,10 +466,6 @@ #define GLOBAL_DEFAULT_DEPTH 24 #endif -#ifndef GLOBAL_DEFAULT_FBBPP -#define GLOBAL_DEFAULT_FBBPP 32 -#endif - _X_EXPORT Bool xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int dummy, int fbbpp, int depth24flags) @@ -543,7 +543,6 @@ if (depth > 0) scrp->depth = depth; } else { - scrp->bitsPerPixel = GLOBAL_DEFAULT_FBBPP; scrp->depth = GLOBAL_DEFAULT_DEPTH; } } --- xorg-server-1.4.2.orig/hw/xfree86/common/xf86VidMode.c +++ xorg-server-1.4.2/hw/xfree86/common/xf86VidMode.c @@ -157,10 +157,14 @@ return FALSE; pScrn = xf86Screens[scrnIndex]; - *mode = (pointer)(pScrn->currentMode); - *dotClock = pScrn->currentMode->Clock; - return TRUE; + if (pScrn->currentMode) { + *mode = (pointer)(pScrn->currentMode); + *dotClock = pScrn->currentMode->Clock; + + return TRUE; + } + return FALSE; } _X_EXPORT int --- xorg-server-1.4.2.orig/hw/xfree86/common/xf86RandR.c +++ xorg-server-1.4.2/hw/xfree86/common/xf86RandR.c @@ -171,6 +171,25 @@ 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. */ --- xorg-server-1.4.2.orig/hw/xfree86/common/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/common/Makefile.in @@ -191,7 +191,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -325,10 +325,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/xfree86/common/xf86Xinput.c +++ xorg-server-1.4.2/hw/xfree86/common/xf86Xinput.c @@ -737,10 +737,10 @@ ErrorF ("Divide by Zero in xf86ScaleAxis"); } - if (X > Sxlow) - X = Sxlow; - if (X < Sxhigh) + if (X > Sxhigh) X = Sxhigh; + if (X < Sxlow) + X = Sxlow; return (X); } --- xorg-server-1.4.2.orig/hw/xfree86/dummylib/Makefile.in +++ xorg-server-1.4.2/hw/xfree86/dummylib/Makefile.in @@ -166,7 +166,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -300,10 +300,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/darwin/Makefile.in +++ xorg-server-1.4.2/hw/darwin/Makefile.in @@ -318,7 +318,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -452,10 +452,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/darwin/README.apple +++ xorg-server-1.4.2/hw/darwin/README.apple @@ -0,0 +1,35 @@ +This directory contains a port of the XDarwin code to the modular X.org +codebase to be compiled on Darwin/OS X; this would not have been possible +without the help of Torrey Lyons and Peter O'Gorman, to whom I am +grateful for their patches, time and moral support. + +The server builds 4 targets: + +* XDarwin: this server runs on Darwin systems without Quartz + (i.e. non-OS X); it has not been well-tested. + +* XDarwinApp: this builds XDarwin.app, which is a full X server using + Quartz. It has loadable module support for AGL and CGL, and well as + fullscreen and rootless support. + +* Xquartz: this server runs on Quartz-based systems, and is meant to + work with X11.app + +* x11app: this builds a version of Apple's X11.app using patches by + Torrey Lyons; most, but not all, functionality of Apple's original + X11.app is present in this release. + +Known issues: + +* AGL and CGL support for 3D indirect acceleration does not work; + indirect.c has been rewritten, but not yet integrated into this source tree. + +* Fullscreen mode does not work; I don't know why. + +* Some features in X11.app are not yet implemented; these are marked + with #ifdef DARWIN_DDX_MISSING in the code. + +* The build system code could probably be cleaned up slightly. + +Any patches or code contributions would be most welcome and may be +sent to me at bbyer@apple.com. --- xorg-server-1.4.2.orig/hw/darwin/utils/Makefile.in +++ xorg-server-1.4.2/hw/darwin/utils/Makefile.in @@ -150,7 +150,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -284,10 +284,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/darwin/bundle/startXClients.cpp +++ xorg-server-1.4.2/hw/darwin/bundle/startXClients.cpp @@ -0,0 +1,24 @@ +XCOMM!/bin/sh + +XCOMM This script is used by XDarwin to start X clients when XDarwin is +XCOMM launched from the Finder. +XCOMM +XCOMM $XFree86: $ + +userclientrc=$HOME/.xinitrc +sysclientrc=XINITDIR/xinitrc +clientargs="" + +if [ -f $userclientrc ]; then + clientargs=$userclientrc +else if [ -f $sysclientrc ]; then + clientargs=$sysclientrc +fi +fi + +if [ "x$2" != "x" ]; then + PATH="$PATH:$2" + export PATH +fi + +exec xinit $clientargs -- XBINDIR/XDarwinStartup "$1" -idle --- xorg-server-1.4.2.orig/hw/darwin/bundle/Makefile.in +++ xorg-server-1.4.2/hw/darwin/bundle/Makefile.in @@ -154,7 +154,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -288,10 +288,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/darwin/bundle/German.lproj/Makefile.in +++ xorg-server-1.4.2/hw/darwin/bundle/German.lproj/Makefile.in @@ -139,7 +139,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -273,10 +273,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/darwin/bundle/Japanese.lproj/Makefile.in +++ xorg-server-1.4.2/hw/darwin/bundle/Japanese.lproj/Makefile.in @@ -139,7 +139,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -273,10 +273,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/darwin/bundle/English.lproj/Makefile.in +++ xorg-server-1.4.2/hw/darwin/bundle/English.lproj/Makefile.in @@ -139,7 +139,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -273,10 +273,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/darwin/bundle/French.lproj/Makefile.in +++ xorg-server-1.4.2/hw/darwin/bundle/French.lproj/Makefile.in @@ -139,7 +139,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -273,10 +273,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/darwin/bundle/Dutch.lproj/Makefile.in +++ xorg-server-1.4.2/hw/darwin/bundle/Dutch.lproj/Makefile.in @@ -139,7 +139,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -273,10 +273,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/darwin/bundle/Portuguese.lproj/Makefile.in +++ xorg-server-1.4.2/hw/darwin/bundle/Portuguese.lproj/Makefile.in @@ -139,7 +139,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -273,10 +273,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/darwin/bundle/Spanish.lproj/Makefile.in +++ xorg-server-1.4.2/hw/darwin/bundle/Spanish.lproj/Makefile.in @@ -139,7 +139,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -273,10 +273,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/darwin/bundle/Swedish.lproj/Makefile.in +++ xorg-server-1.4.2/hw/darwin/bundle/Swedish.lproj/Makefile.in @@ -139,7 +139,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -273,10 +273,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/darwin/bundle/ko.lproj/Makefile.in +++ xorg-server-1.4.2/hw/darwin/bundle/ko.lproj/Makefile.in @@ -139,7 +139,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -273,10 +273,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/darwin/quartz/Makefile.in +++ xorg-server-1.4.2/hw/darwin/quartz/Makefile.in @@ -168,7 +168,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -302,10 +302,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/darwin/quartz/fullscreen/quartzCursor.h +++ xorg-server-1.4.2/hw/darwin/quartz/fullscreen/quartzCursor.h @@ -0,0 +1,43 @@ +/* + * quartzCursor.h + * + * External interface for Quartz hardware cursor + */ +/* + * Copyright (c) 2001 Torrey T. Lyons and Greg Parker. + * 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. + */ + +#ifndef QUARTZCURSOR_H +#define QUARTZCURSOR_H + +#include "screenint.h" + +Bool QuartzInitCursor(ScreenPtr pScreen); +void QuartzReallySetCursor(void); +void QuartzSuspendXCursor(ScreenPtr pScreen); +void QuartzResumeXCursor(ScreenPtr pScreen, int x, int y); + +#endif --- xorg-server-1.4.2.orig/hw/darwin/quartz/xpr/appledri.h +++ xorg-server-1.4.2/hw/darwin/quartz/xpr/appledri.h @@ -0,0 +1,106 @@ +/************************************************************************** + +Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. +Copyright 2000 VA Linux Systems, Inc. +Copyright (c) 2002 Apple Computer, 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 + * + */ + +#ifndef _APPLEDRI_H_ +#define _APPLEDRI_H_ + +#include + +#define X_AppleDRIQueryVersion 0 +#define X_AppleDRIQueryDirectRenderingCapable 1 +#define X_AppleDRICreateSurface 2 +#define X_AppleDRIDestroySurface 3 +#define X_AppleDRIAuthConnection 4 +/* Requests up to and including 18 were used in a previous version */ + +/* Events */ +#define AppleDRIObsoleteEvent1 0 +#define AppleDRIObsoleteEvent2 1 +#define AppleDRIObsoleteEvent3 2 +#define AppleDRISurfaceNotify 3 +#define AppleDRINumberEvents 4 + +/* Errors */ +#define AppleDRIClientNotLocal 0 +#define AppleDRIOperationNotSupported 1 +#define AppleDRINumberErrors (AppleDRIOperationNotSupported + 1) + +/* Kinds of SurfaceNotify events: */ +#define AppleDRISurfaceNotifyChanged 0 +#define AppleDRISurfaceNotifyDestroyed 1 + +#ifndef _APPLEDRI_SERVER_ + +typedef struct { + int type; /* of event */ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came frome a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; /* window of event */ + Time time; /* server timestamp when event happened */ + int kind; /* subtype of event */ + int arg; +} XAppleDRINotifyEvent; + +_XFUNCPROTOBEGIN + +Bool XAppleDRIQueryExtension (Display *dpy, int *event_base, int *error_base); + +Bool XAppleDRIQueryVersion (Display *dpy, int *majorVersion, + int *minorVersion, int *patchVersion); + +Bool XAppleDRIQueryDirectRenderingCapable (Display *dpy, int screen, + Bool *isCapable); + +void *XAppleDRISetSurfaceNotifyHandler (void (*fun) (Display *dpy, + unsigned uid, int kind)); + +Bool XAppleDRIAuthConnection (Display *dpy, int screen, unsigned int magic); + +Bool XAppleDRICreateSurface (Display *dpy, int screen, Drawable drawable, + unsigned int client_id, unsigned int key[2], + unsigned int* uid); + +Bool XAppleDRIDestroySurface (Display *dpy, int screen, Drawable drawable); + +Bool XAppleDRISynchronizeSurfaces (Display *dpy); + +_XFUNCPROTOEND + +#endif /* _APPLEDRI_SERVER_ */ +#endif /* _APPLEDRI_H_ */ + --- xorg-server-1.4.2.orig/hw/darwin/quartz/xpr/dri.h +++ xorg-server-1.4.2/hw/darwin/quartz/xpr/dri.h @@ -0,0 +1,128 @@ +/************************************************************************** + +Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. +Copyright (c) 2002 Apple Computer, 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 + * + */ + +/* Prototypes for AppleDRI functions */ + +#ifndef _DRI_H_ +#define _DRI_H_ + +#include +#include "scrnintstr.h" +#define _APPLEDRI_SERVER_ +#include "appledri.h" +#include "Xplugin.h" + +typedef void (*ClipNotifyPtr)( WindowPtr, int, int ); + + +/* + * 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 { + WindowExposuresProcPtr WindowExposures; + CopyWindowProcPtr CopyWindow; + ValidateTreeProcPtr ValidateTree; + PostValidateTreeProcPtr PostValidateTree; + ClipNotifyProcPtr ClipNotify; +} DRIWrappedFuncsRec, *DRIWrappedFuncsPtr; + +typedef struct { + xp_surface_id id; + int kind; +} DRISurfaceNotifyArg; + +extern Bool DRIScreenInit(ScreenPtr pScreen); + +extern Bool DRIFinishScreenInit(ScreenPtr pScreen); + +extern void DRICloseScreen(ScreenPtr pScreen); + +extern Bool DRIExtensionInit(void); + +extern void DRIReset(void); + +extern Bool DRIQueryDirectRenderingCapable(ScreenPtr pScreen, + Bool *isCapable); + +extern Bool DRIAuthConnection(ScreenPtr pScreen, unsigned int magic); + +extern Bool DRICreateSurface(ScreenPtr pScreen, + Drawable id, + DrawablePtr pDrawable, + xp_client_id client_id, + xp_surface_id *surface_id, + unsigned int key[2], + void (*notify) (void *arg, void *data), + void *notify_data); + +extern Bool DRIDestroySurface(ScreenPtr pScreen, + Drawable id, + DrawablePtr pDrawable, + void (*notify) (void *arg, void *data), + void *notify_data); + +extern Bool DRIDrawablePrivDelete(pointer pResource, + XID id); + +extern DRIWrappedFuncsRec *DRIGetWrappedFuncs(ScreenPtr pScreen); + +extern void DRICopyWindow(WindowPtr pWin, + DDXPointRec ptOldOrg, + RegionPtr prgnSrc); + +extern int DRIValidateTree(WindowPtr pParent, + WindowPtr pChild, + VTKind kind); + +extern void DRIPostValidateTree(WindowPtr pParent, + WindowPtr pChild, + VTKind kind); + +extern void DRIClipNotify(WindowPtr pWin, + int dx, + int dy); + +extern void DRIWindowExposures(WindowPtr pWin, + RegionPtr prgn, + RegionPtr bsreg); + +extern void DRISurfaceNotify (xp_surface_id id, int kind); + +extern void DRIQueryVersion(int *majorVersion, + int *minorVersion, + int *patchVersion); + +#endif --- xorg-server-1.4.2.orig/hw/darwin/quartz/xpr/appledristr.h +++ xorg-server-1.4.2/hw/darwin/quartz/xpr/appledristr.h @@ -0,0 +1,175 @@ +/************************************************************************** + +Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. +Copyright 2000 VA Linux Systems, Inc. +Copyright (c) 2002 Apple Computer, 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) Fiath + * + */ + +#ifndef _APPLEDRISTR_H_ +#define _APPLEDRISTR_H_ + +#include "appledri.h" + +#define APPLEDRINAME "Apple-DRI" + +#define APPLE_DRI_MAJOR_VERSION 1 /* current version numbers */ +#define APPLE_DRI_MINOR_VERSION 0 +#define APPLE_DRI_PATCH_VERSION 0 + +typedef struct _AppleDRIQueryVersion { + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* always X_DRIQueryVersion */ + CARD16 length B16; +} xAppleDRIQueryVersionReq; +#define sz_xAppleDRIQueryVersionReq 4 + +typedef struct { + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD16 majorVersion B16; /* major version of DRI protocol */ + CARD16 minorVersion B16; /* minor version of DRI protocol */ + CARD32 patchVersion B32; /* patch version of DRI protocol */ + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xAppleDRIQueryVersionReply; +#define sz_xAppleDRIQueryVersionReply 32 + +typedef struct _AppleDRIQueryDirectRenderingCapable { + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* X_DRIQueryDirectRenderingCapable */ + CARD16 length B16; + CARD32 screen B32; +} xAppleDRIQueryDirectRenderingCapableReq; +#define sz_xAppleDRIQueryDirectRenderingCapableReq 8 + +typedef struct { + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequenceNumber B16; + CARD32 length B32; + BOOL isCapable; + BOOL pad2; + BOOL pad3; + BOOL pad4; + CARD32 pad5 B32; + CARD32 pad6 B32; + CARD32 pad7 B32; + CARD32 pad8 B32; + CARD32 pad9 B32; +} xAppleDRIQueryDirectRenderingCapableReply; +#define sz_xAppleDRIQueryDirectRenderingCapableReply 32 + +typedef struct _AppleDRIAuthConnection { + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* always X_DRICloseConnection */ + CARD16 length B16; + CARD32 screen B32; + CARD32 magic B32; +} xAppleDRIAuthConnectionReq; +#define sz_xAppleDRIAuthConnectionReq 12 + +typedef struct { + BYTE type; + BOOL pad1; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 authenticated B32; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xAppleDRIAuthConnectionReply; +#define zx_xAppleDRIAuthConnectionReply 32 + +typedef struct _AppleDRICreateSurface { + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* always X_DRICreateSurface */ + CARD16 length B16; + CARD32 screen B32; + CARD32 drawable B32; + CARD32 client_id B32; +} xAppleDRICreateSurfaceReq; +#define sz_xAppleDRICreateSurfaceReq 16 + +typedef struct { + BYTE type; /* X_Reply */ + BOOL pad1; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 key_0 B32; + CARD32 key_1 B32; + CARD32 uid B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xAppleDRICreateSurfaceReply; +#define sz_xAppleDRICreateSurfaceReply 32 + +typedef struct _AppleDRIDestroySurface { + CARD8 reqType; /* always DRIReqCode */ + CARD8 driReqType; /* always X_DRIDestroySurface */ + CARD16 length B16; + CARD32 screen B32; + CARD32 drawable B32; +} xAppleDRIDestroySurfaceReq; +#define sz_xAppleDRIDestroySurfaceReq 12 + +typedef struct _AppleDRINotify { + BYTE type; /* always eventBase + event type */ + BYTE kind; + CARD16 sequenceNumber B16; + Time time B32; /* time of change */ + CARD16 pad1 B16; + CARD32 arg B32; + CARD32 pad3 B32; +} xAppleDRINotifyEvent; +#define sz_xAppleDRINotifyEvent 20 + +#ifdef _APPLEDRI_SERVER_ + +void AppleDRISendEvent ( +#if NeedFunctionPrototypes + int /* type */, + unsigned int /* mask */, + int /* which */, + int /* arg */ +#endif +); + +#endif /* _APPLEDRI_SERVER_ */ +#endif /* _APPLEDRISTR_H_ */ --- xorg-server-1.4.2.orig/hw/darwin/quartz/xpr/Xplugin.h +++ xorg-server-1.4.2/hw/darwin/quartz/xpr/Xplugin.h @@ -0,0 +1,589 @@ +/* Xplugin.h -- windowing API for rootless X11 server + + Copyright (c) 2002 Apple Computer, 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 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. + + Note that these interfaces are provided solely for the use of the + X11 server. Any other uses are unsupported and strongly discouraged. */ + +#ifndef XPLUGIN_H +#define XPLUGIN_H 1 + +#include + +/* By default we use the X server definition of BoxRec to define xp_box, + so that the compiler can silently convert between the two. But if + XP_NO_X_HEADERS is defined, we'll define it ourselves. */ + +#ifndef XP_NO_X_HEADERS +# include "miscstruct.h" + typedef BoxRec xp_box; +#else + struct xp_box_struct { + short x1, y1, x2, y2; + }; + typedef struct xp_box_struct xp_box; +#endif + +typedef unsigned int xp_resource_id; +typedef xp_resource_id xp_window_id; +typedef xp_resource_id xp_surface_id; +typedef unsigned int xp_client_id; +typedef unsigned int xp_request_type; +typedef int xp_error; +typedef int xp_bool; + + +/* Error codes that the functions declared here may return. They all + numerically match their X equivalents, i.e. the XP_ can be dropped + if has been included. */ + +enum xp_error_enum { + XP_Success = 0, + XP_BadRequest = 1, + XP_BadValue = 2, + XP_BadWindow = 3, + XP_BadMatch = 8, + XP_BadAccess = 10, + XP_BadImplementation = 17, +}; + + +/* Event types generated by the plugin. */ + +enum xp_event_type_enum { + /* The global display configuration changed somehow. */ + XP_EVENT_DISPLAY_CHANGED = 1 << 0, + + /* A window changed state. Argument is xp_window_state_event */ + XP_EVENT_WINDOW_STATE_CHANGED = 1 << 1, + + /* An async request encountered an error. Argument is of type + xp_async_error_event */ + XP_EVENT_ASYNC_ERROR = 1 << 2, + + /* Sent when a surface is destroyed as a side effect of destroying + a window. Arg is of type xp_surface_id. */ + XP_EVENT_SURFACE_DESTROYED = 1 << 3, + + /* Sent when any GL contexts pointing at the given surface need to + call xp_update_gl_context () to refresh their state (because the + window moved or was resized. Arg is of type xp_surface_id. */ + XP_EVENT_SURFACE_CHANGED = 1 << 4, + + /* Sent when a window has been moved. Arg is of type xp_window_id. */ + XP_EVENT_WINDOW_MOVED = 1 << 5, +}; + +/* Function type used to receive events. */ + +typedef void (xp_event_fun) (unsigned int type, const void *arg, + unsigned int arg_size, void *user_data); + + +/* Operation types. Used when reporting errors asynchronously. */ + +enum xp_request_type_enum { + XP_REQUEST_NIL = 0, + XP_REQUEST_DESTROY_WINDOW = 1, + XP_REQUEST_CONFIGURE_WINDOW = 2, + XP_REQUEST_FLUSH_WINDOW = 3, + XP_REQUEST_COPY_WINDOW = 4, + XP_REQUEST_UNLOCK_WINDOW = 5, + XP_REQUEST_DISABLE_UPDATE = 6, + XP_REQUEST_REENABLE_UPDATE = 7, + XP_REQUEST_HIDE_CURSOR = 8, + XP_REQUEST_SHOW_CURSOR = 9, + XP_REQUEST_FRAME_DRAW = 10, +}; + +/* Structure used to report an error asynchronously. Passed as the "arg" + of an XP_EVENT_ASYNC_ERROR event. */ + +struct xp_async_error_event_struct { + xp_request_type request_type; + xp_resource_id id; + xp_error error; +}; + +typedef struct xp_async_error_event_struct xp_async_error_event; + + +/* Possible window states. */ + +enum xp_window_state_enum { + /* The window is not in the global list of possibly-visible windows. */ + XP_WINDOW_STATE_OFFSCREEN = 1 << 0, + + /* Parts of the window may be obscured by other windows. */ + XP_WINDOW_STATE_OBSCURED = 1 << 1, +}; + +/* Structure passed as argument of an XP_EVENT_WINDOW_STATE_CHANGED event. */ + +struct xp_window_state_event_struct { + xp_window_id id; + unsigned int state; +}; + +typedef struct xp_window_state_event_struct xp_window_state_event; + + +/* Function type used to supply a colormap for indexed drawables. */ + +typedef xp_error (xp_colormap_fun) (void *data, int first_color, + int n_colors, uint32_t *colors); + + +/* Window attributes structure. Used when creating and configuring windows. + Also used when configuring surfaces attached to windows. Functions that + take one of these structures also take a bit mask defining which + fields are set to meaningful values. */ + +enum xp_window_changes_enum { + XP_ORIGIN = 1 << 0, + XP_SIZE = 1 << 1, + XP_BOUNDS = XP_ORIGIN | XP_SIZE, + XP_SHAPE = 1 << 2, + XP_STACKING = 1 << 3, + XP_DEPTH = 1 << 4, + XP_COLORMAP = 1 << 5, + XP_WINDOW_LEVEL = 1 << 6, +}; + +struct xp_window_changes_struct { + /* XP_ORIGIN */ + int x, y; + + /* XP_SIZE */ + unsigned int width, height; + int bit_gravity; /* how to resize the backing store */ + + /* XP_SHAPE */ + int shape_nrects; /* -1 = remove shape */ + xp_box *shape_rects; + int shape_tx, shape_ty; /* translation for shape */ + + /* XP_STACKING */ + int stack_mode; + xp_window_id sibling; /* may be zero; in ABOVE/BELOW modes + it may specify a relative window */ + /* XP_DEPTH, window-only */ + unsigned int depth; + + /* XP_COLORMAP, window-only */ + xp_colormap_fun *colormap; + void *colormap_data; + + /* XP_WINDOW_LEVEL, window-only */ + int window_level; +}; + +typedef struct xp_window_changes_struct xp_window_changes; + +/* Values for bit_gravity field */ + +enum xp_bit_gravity_enum { + XP_GRAVITY_NONE = 0, /* no gravity, fill everything */ + XP_GRAVITY_NORTH_WEST = 1, /* anchor to top-left corner */ + XP_GRAVITY_NORTH_EAST = 2, /* anchor to top-right corner */ + XP_GRAVITY_SOUTH_EAST = 3, /* anchor to bottom-right corner */ + XP_GRAVITY_SOUTH_WEST = 4, /* anchor to bottom-left corner */ +}; + +/* Values for stack_mode field */ + +enum xp_window_stack_mode_enum { + XP_UNMAPPED = 0, /* remove the window */ + XP_MAPPED_ABOVE = 1, /* display the window on top */ + XP_MAPPED_BELOW = 2, /* display the window at bottom */ +}; + +/* Data formats for depth field and composite functions */ + +enum xp_depth_enum { + XP_DEPTH_NIL = 0, /* null source when compositing */ + XP_DEPTH_ARGB8888, + XP_DEPTH_RGB555, + XP_DEPTH_A8, /* for masks when compositing */ + XP_DEPTH_INDEX8, +}; + +/* Options that may be passed to the xp_init () function. */ + +enum xp_init_options_enum { + /* Don't mark that this process can be in the foreground. */ + XP_IN_BACKGROUND = 1 << 0, + + /* Deliver background pointer events to this process. */ + XP_BACKGROUND_EVENTS = 1 << 1, +}; + + + +/* Miscellaneous functions */ + +/* Initialize the plugin library. Only the copy/fill/composite functions + may be called without having previously called xp_init () */ + +extern xp_error xp_init (unsigned int options); + +/* Sets the current set of requested notifications to MASK. When any of + these arrive, CALLBACK will be invoked with CALLBACK-DATA. Note that + calling this function cancels any previously requested notifications + that aren't set in MASK. */ + +extern xp_error xp_select_events (unsigned int mask, + xp_event_fun *callback, + void *callback_data); + +/* Waits for all initiated operations to complete. */ + +extern xp_error xp_synchronize (void); + +/* Causes any display update initiated through the plugin libary to be + queued until update is reenabled. Note that calls to these functions + nest. */ + +extern xp_error xp_disable_update (void); +extern xp_error xp_reenable_update (void); + + + +/* Cursor functions. */ + +/* Installs the specified cursor. ARGB-DATA should point to 32-bit + premultiplied big-endian ARGB data. The HOT-X,HOT-Y parameters + specify the offset to the cursor's hot spot from its top-left + corner. */ + +extern xp_error xp_set_cursor (unsigned int width, unsigned int height, + unsigned int hot_x, unsigned int hot_y, + const uint32_t *argb_data, + unsigned int rowbytes); + +/* Hide and show the cursor if it's owned by the current process. Calls + to these functions nest. */ + +extern xp_error xp_hide_cursor (void); +extern xp_error xp_show_cursor (void); + + + +/* Window functions. */ + +/* Create a new window as defined by MASK and VALUES. MASK must contain + XP_BOUNDS or an error is raised. The id of the newly created window + is stored in *RET-ID if this function returns XP_Success. */ + +extern xp_error xp_create_window (unsigned int mask, + const xp_window_changes *values, + xp_window_id *ret_id); + +/* Destroys the window identified by ID. */ + +extern xp_error xp_destroy_window (xp_window_id id); + +/* Reconfigures the given window according to MASK and VALUES. */ + +extern xp_error xp_configure_window (xp_window_id id, unsigned int mask, + const xp_window_changes *values); + + +/* Returns true if NATIVE-ID is a window created by the plugin library. + If so and RET-ID is non-null, stores the id of the window in *RET-ID. */ + +extern xp_bool xp_lookup_native_window (unsigned int native_id, + xp_window_id *ret_id); + +/* If ID names a window created by the plugin library, stores it's native + window id in *RET-NATIVE-ID. */ + +extern xp_error xp_get_native_window (xp_window_id id, + unsigned int *ret_native_id); + + +/* Locks the rectangle IN-RECT (or, if null, the entire window) of the + given window's backing store. Any other non-null parameters are filled + in as follows: + + DEPTH = format of returned data. Currently either XP_DEPTH_ARGB8888 + or XP_DEPTH_RGB565 (possibly with 8 bit planar alpha). Data is + always stored in native byte order. + + BITS[0] = pointer to top-left pixel of locked color data + BITS[1] = pointer to top-left of locked alpha data, or null if window + has no alpha. If the alpha data is meshed, then BITS[1] = BITS[0]. + + ROWBYTES[0,1] = size in bytes of each row of color,alpha data + + OUT-RECT = rectangle specifying the current position and size of the + locked region relative to the window origin. + + Note that an error is raised when trying to lock an already locked + window. While the window is locked, the only operations that may + be performed on it are to modify, access or flush its marked region. */ + +extern xp_error xp_lock_window (xp_window_id id, + const xp_box *in_rect, + unsigned int *depth, + void *bits[2], + unsigned int rowbytes[2], + xp_box *out_rect); + +/* Mark that the region specified by SHAPE-NRECTS, SHAPE-RECTS, + SHAPE-TX, and SHAPE-TY in the specified window has been updated, and + will need to subsequently be redisplayed. */ + +extern xp_error xp_mark_window (xp_window_id id, int shape_nrects, + const xp_box *shape_rects, + int shape_tx, int shape_ty); + +/* Unlocks the specified window. If FLUSH is true, then any marked + regions are immediately redisplayed. Note that it's an error to + unlock an already unlocked window. */ + +extern xp_error xp_unlock_window (xp_window_id id, xp_bool flush); + +/* If anything is marked in the given window for redisplay, do it now. */ + +extern xp_error xp_flush_window (xp_window_id id); + +/* Moves the contents of the region DX,DY pixels away from that specified + by DST_RECTS and DST_NRECTS in the window with SRC-ID to the + destination region in the window DST-ID. Note that currently source + and destination windows must be the same. */ + +extern xp_error xp_copy_window (xp_window_id src_id, xp_window_id dst_id, + int dst_nrects, const xp_box *dst_rects, + int dx, int dy); + +/* Returns true if the given window has any regions marked for + redisplay. */ + +extern xp_bool xp_is_window_marked (xp_window_id id); + +/* If successful returns a superset of the region marked for update in + the given window. Use xp_free_region () to release the returned data. */ + +extern xp_error xp_get_marked_shape (xp_window_id id, + int *ret_nrects, xp_box **ret_rects); + +extern void xp_free_shape (int nrects, xp_box *rects); + +/* Searches for the first window below ABOVE-ID containing the point X,Y, + and returns it's window id in *RET-ID. If no window is found, *RET-ID + is set to zero. If ABOVE-ID is zero, finds the topmost window + containing the given point. */ + +extern xp_error xp_find_window (int x, int y, xp_window_id above_id, + xp_window_id *ret_id); + +/* Returns the current origin and size of the window ID in *BOUNDS-RET if + successful. */ +extern xp_error xp_get_window_bounds (xp_window_id id, xp_box *bounds_ret); + + + +/* Window surface functions. */ + +/* Create a new VRAM surface on the specified window. If successful, + returns the identifier of the new surface in *RET-SID. */ + +extern xp_error xp_create_surface (xp_window_id id, xp_surface_id *ret_sid); + +/* Destroys the specified surface. */ + +extern xp_error xp_destroy_surface (xp_surface_id sid); + +/* Reconfigures the specified surface as defined by MASK and VALUES. + Note that specifying XP_DEPTH is an error. */ + +extern xp_error xp_configure_surface (xp_surface_id sid, unsigned int mask, + const xp_window_changes *values); + +/* If successful, places the client identifier of the current process + in *RET-CLIENT. */ + +extern xp_error xp_get_client_id (xp_client_id *ret_client); + +/* Given a valid window,surface combination created by the current + process, attempts to allow the specified external client access + to that surface. If successful, returns two integers in RET-KEY + which the client can use to import the surface into their process. */ + +extern xp_error xp_export_surface (xp_window_id wid, xp_surface_id sid, + xp_client_id client, + unsigned int ret_key[2]); + +/* Given a two integer key returned from xp_export_surface (), tries + to import the surface into the current process. If successful the + local surface identifier is stored in *SID-RET. */ + +extern xp_error xp_import_surface (const unsigned int key[2], + xp_surface_id *sid_ret); + +/* If successful, stores the number of surfaces attached to the + specified window in *RET. */ + +extern xp_error xp_get_window_surface_count (xp_window_id id, + unsigned int *ret); + +/* Attaches the CGLContextObj CGL-CTX to the specified surface. */ + +extern xp_error xp_attach_gl_context (void *cgl_ctx, xp_surface_id sid); + +/* Updates the CGLContextObj CGL-CTX to reflect any recent changes to + the surface it's attached to. */ + +extern xp_error xp_update_gl_context (void *cgl_ctx); + + + +/* Window frame functions. */ + +/* Possible arguments to xp_frame_get_rect (). */ + +enum xp_frame_rect_enum { + XP_FRAME_RECT_TITLEBAR = 1, + XP_FRAME_RECT_TRACKING = 2, + XP_FRAME_RECT_GROWBOX = 3, +}; + +/* Classes of window frame. */ + +enum xp_frame_class_enum { + XP_FRAME_CLASS_DOCUMENT = 1 << 0, + XP_FRAME_CLASS_DIALOG = 1 << 1, + XP_FRAME_CLASS_MODAL_DIALOG = 1 << 2, + XP_FRAME_CLASS_SYSTEM_MODAL_DIALOG = 1 << 3, + XP_FRAME_CLASS_UTILITY = 1 << 4, + XP_FRAME_CLASS_TOOLBAR = 1 << 5, + XP_FRAME_CLASS_MENU = 1 << 6, + XP_FRAME_CLASS_SPLASH = 1 << 7, + XP_FRAME_CLASS_BORDERLESS = 1 << 8, +}; + +/* Attributes of window frames. */ + +enum xp_frame_attr_enum { + XP_FRAME_ACTIVE = 0x0001, + XP_FRAME_URGENT = 0x0002, + XP_FRAME_TITLE = 0x0004, + XP_FRAME_PRELIGHT = 0x0008, + XP_FRAME_SHADED = 0x0010, + XP_FRAME_CLOSE_BOX = 0x0100, + XP_FRAME_COLLAPSE = 0x0200, + XP_FRAME_ZOOM = 0x0400, + XP_FRAME_ANY_BUTTON = 0x0700, + XP_FRAME_CLOSE_BOX_CLICKED = 0x0800, + XP_FRAME_COLLAPSE_BOX_CLICKED = 0x1000, + XP_FRAME_ZOOM_BOX_CLICKED = 0x2000, + XP_FRAME_ANY_CLICKED = 0x3800, + XP_FRAME_GROW_BOX = 0x4000, +}; + +#define XP_FRAME_ATTR_IS_SET(a,b) (((a) & (b)) == (b)) +#define XP_FRAME_ATTR_IS_CLICKED(a,m) ((a) & ((m) << 3)) +#define XP_FRAME_ATTR_SET_CLICKED(a,m) ((a) |= ((m) << 3)) +#define XP_FRAME_ATTR_UNSET_CLICKED(a,m) ((a) &= ~((m) << 3)) + +#define XP_FRAME_POINTER_ATTRS (XP_FRAME_PRELIGHT \ + | XP_FRAME_ANY_BUTTON \ + | XP_FRAME_ANY_CLICKED) + +extern xp_error xp_frame_get_rect (int type, int class, const xp_box *outer, + const xp_box *inner, xp_box *ret); +extern xp_error xp_frame_hit_test (int class, int x, int y, + const xp_box *outer, + const xp_box *inner, int *ret); +extern xp_error xp_frame_draw (xp_window_id wid, int class, unsigned int attr, + const xp_box *outer, const xp_box *inner, + unsigned int title_len, + const unsigned char *title_bytes); + + + +/* Memory manipulation functions. */ + +enum xp_composite_op_enum { + XP_COMPOSITE_SRC = 0, + XP_COMPOSITE_OVER, +}; + +#define XP_COMPOSITE_FUNCTION(op, src_depth, mask_depth, dest_depth) \ + (((op) << 24) | ((src_depth) << 16) \ + | ((mask_depth) << 8) | ((dest_depth) << 0)) + +#define XP_COMPOSITE_FUNCTION_OP(f) (((f) >> 24) & 255) +#define XP_COMPOSITE_FUNCTION_SRC_DEPTH(f) (((f) >> 16) & 255) +#define XP_COMPOSITE_FUNCTION_MASK_DEPTH(f) (((f) >> 8) & 255) +#define XP_COMPOSITE_FUNCTION_DEST_DEPTH(f) (((f) >> 0) & 255) + +/* Composite WIDTH by HEIGHT pixels from source and mask to destination + using a specified function (if source and destination overlap, + undefined behavior results). + + For SRC and DEST, the first element of the array is the color data. If + the second element is non-null it implies that there is alpha data + (which may be meshed or planar). Data without alpha is assumed to be + opaque. + + Passing a null SRC-ROWBYTES pointer implies that the data SRC points + to is a single element. + + Operations that are not supported will return XP_BadImplementation. */ + +extern xp_error xp_composite_pixels (unsigned int width, unsigned int height, + unsigned int function, + void *src[2], unsigned int src_rowbytes[2], + void *mask, unsigned int mask_rowbytes, + void *dest[2], unsigned int dest_rowbytes[2]); + +/* Fill HEIGHT rows of data starting at DST. Each row will have WIDTH + bytes filled with the 32-bit pattern VALUE. Each row is DST-ROWBYTES + wide in total. */ + +extern void xp_fill_bytes (unsigned int width, + unsigned int height, uint32_t value, + void *dst, unsigned int dst_rowbytes); + +/* Copy HEIGHT rows of bytes from SRC to DST. Each row will have WIDTH + bytes copied. SRC and DST may overlap, and the right thing will happen. */ + +extern void xp_copy_bytes (unsigned int width, unsigned int height, + const void *src, unsigned int src_rowbytes, + void *dst, unsigned int dst_rowbytes); + +/* Suggestions for the minimum number of bytes or pixels for which it + makes sense to use some of the xp_ functions */ + +extern unsigned int xp_fill_bytes_threshold, xp_copy_bytes_threshold, + xp_composite_area_threshold, xp_scroll_area_threshold; + + +#endif /* XPLUGIN_H */ --- xorg-server-1.4.2.orig/hw/darwin/quartz/xpr/dristruct.h +++ xorg-server-1.4.2/hw/darwin/quartz/xpr/dristruct.h @@ -0,0 +1,81 @@ +/************************************************************************** + +Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. +Copyright (c) 2002 Apple Computer, 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 + * + */ + +#ifndef DRI_STRUCT_H +#define DRI_STRUCT_H + +#include "dri.h" +#include "x-list.h" + +#define DRI_MAX_DRAWABLES 256 + +#define DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin) \ + ((DRIWindowPrivIndex < 0) ? \ + NULL : \ + ((DRIDrawablePrivPtr)((pWin)->devPrivates[DRIWindowPrivIndex].ptr))) + +#define DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix) \ + ((DRIPixmapPrivIndex < 0) ? \ + NULL : \ + ((DRIDrawablePrivPtr)((pPix)->devPrivates[DRIPixmapPrivIndex].ptr))) + +typedef struct _DRIDrawablePrivRec +{ + xp_surface_id sid; + int drawableIndex; + DrawablePtr pDraw; + ScreenPtr pScreen; + int refCount; + unsigned int key[2]; + x_list *notifiers; /* list of (FUN . DATA) */ +} DRIDrawablePrivRec, *DRIDrawablePrivPtr; + +#define DRI_SCREEN_PRIV(pScreen) \ + ((DRIScreenPrivIndex < 0) ? \ + NULL : \ + ((DRIScreenPrivPtr)((pScreen)->devPrivates[DRIScreenPrivIndex].ptr))) + +#define DRI_SCREEN_PRIV_FROM_INDEX(screenIndex) ((DRIScreenPrivPtr) \ + (screenInfo.screens[screenIndex]->devPrivates[DRIScreenPrivIndex].ptr)) + + +typedef struct _DRIScreenPrivRec +{ + Bool directRenderingSupport; + int nrWindows; + DRIWrappedFuncsRec wrap; + DrawablePtr DRIDrawables[DRI_MAX_DRAWABLES]; +} DRIScreenPrivRec, *DRIScreenPrivPtr; + +#endif /* DRI_STRUCT_H */ --- xorg-server-1.4.2.orig/hw/darwin/quartz/xpr/xpr.h +++ xorg-server-1.4.2/hw/darwin/quartz/xpr/xpr.h @@ -0,0 +1,47 @@ +/* + * Xplugin rootless implementation + */ +/* + * 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, sublicense, + * and/or sell copies of the Software, and to 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. + */ + +#ifndef XPR_H +#define XPR_H + +#include "screenint.h" + +extern Bool QuartzModeBundleInit(void); + +void AppleDRIExtensionInit(void); +void xprAppleWMInit(void); +Bool xprInit(ScreenPtr pScreen); +Bool xprIsX11Window(void *nsWindow, int windowNumber); +void xprHideWindows(Bool hide); + +Bool QuartzInitCursor(ScreenPtr pScreen); +void QuartzSuspendXCursor(ScreenPtr pScreen); +void QuartzResumeXCursor(ScreenPtr pScreen, int x, int y); + +#endif /* XPR_H */ --- xorg-server-1.4.2.orig/hw/darwin/quartz/xpr/x-hook.h +++ xorg-server-1.4.2/hw/darwin/quartz/xpr/x-hook.h @@ -0,0 +1,42 @@ +/* x-hook.h -- lists of function,data pairs to call. + + Copyright (c) 2003 Apple Computer, 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 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. */ + +#ifndef X_HOOK_H +#define X_HOOK_H 1 + +#include "x-list.h" + +typedef void x_hook_function (void *arg, void *data); + +X_EXTERN x_list *X_PFX (hook_add) (x_list *lst, x_hook_function *fun, void *data); +X_EXTERN x_list *X_PFX (hook_remove) (x_list *lst, x_hook_function *fun, void *data); +X_EXTERN void X_PFX (hook_run) (x_list *lst, void *arg); +X_EXTERN void X_PFX (hook_free) (x_list *lst); + +#endif /* X_HOOK_H */ --- xorg-server-1.4.2.orig/hw/darwin/quartz/cr/XView.h +++ xorg-server-1.4.2/hw/darwin/quartz/cr/XView.h @@ -0,0 +1,41 @@ +/* + * NSView subclass for Mac OS X rootless X server + * + * Copyright (c) 2001 Greg Parker. 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. + */ + +#import + +@interface XView : NSQuickDrawView + +- (BOOL)isFlipped; +- (BOOL)isOpaque; +- (BOOL)acceptsFirstResponder; +- (BOOL)acceptsFirstMouse:(NSEvent *)theEvent; +- (BOOL)shouldDelayWindowOrderingForEvent:(NSEvent *)theEvent; + +- (void)mouseDown:(NSEvent *)anEvent; + +@end --- xorg-server-1.4.2.orig/hw/darwin/quartz/cr/cr.h +++ xorg-server-1.4.2/hw/darwin/quartz/cr/cr.h @@ -0,0 +1,61 @@ +/* + * Internal definitions of the Cocoa rootless implementation + */ +/* + * 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, sublicense, + * and/or sell copies of the Software, and to 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. + */ + +#ifndef _CR_H +#define _CR_H + +#ifdef __OBJC__ +#import +#import "XView.h" +#else +typedef struct OpaqueNSWindow NSWindow; +typedef struct OpaqueXView XView; +#endif + +#undef BOOL +#define BOOL xBOOL +#include "screenint.h" +#include "window.h" +#undef BOOL + +// Predefined style for the window which is about to be framed +extern WindowPtr nextWindowToFrame; +extern unsigned int nextWindowStyle; + +typedef struct { + NSWindow *window; + XView *view; + GrafPtr port; + CGContextRef context; +} CRWindowRec, *CRWindowPtr; + +Bool CRInit(ScreenPtr pScreen); +void CRAppleWMInit(void); + +#endif /* _CR_H */ --- xorg-server-1.4.2.orig/hw/darwin/iokit/Makefile.in +++ xorg-server-1.4.2/hw/darwin/iokit/Makefile.in @@ -145,7 +145,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -279,10 +279,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/hw/darwin/apple/Xquartz.man +++ xorg-server-1.4.2/hw/darwin/apple/Xquartz.man @@ -0,0 +1,158 @@ +.\" $XFree86: xc/programs/Xserver/hw/darwin/XDarwin.man,v 1.4 2002/01/09 18:01:58 torrey Exp $ +.\" +.TH XQUARTZ 1 __vendorversion__ +.SH NAME +Xquartz \- X window system server for Quartz operating system +.SH SYNOPSIS +.B Xquartz +[ options ] ... +.SH DESCRIPTION +.I Xquartz +is the X window server for Mac OS X provided by Apple. +.I Xquartz +runs in parallel with Aqua in rootless mode. In rootless mode, the X +window system and Mac OS X share your display. The root window of the +X11 display is the size of the screen and contains all the other +windows. The X11 root window is not displayed in rootless mode as Mac +OS X handles the desktop background. +.SH OPTIONS +.PP +In addition to the normal server options described in the \fIXserver(1)\fP +manual page, \fIXquartz\fP accepts the following command line switches: +.TP 8 +.B \-fakebuttons +Emulates a 3 button mouse using modifier keys. By default, the Command modifier +is used to emulate button 2 and Option is used for button 3. Thus, clicking the +first mouse button while holding down Command will act like clicking +button 2. Holding down Option will simulate button 3. +.TP 8 +.B \-nofakebuttons +Do not emulate a 3 button mouse. This is the default. +.TP 8 +.B "\-fakemouse2 \fImodifiers\fP" +Change the modifier keys used to emulate the second mouse button. By default, +Command is used to emulate the second button. Any combination of the following +modifier names may be used: Shift, Option, Control, Command, Fn. For example, +.B \-fakemouse2 """Option,Shift"" +will set holding Option, Shift and clicking on button one as equivalent to +clicking the second mouse button. +.TP 8 +.B "\-fakemouse3 \fImodifiers\fP" +Change the modifier keys used to emulate the third mouse button. By default, +Option is used to emulate the third button. Any combination of the following +modifier names may be used: Shift, Option, Control, Command, Fn. For example, +.B \-fakemouse3 """Control,Shift"" +will set holding Control, Shift and clicking on button one as equivalent to +clicking the third mouse button. +.TP 8 +.B "\-swapAltMeta" +Swaps the meaning of the Alt and Meta modifier keys. +.TP 8 +.B "\-keymap \fIfile\fP" +On startup \fIXquartz\fP translates a Darwin keymapping into an X keymap. +The default is to read this keymapping from USA.keymapping. With this option +the keymapping will be read from \fIfile\fP instead. If the file's path is +not specified, it will be searched for in Library/Keyboards/ underneath the +following directories (in order): ~, /, /Network, /System. +.TP 8 +.B \-nokeymap +On startup \fIXquartz\fP translates a Darwin keymapping into an X keymap. +With this option \fIXquartz\fP queries the kernel for the current keymapping +instead of reading it from a file. This will often fail on newer kernels. +.TP 8 +.B "\-depth \fIdepth\fP" +Specifies the color bit depth to use. Currently only 15, and 24 color +bits per pixel are supported. If not specified, defaults to the depth +of the main display. +.SH CUSTOMIZATION +\fIXquartz\fP can also be customized using the defaults(1) command. The available options are: +.TP 8 +.B defaults write com.apple.x11 enable_fake_buttons -boolean true +Equivalent to the \fB-fakebuttons\fP command line option. +.TP 8 +.B defaults write com.apple.x11 fake_button2 \fImodifiers\fP +Equivalent to the \fB-fakemouse2\fP option. +.TP 8 +.B defaults write com.apple.x11 fake_button3 \fImodifiers\fP +Equivalent to the \fB-fakemouse3\fP option. +.TP 8 +.B defaults write com.apple.x11 swap_alt_meta -boolean true +Equivalent to the \fB-swapAltMeta\fP option. +.TP 8 +.B defaults write com.apple.x11 keymap_file \fIfilename\fP +Equivalent to the \fB-keymap\fP option. +.TP 8 +.B defaults write com.apple.x11 no_quit_alert -boolean true +Disables the alert dialog displayed when attempting to quit X11. +.TP 8 +.B defaults write com.apple.x11 no_auth -boolean true +Stops the X server requiring that clients authenticate themselves when +connecting. See Xsecurity(__miscmansuffix__). +.TP 8 +.B defaults write com.apple.x11 nolisten_tcp -boolean true +Prevents the X server accepting remote connections. +.TP 8 +.B defaults write com.apple.x11 xinit_kills_server -boolean false +Stops the X server exiting when the xinitrc script terminates. +.TP 8 +.B defaults write com.apple.x11 fullscreen_hotkeys -boolean false +Allows system hotkeys to be handled while in X11 fullscreen mode. +.TP 8 +.B defaults write com.apple.x11 enable_system_beep -boolean false +Don't use the standard system beep effect for X11 alerts. +.TP 8 +.B defaults write com.apple.x11 enable_key_equivalents -boolean false +Disable menu keyboard equivalents while X11 windows are focused. +.TP 8 +.B defaults write com.apple.x11 depth \fIdepth\fP +Equivalent to the \fB-depth\fP option. +.SH "SEE ALSO" +.PP +X(__miscmansuffix__), XFree86(1), Xserver(1), xdm(1), xinit(1) +.PP +.SH AUTHORS +XFree86 was originally ported to Mac OS X Server by John Carmack. Dave +Zarzycki used this as the basis of his port of XFree86 4.0 to Darwin 1.0. +Torrey T. Lyons improved and integrated this code into the XFree86 +Project's mainline for the 4.0.2 release. +.PP +The following members of the XonX Team contributed to the following +releases (in alphabetical order): +.TP 4 +XFree86 4.1.0: +.br +Rob Braun - Darwin x86 support +.br +Torrey T. Lyons - Project Lead +.br +Andreas Monitzer - Cocoa version of XDarwin front end +.br +Gregory Robert Parker - Original Quartz implementation +.br +Christoph Pfisterer - Dynamic shared X libraries +.br +Toshimitsu Tanaka - Japanese localization +.TP 4 +XFree86 4.2.0: +.br +Rob Braun - Darwin x86 support +.br +Pablo Di Noto - Spanish localization +.br +Paul Edens - Dutch localization +.br +Kyunghwan Kim - Korean localization +.br +Mario Klebsch - Non-US keyboard support +.br +Torrey T. Lyons - Project Lead +.br +Andreas Monitzer - German localization +.br +Patrik Montgomery - Swedish localization +.br +Greg Parker - Rootless support +.br +Toshimitsu Tanaka - Japanese localization +.br +Olivier Verdier - French localization --- xorg-server-1.4.2.orig/hw/darwin/apple/bundle-main.c +++ xorg-server-1.4.2/hw/darwin/apple/bundle-main.c @@ -0,0 +1,911 @@ +/* bundle-main.c -- X server launcher + + Copyright (c) 2002-2007 Apple 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 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. + + Parts of this file are derived from xdm, which has this copyright: + + 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. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#define X_SERVER "/usr/X11/bin/Xquartz" +#define XTERM_PATH "/usr/X11/bin/xterm" +#define WM_PATH "/usr/X11/bin/quartz-wm" +#define DEFAULT_XINITRC "/etc/X11/xinit/xinitrc" +#define DEFAULT_PATH "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11/bin" + +/* what xinit does */ +#ifndef SHELL +# define SHELL "sh" +#endif + +#undef FALSE +#define FALSE 0 +#undef TRUE +#define TRUE 1 + +#define MAX_DISPLAYS 64 + +static int server_pid = -1, client_pid = -1; +static int xinit_kills_server = FALSE; +static jmp_buf exit_continuation; +static const char *server_name = NULL; +static Display *server_dpy; + +static char *auth_file; + +typedef struct addr_list_struct addr_list; + +struct addr_list_struct { + addr_list *next; + Xauth auth; +}; + +static addr_list *addresses; + + +/* Utility functions. */ + +/* Return the current host name. Matches what Xlib does. */ +static char * +host_name (void) +{ +#ifdef NEED_UTSNAME + static struct utsname name; + + uname(&name); + + return name.nodename; +#else + static char buf[100]; + + gethostname(buf, sizeof(buf)); + + return buf; +#endif +} + +static int +read_boolean_pref (CFStringRef name, int default_) +{ + int value; + Boolean ok; + + value = CFPreferencesGetAppBooleanValue (name, + CFSTR ("com.apple.x11"), &ok); + return ok ? value : default_; +} + +static inline int +binary_equal (const void *a, const void *b, int length) +{ + return memcmp (a, b, length) == 0; +} + +static inline void * +binary_dup (const void *a, int length) +{ + void *b = malloc (length); + if (b != NULL) + memcpy (b, a, length); + return b; +} + +static inline void +binary_free (void *data, int length) +{ + if (data != NULL) + free (data); +} + + +/* Functions for managing the authentication entries. */ + +/* Returns true if something matching AUTH is in our list of auth items */ +static int +check_auth_item (Xauth *auth) +{ + addr_list *a; + + for (a = addresses; a != NULL; a = a->next) + { + if (a->auth.family == auth->family + && a->auth.address_length == auth->address_length + && binary_equal (a->auth.address, auth->address, auth->address_length) + && a->auth.number_length == auth->number_length + && binary_equal (a->auth.number, auth->number, auth->number_length) + && a->auth.name_length == auth->name_length + && binary_equal (a->auth.name, auth->name, auth->name_length)) + { + return TRUE; + } + } + + return FALSE; +} + +/* Add one item to our list of auth items. */ +static void +add_auth_item (Xauth *auth) +{ + addr_list *a = malloc (sizeof (addr_list)); + + a->auth.family = auth->family; + a->auth.address_length = auth->address_length; + a->auth.address = binary_dup (auth->address, auth->address_length); + a->auth.number_length = auth->number_length; + a->auth.number = binary_dup (auth->number, auth->number_length); + a->auth.name_length = auth->name_length; + a->auth.name = binary_dup (auth->name, auth->name_length); + a->auth.data_length = auth->data_length; + a->auth.data = binary_dup (auth->data, auth->data_length); + + a->next = addresses; + addresses = a; +} + +/* Free all allocated auth items. */ +static void +free_auth_items (void) +{ + addr_list *a; + + while ((a = addresses) != NULL) + { + addresses = a->next; + + binary_free (a->auth.address, a->auth.address_length); + binary_free (a->auth.number, a->auth.number_length); + binary_free (a->auth.name, a->auth.name_length); + binary_free (a->auth.data, a->auth.data_length); + free (a); + } +} + +/* Add the unix domain auth item. */ +static void +define_local (Xauth *auth) +{ + char *host = host_name (); + +#ifdef DEBUG + fprintf (stderr, "x11: hostname is %s\n", host); +#endif + + auth->family = FamilyLocal; + auth->address_length = strlen (host); + auth->address = host; + + add_auth_item (auth); +} + +/* Add the tcp auth item. */ +static void +define_named (Xauth *auth, const char *name) +{ + struct ifaddrs *addrs, *ptr; + + if (getifaddrs (&addrs) != 0) + return; + + for (ptr = addrs; ptr != NULL; ptr = ptr->ifa_next) + { + if (ptr->ifa_addr->sa_family != AF_INET) + continue; + + auth->family = FamilyInternet; + auth->address_length = sizeof (struct in_addr); + auth->address = (char *) &(((struct sockaddr_in *) ptr->ifa_addr)->sin_addr); + +#ifdef DEBUG + fprintf (stderr, "x11: ipaddr is %d.%d.%d.%d\n", + (unsigned char) auth->address[0], + (unsigned char) auth->address[1], + (unsigned char) auth->address[2], + (unsigned char) auth->address[3]); +#endif + + add_auth_item (auth); + } + + freeifaddrs (addrs); +} + +/* Parse the display number from NAME and add it to AUTH. */ +static void +set_auth_number (Xauth *auth, const char *name) +{ + char *colon; + char *dot, *number; + + colon = strrchr(name, ':'); + if (colon != NULL) + { + colon++; + dot = strchr(colon, '.'); + + if (dot != NULL) + auth->number_length = dot - colon; + else + auth->number_length = strlen (colon); + + number = malloc (auth->number_length + 1); + if (number != NULL) + { + strncpy (number, colon, auth->number_length); + number[auth->number_length] = '\0'; + } + else + { + auth->number_length = 0; + } + + auth->number = number; + } +} + +/* Put 128 bits of random data into DATA. If possible, it will be "high + quality" */ +static int +generate_mit_magic_cookie (char data[16]) +{ + int fd, ret, i; + long *ldata = (long *) data; + + fd = open ("/dev/random", O_RDONLY); + if (fd > 0) { + ret = read (fd, data, 16); + close (fd); + if (ret == 16) return TRUE; + } + + /* fall back to the usual crappy rng */ + + srand48 (getpid () ^ time (NULL)); + + for (i = 0; i < 4; i++) + ldata[i] = lrand48 (); + + return TRUE; +} + +/* Create the keys we'll be using for the display named NAME. */ +static int +make_auth_keys (const char *name) +{ + Xauth auth; + char key[16]; + + if (auth_file == NULL) + return FALSE; + + auth.name = "MIT-MAGIC-COOKIE-1"; + auth.name_length = strlen (auth.name); + + if (!generate_mit_magic_cookie (key)) + { + auth_file = NULL; + return FALSE; + } + + auth.data = key; + auth.data_length = 16; + + set_auth_number (&auth, name); + + define_named (&auth, host_name ()); + define_local (&auth); + + free (auth.number); + + return TRUE; +} + +/* If ADD-ENTRIES is true, merge our auth entries into the existing + Xauthority file. If ADD-ENTRIES is false, remove our entries. */ +static int +write_auth_file (int add_entries) +{ + char *home, newname[1024]; + int fd, ret; + FILE *new_fh, *old_fh; + addr_list *addr; + Xauth *auth; + + if (auth_file == NULL) + return FALSE; + + home = getenv ("HOME"); + if (home == NULL) + { + auth_file = NULL; + return FALSE; + } + + snprintf (newname, sizeof (newname), "%s/.XauthorityXXXXXX", home); + mktemp (newname); + + if (XauLockAuth (auth_file, 1, 2, 10) != LOCK_SUCCESS) + { + /* FIXME: do something here? */ + + auth_file = NULL; + return FALSE; + } + + fd = open (newname, O_WRONLY | O_CREAT | O_TRUNC, 0600); + if (fd >= 0) + { + new_fh = fdopen (fd, "w"); + if (new_fh != NULL) + { + if (add_entries) + { + for (addr = addresses; addr != NULL; addr = addr->next) + { + XauWriteAuth (new_fh, &addr->auth); + } + } + + old_fh = fopen (auth_file, "r"); + if (old_fh != NULL) + { + while ((auth = XauReadAuth (old_fh)) != NULL) + { + if (!check_auth_item (auth)) + XauWriteAuth (new_fh, auth); + XauDisposeAuth (auth); + } + fclose (old_fh); + } + + fclose (new_fh); + unlink (auth_file); + + ret = rename (newname, auth_file); + + if (ret != 0) + auth_file = NULL; + + XauUnlockAuth (auth_file); + return ret == 0; + } + + close (fd); + } + + XauUnlockAuth (auth_file); + auth_file = NULL; + return FALSE; +} + + +/* Subprocess management functions. */ + +static int +start_server (char **xargv) +{ + int child; + + child = fork (); + + switch (child) + { + case -1: /* error */ + perror ("fork"); + return FALSE; + + case 0: /* child */ + execv (X_SERVER, xargv); + perror ("Couldn't exec " X_SERVER); + _exit (1); + + default: /* parent */ + server_pid = child; + return TRUE; + } +} + +static int +wait_for_server (void) +{ + int count = 100; + + while (count-- > 0) + { + int status; + + server_dpy = XOpenDisplay (server_name); + if (server_dpy != NULL) + return TRUE; + + if (waitpid (server_pid, &status, WNOHANG) == server_pid) + return FALSE; + + sleep (1); + } + + return FALSE; +} + +static int +start_client (void) +{ + int child; + + child = fork(); + + switch (child) { + char *temp, buf[1024]; + + case -1: /* error */ + perror("fork"); + return FALSE; + + case 0: /* child */ + /* Setup environment */ + temp = getenv("DISPLAY"); + if (temp != NULL && temp[0] != 0) + setenv("DISPLAY", server_name, TRUE); + + temp = getenv("PATH"); + if (temp == NULL || temp[0] == 0) + setenv ("PATH", DEFAULT_PATH, TRUE); + else if (strnstr(temp, "/usr/X11/bin", sizeof(temp)) == NULL) { + snprintf(buf, sizeof(buf), "%s:/usr/X11/bin", temp); + setenv("PATH", buf, TRUE); + } + + /* First try value of $XINITRC, if set. */ + temp = getenv("XINITRC"); + if (temp != NULL && temp[0] != 0 && access(temp, R_OK) == 0) + execlp (SHELL, SHELL, temp, NULL); + + /* Then look for .xinitrc in user's home directory. */ + temp = getenv("HOME"); + if (temp != NULL && temp[0] != 0) { + chdir(temp); + snprintf (buf, sizeof (buf), "%s/.xinitrc", temp); + if (access(buf, R_OK) == 0) + execlp(SHELL, SHELL, buf, NULL); + } + + /* Then try the default xinitrc in the lib directory. */ + + if (access(DEFAULT_XINITRC, R_OK) == 0) + execlp(SHELL, SHELL, DEFAULT_XINITRC, NULL); + + /* Then fallback to hardcoding an xterm and the window manager. */ + + // system(XTERM_PATH " &"); + execl(WM_PATH, WM_PATH, NULL); + + perror("exec"); + _exit(1); + + default: /* parent */ + client_pid = child; + return TRUE; + } +} + +static void +sigchld_handler (int sig) +{ + int pid, status; + + again: + pid = waitpid (WAIT_ANY, &status, WNOHANG); + + if (pid > 0) + { + if (pid == server_pid) + { + server_pid = -1; + + if (client_pid >= 0) + kill (client_pid, SIGTERM); + } + else if (pid == client_pid) + { + client_pid = -1; + + if (server_pid >= 0 && xinit_kills_server) + kill (server_pid, SIGTERM); + } + goto again; + } + + if (server_pid == -1 && client_pid == -1) + longjmp (exit_continuation, 1); + + signal (SIGCHLD, sigchld_handler); +} + + +/* Server utilities. */ + +static Boolean +display_exists_p (int number) +{ + char buf[64]; + void *conn; + char *fullname = NULL; + int idisplay, iscreen; + char *conn_auth_name, *conn_auth_data; + int conn_auth_namelen, conn_auth_datalen; +#ifdef USE_XTRANS_INTERNALS + extern void *_X11TransConnectDisplay (); + extern void _XDisconnectDisplay (); +#endif + /* Since connecting to the display waits for a few seconds if the + display doesn't exist, check for trivial non-existence - if the + socket in /tmp exists or not.. (note: if the socket exists, the + server may still not, so we need to try to connect in that case..) */ + + sprintf (buf, "/tmp/.X11-unix/X%d", number); + if (access (buf, F_OK) != 0) + return FALSE; +#ifdef USE_XTRANS_INTERNALS + /* This is a private function that we shouldn't really be calling, + but it's the best way to see if the server exists (without + needing to hold the necessary authentication to use it) */ + + sprintf (buf, ":%d", number); + conn = _X11TransConnectDisplay (buf, &fullname, &idisplay, &iscreen, + &conn_auth_name, &conn_auth_namelen, + &conn_auth_data, &conn_auth_datalen); + if (conn == NULL) + return FALSE; + + _XDisconnectDisplay (conn); +#endif + return TRUE; +} + + +/* Monitoring when the system's ip addresses change. */ + +static Boolean pending_timer; + +static void +timer_callback (CFRunLoopTimerRef timer, void *info) +{ + pending_timer = FALSE; + + /* Update authentication names. Need to write .Xauthority file first + without the existing entries, then again with the new entries.. */ + + write_auth_file (FALSE); + + free_auth_items (); + make_auth_keys (server_name); + + write_auth_file (TRUE); +} + +/* This function is called when the system's ip addresses may have changed. */ +static void +ipaddr_callback (SCDynamicStoreRef store, CFArrayRef changed_keys, void *info) +{ +#if DEBUG + if (changed_keys != NULL) { + fprintf (stderr, "x11: changed sc keys: "); + CFShow (changed_keys); + } +#endif + + if (auth_file != NULL && !pending_timer) + { + CFRunLoopTimerRef timer; + + timer = CFRunLoopTimerCreate (NULL, CFAbsoluteTimeGetCurrent () + 1.0, + 0.0, 0, 0, timer_callback, NULL); + CFRunLoopAddTimer (CFRunLoopGetCurrent (), timer, + kCFRunLoopDefaultMode); + CFRelease (timer); + + pending_timer = TRUE; + } +} + +/* This code adapted from "Living in a Dynamic TCP/IP Environment" technote. */ +static Boolean +install_ipaddr_source (void) +{ + CFRunLoopSourceRef source = NULL; + + SCDynamicStoreContext context = {0}; + SCDynamicStoreRef ref; + + ref = SCDynamicStoreCreate (NULL, + CFSTR ("AddIPAddressListChangeCallbackSCF"), + ipaddr_callback, &context); + + if (ref != NULL) + { + const void *keys[4], *patterns[2]; + int i; + + keys[0] = SCDynamicStoreKeyCreateNetworkGlobalEntity (NULL, kSCDynamicStoreDomainState, kSCEntNetIPv4); + keys[1] = SCDynamicStoreKeyCreateNetworkGlobalEntity (NULL, kSCDynamicStoreDomainState, kSCEntNetIPv6); + keys[2] = SCDynamicStoreKeyCreateComputerName (NULL); + keys[3] = SCDynamicStoreKeyCreateHostNames (NULL); + + patterns[0] = SCDynamicStoreKeyCreateNetworkInterfaceEntity (NULL, kSCDynamicStoreDomainState, kSCCompAnyRegex, kSCEntNetIPv4); + patterns[1] = SCDynamicStoreKeyCreateNetworkInterfaceEntity (NULL, kSCDynamicStoreDomainState, kSCCompAnyRegex, kSCEntNetIPv6); + + if (keys[0] != NULL && keys[1] != NULL && keys[2] != NULL + && keys[3] != NULL && patterns[0] != NULL && patterns[1] != NULL) + { + CFArrayRef key_array, pattern_array; + + key_array = CFArrayCreate (NULL, keys, 4, &kCFTypeArrayCallBacks); + pattern_array = CFArrayCreate (NULL, patterns, 2, &kCFTypeArrayCallBacks); + + if (key_array != NULL || pattern_array != NULL) + { + SCDynamicStoreSetNotificationKeys (ref, key_array, pattern_array); + source = SCDynamicStoreCreateRunLoopSource (NULL, ref, 0); + } + + if (key_array != NULL) + CFRelease (key_array); + if (pattern_array != NULL) + CFRelease (pattern_array); + } + + + for (i = 0; i < 4; i++) + if (keys[i] != NULL) + CFRelease (keys[i]); + for (i = 0; i < 2; i++) + if (patterns[i] != NULL) + CFRelease (patterns[i]); + + CFRelease (ref); + } + + if (source != NULL) + { + CFRunLoopAddSource (CFRunLoopGetCurrent (), + source, kCFRunLoopDefaultMode); + CFRelease (source); + } + + return source != NULL; +} + + +/* Entrypoint. */ + +void +termination_signal_handler (int unused_sig) +{ + signal (SIGTERM, SIG_DFL); + signal (SIGHUP, SIG_DFL); + signal (SIGINT, SIG_DFL); + signal (SIGQUIT, SIG_DFL); + + longjmp (exit_continuation, 1); +} + +int +main (int argc, char **argv) +{ + char **xargv; + int i, j; + int fd; + + xargv = alloca (sizeof (char *) * (argc + 32)); + + if (!read_boolean_pref (CFSTR ("no_auth"), FALSE)) + auth_file = XauFileName (); + + /* The standard X11 behaviour is for the server to quit when the first + client exits. But it can be useful for debugging (and to mimic our + behaviour in the beta releases) to not do that. */ + + xinit_kills_server = read_boolean_pref (CFSTR ("xinit_kills_server"), TRUE); + + for (i = 1; i < argc; i++) + { + if (argv[i][0] == ':') + server_name = argv[i]; + } + + if (server_name == NULL) + { + static char name[8]; + + /* No display number specified, so search for the first unused. + + There's a big old race condition here if two servers start at + the same time, but that's fairly unlikely. We could create + lockfiles or something, but that's seems more likely to cause + problems than the race condition itself.. */ + + for (i = 0; i < MAX_DISPLAYS; i++) + { + if (!display_exists_p (i)) + break; + } + + if (i == MAX_DISPLAYS) + { + fprintf (stderr, "%s: couldn't allocate a display number", argv[0]); + exit (1); + } + + sprintf (name, ":%d", i); + server_name = name; + } + + if (auth_file != NULL) + { + /* Create new Xauth keys and add them to the .Xauthority file */ + + make_auth_keys (server_name); + write_auth_file (TRUE); + } + + /* Construct our new argv */ + + i = j = 0; + + xargv[i++] = argv[j++]; + + if (auth_file != NULL) + { + xargv[i++] = "-auth"; + xargv[i++] = auth_file; + } + + /* By default, don't listen on tcp sockets if Xauth is disabled. */ + + if (read_boolean_pref (CFSTR ("nolisten_tcp"), auth_file == NULL)) + { + xargv[i++] = "-nolisten"; + xargv[i++] = "tcp"; + } + + while (j < argc) + { + if (argv[j++][0] != ':') + xargv[i++] = argv[j-1]; + } + + xargv[i++] = (char *) server_name; + xargv[i++] = NULL; + + /* Detach from any controlling terminal and connect stdin to /dev/null */ + +#ifdef TIOCNOTTY + fd = open ("/dev/tty", O_RDONLY); + if (fd != -1) + { + ioctl (fd, TIOCNOTTY, 0); + close (fd); + } +#endif + + fd = open ("/dev/null", O_RDWR, 0); + if (fd >= 0) + { + dup2 (fd, 0); + if (fd > 0) + close (fd); + } + + if (!start_server (xargv)) + return 1; + + if (!wait_for_server ()) + { + kill (server_pid, SIGTERM); + return 1; + } + + if (!start_client ()) + { + kill (server_pid, SIGTERM); + return 1; + } + + signal (SIGCHLD, sigchld_handler); + + signal (SIGTERM, termination_signal_handler); + signal (SIGHUP, termination_signal_handler); + signal (SIGINT, termination_signal_handler); + signal (SIGQUIT, termination_signal_handler); + + if (setjmp (exit_continuation) == 0) + { + if (install_ipaddr_source ()) + CFRunLoopRun (); + else + while (1) pause (); + } + + signal (SIGCHLD, SIG_IGN); + + if (client_pid >= 0) kill (client_pid, SIGTERM); + if (server_pid >= 0) kill (server_pid, SIGTERM); + + if (auth_file != NULL) + { + /* Remove our Xauth keys */ + + write_auth_file (FALSE); + } + + free_auth_items (); + + return 0; +} --- xorg-server-1.4.2.orig/hw/darwin/apple/Info.plist +++ xorg-server-1.4.2/hw/darwin/apple/Info.plist @@ -0,0 +1,71 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleDocumentTypes + + + CFBundleTypeExtensions + + x11app + + CFBundleTypeIconFile + X11.icns + CFBundleTypeName + X11 Application + CFBundleTypeOSTypes + + **** + + CFBundleTypeRole + Viewer + LSIsAppleDefaultForType + + + + CFBundleTypeExtensions + + tool + * + + CFBundleTypeName + UNIX Application + CFBundleTypeOSTypes + + **** + + CFBundleTypeRole + Viewer + + + CFBundleExecutable + X11 + CFBundleGetInfoString + X11 + CFBundleIconFile + X11.icns + CFBundleIdentifier + org.x.X11 + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + X11 + CFBundlePackageType + APPL + CFBundleShortVersionString + 2.0 + CFBundleSignature + ???? + CSResourcesFileMapped + + NSHumanReadableCopyright + Copyright © 2003-2007, Apple Inc. +Copyright © 2003, XFree86 Project, Inc. + NSMainNibFile + main + NSPrincipalClass + X11Application + + --- xorg-server-1.4.2.orig/hw/darwin/apple/X11Application.h +++ xorg-server-1.4.2/hw/darwin/apple/X11Application.h @@ -0,0 +1,103 @@ +/* X11Application.h -- subclass of NSApplication to multiplex events + + Copyright (c) 2002-2007 Apple 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 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. */ + +#ifndef X11APPLICATION_H +#define X11APPLICATION_H 1 + +#if __OBJC__ + +#import +#import "X11Controller.h" + +@interface X11Application : NSApplication { + X11Controller *_controller; + + unsigned int _x_active :1; +} + +- (void) set_controller:controller; +- (void) set_window_menu:(NSArray *)list; + +- (int) prefs_get_integer:(NSString *)key default:(int)def; +- (const char *) prefs_get_string:(NSString *)key default:(const char *)def; +- (float) prefs_get_float:(NSString *)key default:(float)def; +- (int) prefs_get_boolean:(NSString *)key default:(int)def; +- (NSArray *) prefs_get_array:(NSString *)key; +- (void) prefs_set_integer:(NSString *)key value:(int)value; +- (void) prefs_set_float:(NSString *)key value:(float)value; +- (void) prefs_set_boolean:(NSString *)key value:(int)value; +- (void) prefs_set_array:(NSString *)key value:(NSArray *)value; +- (void) prefs_set_string:(NSString *)key value:(NSString *)value; +- (void) prefs_synchronize; + +- (BOOL) x_active; + +@end + +extern X11Application *X11App; + +#endif /* __OBJC__ */ + +extern void X11ApplicationSetWindowMenu (int nitems, const char **items, + const char *shortcuts); +extern void X11ApplicationSetWindowMenuCheck (int idx); +extern void X11ApplicationSetFrontProcess (void); +extern void X11ApplicationSetCanQuit (int state); +extern void X11ApplicationServerReady (void); +extern void X11ApplicationShowHideMenubar (int state); + +extern void X11ApplicationMain (int argc, const char *argv[], + void (*server_thread) (void *), + void *server_arg); + +extern int X11EnableKeyEquivalents; +extern int quartzHasRoot, quartzEnableRootless; + +#define APP_PREFS "com.apple.x11" + +#define PREFS_APPSMENU "apps_menu" +#define PREFS_FAKEBUTTONS "enable_fake_buttons" +#define PREFS_SYSBEEP "enable_system_beep" +#define PREFS_KEYEQUIVS "enable_key_equivalents" +#define PREFS_KEYMAP_FILE "keymap_file" +#define PREFS_SYNC_KEYMAP "sync_keymap" +#define PREFS_DEPTH "depth" +#define PREFS_NO_AUTH "no_auth" +#define PREFS_NO_TCP "nolisten_tcp" +#define PREFS_DONE_XINIT_CHECK "done_xinit_check" +#define PREFS_NO_QUIT_ALERT "no_quit_alert" +#define PREFS_FAKE_BUTTON2 "fake_button2" +#define PREFS_FAKE_BUTTON3 "fake_button3" +#define PREFS_ROOTLESS "rootless" +#define PREFS_FULLSCREEN_HOTKEYS "fullscreen_hotkeys" +#define PREFS_SWAP_ALT_META "swap_alt_meta" +#define PREFS_XP_OPTIONS "xp_options" +#define PREFS_ENABLE_STEREO "enable_stereo" + +#endif /* X11APPLICATION_H */ --- xorg-server-1.4.2.orig/hw/darwin/apple/X11Controller.h +++ xorg-server-1.4.2/hw/darwin/apple/X11Controller.h @@ -0,0 +1,85 @@ +/* X11Controller.h -- connect the IB ui + + Copyright (c) 2002 Apple Computer, 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 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. */ + +#ifndef X11CONTROLLER_H +#define X11CONTROLLER_H 1 + +#if __OBJC__ + +#import +#include "../quartz/xpr/x-list.h" + +@interface X11Controller : NSObject +{ + NSPanel *prefs_panel; + + NSButton *fake_buttons; + NSButton *enable_fullscreen; + NSButton *use_sysbeep; + NSButton *enable_keyequivs; + NSButton *sync_keymap; + NSButton *enable_auth; + NSButton *enable_tcp; + NSPopUpButton *depth; + + NSMenuItem *x11_about_item; + NSMenuItem *window_separator; + NSMenuItem *dock_window_separator; + NSMenuItem *apps_separator; + NSMenuItem *toggle_fullscreen_item; + NSMenu *dock_apps_menu; + NSTableView *apps_table; + + NSArray *apps; + NSMutableArray *table_apps; + + NSMenu *dock_menu; + + int checked_window_item; + x_list *pending_apps; + + BOOL finished_launching; + BOOL can_quit; +} + +- (void) set_window_menu:(NSArray *)list; +- (void) set_window_menu_check:(NSNumber *)n; +- (void) set_apps_menu:(NSArray *)list; +- (void) set_can_quit:(BOOL)state; +- (void) server_ready; + +@end + +#endif /* __OBJC__ */ + +extern void X11ControllerMain (int argc, const char *argv[], + void (*server_thread) (void *), + void *server_arg); + +#endif /* X11CONTROLLER_H */ --- xorg-server-1.4.2.orig/hw/darwin/apple/English.lproj/main.nib/classes.nib +++ xorg-server-1.4.2/hw/darwin/apple/English.lproj/main.nib/classes.nib @@ -0,0 +1,318 @@ + + + + + IBClasses + + + CLASS + IBLibraryObjectTemplate + LANGUAGE + ObjC + OUTLETS + + draggedView + NSView + representedObject + NSObject + + SUPERCLASS + NSView + + + CLASS + IBInspector + LANGUAGE + ObjC + OUTLETS + + inspectorView + NSView + + SUPERCLASS + NSObject + + + CLASS + NSDateFormatter + LANGUAGE + ObjC + SUPERCLASS + NSFormatter + + + ACTIONS + + apps_table_cancel + id + apps_table_delete + id + apps_table_done + id + apps_table_duplicate + id + apps_table_new + id + apps_table_show + id + bring_to_front + id + close_window + id + enable_fullscreen_changed + id + minimize_window + id + next_window + id + prefs_changed + id + prefs_show + id + previous_window + id + toggle_fullscreen + id + x11_help + id + zoom_window + id + + CLASS + X11Controller + LANGUAGE + ObjC + OUTLETS + + apps_separator + id + apps_table + id + depth + id + dock_apps_menu + id + dock_menu + id + dock_window_separator + id + enable_auth + id + enable_fullscreen + id + enable_keyequivs + id + enable_tcp + id + fake_buttons + id + prefs_panel + id + sync_keymap + id + toggle_fullscreen_item + id + use_sysbeep + id + window_separator + id + x11_about_item + id + + SUPERCLASS + NSObject + + + CLASS + NSNumberFormatter + LANGUAGE + ObjC + SUPERCLASS + NSFormatter + + + CLASS + NSFormatter + LANGUAGE + ObjC + SUPERCLASS + NSObject + + + ACTIONS + + alignCenter: + id + alignJustified: + id + alignLeft: + id + alignRight: + id + arrangeInFront: + id + centerSelectionInVisibleArea: + id + changeFont: + id + checkSpelling: + id + clear: + id + clearRecentDocuments: + id + complete: + id + copy: + id + copyFont: + id + copyRuler: + id + cut: + id + delete: + id + deminiaturize: + id + fax: + id + hide: + id + hideOtherApplications: + id + loosenKerning: + id + lowerBaseline: + id + makeKeyAndOrderFront: + id + miniaturize: + id + newDocument: + id + openDocument: + id + orderBack: + id + orderFront: + id + orderFrontColorPanel: + id + orderFrontHelpPanel: + id + orderOut: + id + outline: + id + paste: + id + pasteAsPlainText: + id + pasteAsRichText: + id + pasteFont: + id + pasteRuler: + id + pause: + id + performClose: + id + performFindPanelAction: + id + performMiniaturize: + id + performZoom: + id + play: + id + print: + id + printDocument: + id + raiseBaseline: + id + record: + id + redo: + id + resume: + id + revertDocumentToSaved: + id + run: + id + runPageLayout: + id + runToolbarCustomizationPalette: + id + saveAllDocuments: + id + saveDocument: + id + saveDocumentAs: + id + saveDocumentTo: + id + selectAll: + id + selectText: + id + showGuessPanel: + id + showHelp: + id + start: + id + startSpeaking: + id + stop: + id + stopSpeaking: + id + subscript: + id + superscript: + id + terminate: + id + tightenKerning: + id + toggleContinuousSpellChecking: + id + toggleRuler: + id + toggleToolbarShown: + id + turnOffKerning: + id + turnOffLigatures: + id + underline: + id + undo: + id + unhideAllApplications: + id + unscript: + id + useAllLigatures: + id + useStandardKerning: + id + useStandardLigatures: + id + + CLASS + FirstResponder + LANGUAGE + ObjC + SUPERCLASS + NSObject + + + IBVersion + 1 + + --- xorg-server-1.4.2.orig/hw/darwin/apple/English.lproj/main.nib/info.nib +++ xorg-server-1.4.2/hw/darwin/apple/English.lproj/main.nib/info.nib @@ -0,0 +1,18 @@ + + + + + IBFramework Version + 588 + IBOpenObjects + + 244 + 29 + 423 + + IBSystem Version + 9A356 + targetFramework + IBCocoaFramework + + --- xorg-server-1.4.2.orig/hw/darwin/apple/X11.xcodeproj/project.pbxproj +++ xorg-server-1.4.2/hw/darwin/apple/X11.xcodeproj/project.pbxproj @@ -0,0 +1,320 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 42; + objects = { + +/* Begin PBXBuildFile section */ + 527F24190B5D938C007840A7 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0867D6AAFE840B52C02AAC07 /* InfoPlist.strings */; }; + 527F241A0B5D938C007840A7 /* main.nib in Resources */ = {isa = PBXBuildFile; fileRef = 02345980000FD03B11CA0E72 /* main.nib */; }; + 527F241B0B5D938C007840A7 /* X11.icns in Resources */ = {isa = PBXBuildFile; fileRef = 50459C5F038587C60ECA21EC /* X11.icns */; }; + 527F241D0B5D938C007840A7 /* bundle-main.c in Sources */ = {isa = PBXBuildFile; fileRef = 50EE2AB703849F0B0ECA21EC /* bundle-main.c */; }; + 527F241F0B5D938C007840A7 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50F4F0A7039D6ACA0E82C0CB /* CoreFoundation.framework */; }; + 527F24200B5D938C007840A7 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 570C5748047186C400ACF82F /* SystemConfiguration.framework */; }; + 527F24370B5D9D89007840A7 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 527F24260B5D938C007840A7 /* Info.plist */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 0867D6ABFE840B52C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; + 1870340FFE93FCAF11CA0CD7 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/main.nib; sourceTree = ""; }; + 50459C5F038587C60ECA21EC /* X11.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = X11.icns; sourceTree = ""; }; + 50EE2AB703849F0B0ECA21EC /* bundle-main.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = "bundle-main.c"; sourceTree = ""; }; + 50F4F0A7039D6ACA0E82C0CB /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = ""; }; + 527F24260B5D938C007840A7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = Info.plist; sourceTree = ""; }; + 527F24270B5D938C007840A7 /* X11.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = X11.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 570C5748047186C400ACF82F /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = /System/Library/Frameworks/SystemConfiguration.framework; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 527F241E0B5D938C007840A7 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 527F241F0B5D938C007840A7 /* CoreFoundation.framework in Frameworks */, + 527F24200B5D938C007840A7 /* SystemConfiguration.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 195DF8CFFE9D517E11CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 527F24270B5D938C007840A7 /* X11.app */, + ); + name = Products; + sourceTree = ""; + }; + 20286C29FDCF999611CA2CEA /* X11 */ = { + isa = PBXGroup; + children = ( + 20286C2AFDCF999611CA2CEA /* Sources */, + 20286C2CFDCF999611CA2CEA /* Resources */, + 20286C32FDCF999611CA2CEA /* External Frameworks and Libraries */, + 195DF8CFFE9D517E11CA2CBB /* Products */, + 527F24260B5D938C007840A7 /* Info.plist */, + ); + name = X11; + sourceTree = ""; + }; + 20286C2AFDCF999611CA2CEA /* Sources */ = { + isa = PBXGroup; + children = ( + 50EE2AB703849F0B0ECA21EC /* bundle-main.c */, + ); + name = Sources; + sourceTree = ""; + }; + 20286C2CFDCF999611CA2CEA /* Resources */ = { + isa = PBXGroup; + children = ( + 50459C5F038587C60ECA21EC /* X11.icns */, + 0867D6AAFE840B52C02AAC07 /* InfoPlist.strings */, + 02345980000FD03B11CA0E72 /* main.nib */, + ); + name = Resources; + sourceTree = ""; + }; + 20286C32FDCF999611CA2CEA /* External Frameworks and Libraries */ = { + isa = PBXGroup; + children = ( + 50F4F0A7039D6ACA0E82C0CB /* CoreFoundation.framework */, + 570C5748047186C400ACF82F /* SystemConfiguration.framework */, + ); + name = "External Frameworks and Libraries"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 527F24170B5D938C007840A7 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 527F24160B5D938C007840A7 /* X11 */ = { + isa = PBXNativeTarget; + buildConfigurationList = 527F24220B5D938C007840A7 /* Build configuration list for PBXNativeTarget "X11" */; + buildPhases = ( + 527F24170B5D938C007840A7 /* Headers */, + 527F24180B5D938C007840A7 /* Resources */, + 527F241C0B5D938C007840A7 /* Sources */, + 527F241E0B5D938C007840A7 /* Frameworks */, + 527F24210B5D938C007840A7 /* Rez */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = X11; + productName = X11; + productReference = 527F24270B5D938C007840A7 /* X11.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 20286C28FDCF999611CA2CEA /* Project object */ = { + isa = PBXProject; + buildConfigurationList = 527F24080B5D8FFC007840A7 /* Build configuration list for PBXProject "X11" */; + compatibilityVersion = "Xcode 2.4"; + hasScannedForEncodings = 1; + mainGroup = 20286C29FDCF999611CA2CEA /* X11 */; + projectDirPath = ""; + projectRoot = ""; + shouldCheckCompatibility = 1; + targets = ( + 527F24160B5D938C007840A7 /* X11 */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 527F24180B5D938C007840A7 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 527F24370B5D9D89007840A7 /* Info.plist in Resources */, + 527F24190B5D938C007840A7 /* InfoPlist.strings in Resources */, + 527F241A0B5D938C007840A7 /* main.nib in Resources */, + 527F241B0B5D938C007840A7 /* X11.icns in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXRezBuildPhase section */ + 527F24210B5D938C007840A7 /* Rez */ = { + isa = PBXRezBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXRezBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 527F241C0B5D938C007840A7 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 527F241D0B5D938C007840A7 /* bundle-main.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 02345980000FD03B11CA0E72 /* main.nib */ = { + isa = PBXVariantGroup; + children = ( + 1870340FFE93FCAF11CA0CD7 /* English */, + ); + name = main.nib; + sourceTree = ""; + }; + 0867D6AAFE840B52C02AAC07 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 0867D6ABFE840B52C02AAC07 /* English */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 527F24090B5D8FFC007840A7 /* Development */ = { + isa = XCBuildConfiguration; + buildSettings = { + DSTROOT = "$(DSTROOT)"; + SKIP_INSTALL = YES; + }; + name = Development; + }; + 527F240A0B5D8FFC007840A7 /* Deployment */ = { + isa = XCBuildConfiguration; + buildSettings = { + DSTROOT = "$(DSTROOT)"; + SKIP_INSTALL = YES; + }; + name = Deployment; + }; + 527F240B0B5D8FFC007840A7 /* Default */ = { + isa = XCBuildConfiguration; + buildSettings = { + DSTROOT = "$(DSTROOT)"; + SKIP_INSTALL = YES; + }; + name = Default; + }; + 527F24230B5D938C007840A7 /* Development */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(NATIVE_ARCH_32_BIT)"; + COPY_PHASE_STRIP = NO; + DSTROOT = "$(DSTROOT)"; + FRAMEWORK_SEARCH_PATHS = ""; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + HEADER_SEARCH_PATHS = ""; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = $DSTROOT/Applications/Utilties; + LIBRARY_SEARCH_PATHS = ""; + OTHER_CFLAGS = "$(CFLAGS)"; + OTHER_LDFLAGS = "$(LDFLAGS)"; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = X11; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + WRAPPER_EXTENSION = app; + }; + name = Development; + }; + 527F24240B5D938C007840A7 /* Deployment */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + DSTROOT = "$(DSTROOT)"; + FRAMEWORK_SEARCH_PATHS = ""; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + HEADER_SEARCH_PATHS = ""; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = $DSTROOT/Applications/Utilties; + LIBRARY_SEARCH_PATHS = ""; + OTHER_CFLAGS = "$(CFLAGS)"; + OTHER_LDFLAGS = "$(LDFLAGS)"; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = X11; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + WRAPPER_EXTENSION = app; + }; + name = Deployment; + }; + 527F24250B5D938C007840A7 /* Default */ = { + isa = XCBuildConfiguration; + buildSettings = { + DSTROOT = "$(DSTROOT)"; + FRAMEWORK_SEARCH_PATHS = ""; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + HEADER_SEARCH_PATHS = ""; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = $DSTROOT/Applications/Utilties; + LIBRARY_SEARCH_PATHS = ""; + OTHER_CFLAGS = "$(CFLAGS)"; + OTHER_LDFLAGS = "$(LDFLAGS)"; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = X11; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + WRAPPER_EXTENSION = app; + }; + name = Default; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 527F24080B5D8FFC007840A7 /* Build configuration list for PBXProject "X11" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 527F24090B5D8FFC007840A7 /* Development */, + 527F240A0B5D8FFC007840A7 /* Deployment */, + 527F240B0B5D8FFC007840A7 /* Default */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Default; + }; + 527F24220B5D938C007840A7 /* Build configuration list for PBXNativeTarget "X11" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 527F24230B5D938C007840A7 /* Development */, + 527F24240B5D938C007840A7 /* Deployment */, + 527F24250B5D938C007840A7 /* Default */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Default; + }; +/* End XCConfigurationList section */ + }; + rootObject = 20286C28FDCF999611CA2CEA /* Project object */; +} --- xorg-server-1.4.2.orig/Xi/Makefile.in +++ xorg-server-1.4.2/Xi/Makefile.in @@ -148,7 +148,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -282,10 +282,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/Xi/chgdctl.c +++ xorg-server-1.4.2/Xi/chgdctl.c @@ -261,7 +261,7 @@ if (ret == Success) { dpn.type = DevicePresenceNotify; dpn.time = currentTime.milliseconds; - dpn.devchange = 1; + dpn.devchange = 5; /* DeviceControlChanged */ dpn.deviceid = dev->id; dpn.control = stuff->control; SendEventToAllWindows(dev, DevicePresenceNotifyMask, --- xorg-server-1.4.2.orig/debian/rules +++ xorg-server-1.4.2/debian/rules @@ -0,0 +1,216 @@ +#!/usr/bin/make -f +# debian/rules for the Debian xorg-server package. +# Copyright © 2004 Scott James Remnant +# Copyright © 2005 Daniel Stone +# Copyright © 2005 David Nusinow + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +include debian/xsfbs/xsfbs.mk + +CFLAGS = -Wall -g +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) + INSTALL_PROGRAM += -s +endif +CPPFLAGS += -DPRE_RELEASE=0 + +DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH) +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) +DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS) +ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) + confflags += --build=$(DEB_HOST_GNU_TYPE) +else + confflags += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) +endif + +#ifeq ($(DEB_HOST_ARCH_OS), linux) +# build_xfbdev = --enable-xfbdev +#else + build_xfbdev = --disable-xfbdev +#endif + +BUILD_XPRINT = true +ifeq ($(BUILD_XPRINT), true) + confflags += --enable-xprint +else + confflags += --disable-xprint +endif + +INSTALL=/usr/bin/install + +VENDOR = $(shell lsb_release -i -s) + +# disable-static is so we don't get libfoo.a for modules. now if only we could +# kill the .las. +confflags += --disable-static \ + --enable-xorg \ + --with-mesa-source=/usr/share/mesa-source \ + --with-default-font-path="/usr/share/fonts/X11/misc,/usr/share/fonts/X11/cyrillic,/usr/share/fonts/X11/100dpi/:unscaled,/usr/share/fonts/X11/75dpi/:unscaled,/usr/share/fonts/X11/Type1,/usr/share/fonts/X11/100dpi,/usr/share/fonts/X11/75dpi,/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType" \ + --with-serverconfig-path=/etc/X11/xserver \ + --with-rgb-path=/etc/X11/rgb \ + --enable-xtrap \ + --enable-dmx \ + --enable-vfb \ + --enable-kdrive \ + --enable-xephyr \ + --disable-xsdl \ + --disable-xfake \ + $(build_xfbdev) \ + --disable-kdrive-vesa \ + --disable-lbx \ + --enable-freetype \ + --disable-xorgconfig \ + --disable-xorgcfg \ + --with-xkb-path=/usr/share/X11/xkb \ + --with-xkb-output=/var/lib/xkb \ + --enable-xfree86-utils \ + --with-os-name="$(shell uname)" \ + --with-os-vendor="$(VENDOR) ($(SOURCE_NAME) $(SOURCE_VERSION))" \ + --with-int10=x86emu \ + --disable-type1 + +build: patch build-stamp +build-stamp: + dh_testdir + + mkdir -p obj-$(DEB_BUILD_GNU_TYPE)/GL + cd obj-$(DEB_BUILD_GNU_TYPE) && \ + ../configure --prefix=/usr --mandir=\$${prefix}/share/man \ + --infodir=\$${prefix}/share/info --sysconfdir=/etc \ + --localstatedir=/var $(confflags) CFLAGS="$(CFLAGS)" \ + CPPFLAGS="$(CPPFLAGS)" + cd obj-$(DEB_BUILD_GNU_TYPE) && $(MAKE) + + touch build-stamp + +clean: xsfclean + dh_testdir + dh_testroot + rm -f build-stamp + + rm -f config.cache config.log config.status + rm -f */config.cache */config.log */config.status + rm -f conftest* */conftest* + rm -rf autom4te.cache */autom4te.cache + rm -rf obj-* + # generated file, left over in the upstream tarball + # see https://bugs.freedesktop.org/show_bug.cgi?id=9277 + rm -f hw/xfree86/common/xf86Build.h + # more generated files + rm -f include/dix-config.h include/do-not-use-config.h \ + include/xorg-config.h include/xorg-server.h + # needed for git snapshots + chmod +x configure + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + cd obj-$(DEB_BUILD_GNU_TYPE) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install + + # oh, yuck. + find $(CURDIR)/debian/tmp/usr/lib/xorg -type f -name '*.la' | \ + xargs rm -f + + install -m 755 debian/local/xvfb-run debian/tmp/usr/bin + install debian/local/xvfb-run.1 debian/tmp/usr/share/man/man1 + +# # something funny going on with Xprinters, will have to sort it out upstream +# mv debian/tmp/usr/lib/X11/xserver/C/print/Xprinters.ghostscript debian/tmp/usr/lib/X11/xserver/C/print/Xprinters + + +# stub to start building deb files, used by binary-indep and binary-arch +binary-initial: + dh_testdir + dh_testroot + +# stub to build deb files, used by binary-indep and binary-arch +# (cf. /usr/share/debhelper/dh_make/debianm/rules) +binary-deb: + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +# Build architecture-dependent files here. +binary-arch: build install + $(MAKE) -f debian/rules DH_OPTIONS=-a binary-initial + + dh_installdocs -a + dh_installchangelogs -a ChangeLog + dh_install -a --sourcedir=debian/tmp --list-missing -Xusr/share/man/man1/Xprt -Xusr/lib/X11/xserver -Xetc/X11/Xsession.d/92xprint-xpserverlist + $(INSTALL) -d $(CURDIR)/debian/xserver-xorg-dev/usr/share/xserver-xorg + $(INSTALL) -m644 $(CURDIR)/debian/videoabiver \ + $(CURDIR)/debian/xserver-xorg-dev/usr/share/xserver-xorg/videoabiver + $(INSTALL) -m644 $(CURDIR)/debian/inputabiver \ + $(CURDIR)/debian/xserver-xorg-dev/usr/share/xserver-xorg/inputabiver + $(INSTALL) -m644 $(CURDIR)/debian/serverminver \ + $(CURDIR)/debian/xserver-xorg-dev/usr/share/xserver-xorg/serverminver + $(INSTALL) -m 755 -d debian/xserver-xorg-core/usr/share/bug/xserver-xorg-core + $(INSTALL) -m 755 debian/xserver-xorg-core.bug.script debian/xserver-xorg-core/usr/share/bug/xserver-xorg-core/script + dh_installdebconf -a + dh_installman -a +ifeq ($(BUILD_XPRINT), true) + $(INSTALL) -m 644 $(CURDIR)/debian/xprint-overrides $(CURDIR)/debian/xprint/usr/share/lintian/overrides/xprint + # xprint docs are linked to xprint-common + rm -rf debian/xprint/usr/share/doc/xprint +endif + + dh_link -a + dh_strip -a --exclude=usr/lib/xorg/modules \ + --dbg-package=xserver-xorg-core + for i in $$(find debian/xserver-xorg-core/usr/lib/xorg/modules -name "lib*.so"); do \ + mkdir -p $$(dirname debian/xserver-xorg-core-dbg/usr/lib/debug/$${i#*debian/xserver-xorg-core/}) && \ + objcopy --only-keep-debug $$i debian/xserver-xorg-core-dbg/usr/lib/debug/$${i#*debian/xserver-xorg-core/} && \ + objcopy --add-gnu-debuglink=debian/xserver-xorg-core-dbg/usr/lib/debug/$${i#*debian/xserver-xorg-core/} $$i; \ + done +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) + find debian/xserver-xorg-core/usr/lib/xorg/modules -name "lib*.so" | \ + xargs --no-run-if-empty \ + strip --strip-debug --remove-section=.note --remove-section=.comment +endif + $(MAKE) -f debian/rules DH_OPTIONS=-a binary-deb + + +# Build architecture-independent files here (xprint-common) +binary-indep: build install + $(MAKE) -f debian/rules DH_OPTIONS=-i binary-initial + dh_install -i --sourcedir=debian/tmp --list-missing -Xusr/share/man -Xusr/include/xorg -Xusr/share/aclocal -Xusr/lib/xorg/modules -Xusr/lib/pkgconfig/xorg-server.pc -Xusr/bin -XSecurityPolicy -Xvar/lib/xkb -Xusr/lib/X11/Cards -Xusr/lib/X11/Options + +ifeq ($(BUILD_XPRINT), true) + $(INSTALL) -m 644 $(CURDIR)/debian/xprint-common-overrides $(CURDIR)/debian/xprint-common/usr/share/lintian/overrides/xprint-common + # split Xprint config files so font files do not land in /etc + # (for xprint-common only) + mv debian/xprint-common/usr/share/Xprint/xserver/C/print/attributes debian/xprint-common/etc/Xprint/C/print/attributes + mv debian/xprint-common/usr/share/Xprint/xserver/C/print/Xprinters debian/xprint-common/etc/Xprint/C/print/Xprinters + mv debian/xprint-common/usr/share/Xprint/xserver/C/print/ddx-config debian/xprint-common/etc/Xprint/C/print/ddx-config + mv debian/xprint-common/usr/share/Xprint/xserver/en_US/print/attributes debian/xprint-common/etc/Xprint/en_US/print/attributes + # dh_install cannot rename files, sigh + $(INSTALL) -m 644 $(CURDIR)/debian/xprint-common.default $(CURDIR)/debian/xprint-common/etc/default/xprint + dh_installinit -p xprint-common --name=xprint +endif + + dh_installdocs -i + dh_installchangelogs -i ChangeLog + dh_installdebconf -i + dh_link -i + + $(MAKE) -f debian/rules DH_OPTIONS=-i binary-deb + + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install --- xorg-server-1.4.2.orig/debian/videoabiver +++ xorg-server-1.4.2/debian/videoabiver @@ -0,0 +1 @@ +2 --- xorg-server-1.4.2.orig/debian/xprint-common.install +++ xorg-server-1.4.2/debian/xprint-common.install @@ -0,0 +1,2 @@ +usr/lib/X11/xserver usr/share/Xprint +etc/X11/Xsession.d/92xprint-xpserverlist --- xorg-server-1.4.2.orig/debian/xprint-common.xprint.init +++ xorg-server-1.4.2/debian/xprint-common.xprint.init @@ -0,0 +1,1246 @@ +#!/bin/bash +# +# Copyright 2002-2004 by Roland Mainz . +# +# This script manages the Xprint server side + +# Basic support for IRIX-style "chkconfig" +# chkconfig: 2345 61 61 +# description: Startup/shutdown script for Xprint server(s) + +# Basic support for the Linux Standard Base Specification 1.0.0 +# (Note: The Should-Start/Stop lines are there so that this works in the +# future, when the LSB adopts these. The X-UnitedLinux lines are there +# so that it works right now.) +### BEGIN INIT INFO +# Provides: xprint +# Required-Start: $local_fs $remote_fs $syslog $network +# Required-Stop: $local_fs $remote_fs $syslog +# Should-Start: cups lpd xfs +# Should-Stop: cups lpd xfs +# X-UnitedLinux-Should-Start: cups lpd xfs +# X-UnitedLinux-Should-Stop: cups lpd xfs +# Default-Start: 3 5 +# Default-Stop: 0 1 2 6 +# Description: Startup/shutdown script for Xprint server(s) +### END INIT INFO + + + + +############################################################################ +# +# This script has three main tasks: +# 1. Start Xprint servers ("Xprt") at boot time. +# 2. Shutdown Xprint servers when the machine is being shut down. +# 3. Query the list of available printers. +# +# Additional tasks are: +# 4. Restart ('restart') and conditional restart +# ('condrestart'/'try-restart'|'force-reload') for Linux support +# 5. Wrapping of application call with setting XPSERVERLIST ('wrapper') +# +# Usage: +# - Start Xprint server(s) manually: +# % /etc/init.d/xprint start +# +# - Stop Xprint server(s) manually: +# % /etc/init.d/xprint stop +# +# - Populate $XPSERVERLIST env var (for example as part of a global +# login script like /etc/profile or per-user login scripts like +# $HOME/.profile (sh/ksh/bash)) +# % XPSERVERLIST="`/etc/init.d/xprint get_xpserverlist`" +# % export XPSERVERLIST +# +# Installation: +# Copy this script to /etc/init.d/xprint and make sure that it is +# executable. If your installation is LSB-compliant, then run +# % /usr/lib/lsb/install_initd /etc/init.d/xprint +# to start the service on startup. Otherwise, manually create links +# to the matching run levels. +# Examples: +# - Solaris 2.7/2.8/2.9: +# % cp xprint /etc/init.d/xprint +# % chmod a+rx /etc/init.d/xprint +# % ln /etc/init.d/xprint /etc/rc0.d/K38xprint +# % ln /etc/init.d/xprint /etc/rc1.d/K38xprint +# % ln /etc/init.d/xprint /etc/rc2.d/S81xprint +# % ln /etc/init.d/xprint /etc/rcS.d/K38xprint +# +# - SuSE Linux 7.3 +# % cp xprint /etc/init.d/xprint +# % chmod a+rx /etc/init.d/xprint +# % ln -s ../xprint /etc/init.d/rc3.d/K13xprint +# % ln -s ../xprint /etc/init.d/rc3.d/S12xprint +# % ln -s ../xprint /etc/init.d/rc5.d/K13xprint +# % ln -s ../xprint /etc/init.d/rc5.d/S12xprint +# % ln -s ../xprint /etc/init.d/rc2.d/K13xprint +# % ln -s ../xprint /etc/init.d/rc2.d/S12xprint +# +# - SuSE Linux 6.4: +# % cp xprint /sbin/init.d/xprint +# % chmod a+rx /sbin/init.d/xprint +# % ln -s ../xprint /sbin/init.d/rc2.d/K20xprint +# % ln -s ../xprint /sbin/init.d/rc2.d/S20xprint +# % ln -s ../xprint /sbin/init.d/rc3.d/K20xprint +# % ln -s ../xprint /sbin/init.d/rc3.d/S20xprint +# +# Notes: +# - The Xprint servers must be started _after_ the print +# spooler or the server(s) may refuse to start +# - The script should be readable by all users to ensure that they +# can use the "get_xpserverlist"-option +# +# Custom configuration: +# - Edit the function setup_config() in this script to match your needs +# +# Known bugs/ToDo/Notes: +# - The shell script assumes that a Xserver can be reached via +# "hostname:displaynum" where "hostname" is obtained from +# "/usr/bin/hostname". It may happen that a kernel firewall +# blocks an X connection on the same host (e.g. client && Xserver +# are running on the same host). +# Suggested fix: Fix the firewall config. +# Suggested workaround: Edit this script and replace the use of +# /usr/bin/hostname with "echo 'localhost'". +# +############################################################################ +# + + +############################################################################ + +fatal_error() +{ + echo "${0}: ## FATAL ERROR: ${1}" 1>&2 + exit 1 +} + +error_echo() +{ + echo "${0}: ## ERROR: ${1}" 1>&2 +} + +warning_echo() +{ + echo "${0}: ## WARNING: ${1}" 1>&2 +} + +verbose_echo() +{ + echo "${0}: ${1}" +} + +msg() +{ + echo "${1}" +} + +############################################################################ + + +##debug +# set -x + +# Change current dir to a location which is writeable by everyone +cd /tmp + +# Clear some environment variables +unset TEMP TMPDIR SCREENDIR + +# Set search path for commands +export PATH=/usr/bin:/bin:/usr/sbin:/sbin + + + + +## Try to figure-out where X11 was installed + + + + + + +[ -d /usr/X11/bin ] && XPROJECTROOT=/usr/X11 +[ -d /usr/X11R6/bin ] && XPROJECTROOT=/usr/X11R6 + +# X11R7 now follows FHS, doesn't use it's own separate directory +XPROJECTROOT=/usr + +XPCUSTOMGLUE=DebianGlue # This is used for customizing this script +export XPROJECTROOT XPCUSTOMGLUE + +if [ -z "${XPROJECTROOT}" ] ; then + fatal_error "Unknown XProjectRoot." +fi + +# Set the location of the Xprt binary we want to use. +XPRT_BIN="${XPROJECTROOT}/bin/Xprt" + +# Set the location of the global file where we store the locations +# of the system-wide servers +if [ -d /var/run ] ; then + XP_GLOBAL_SERVERS=/var/run/Xprint_servers +else + XP_GLOBAL_SERVERS=/tmp/.Xprint_servers +fi + +# ${LOGNAME} will not work if user su'ed into another account +export CURRLOGNAME="$(id -u -n)" + +# Set location where we want to store the list of Xprint servers managed +# by this user +# - If we start as "root" use the global file +# - If we start as normal user use a per-user file + +if [ "${CURRLOGNAME}" != "root" -a "${CURRLOGNAME}" != "" ] ; then + XP_PER_USER_SERVERS="/tmp/.Xprint_servers_${CURRLOGNAME}" + XP_SERVERS="${XP_PER_USER_SERVERS}" +else + XP_SERVERS="${XP_GLOBAL_SERVERS}" +fi + +# Set umask that owner can r/w all files and everyone else can read them +umask 022 + +# Bump limit for per-process open files to ensure that Xprt can open many many fonts +ulimit -n 1024 + +############################################################################ + +# Get list of fonts for a given display +get_fontlist_from_display() +{ + ${XPROJECTROOT}/bin/xset -display "${1}" q | + awk "/Font Path:/ { i=1 ; next } i==1 { print \$0 ; i=0 }" | + fontpath2fontlist +} + +# Get list from a fontserver config +get_fontlist_from_xfs_config() +{ + if [ ! -r "${1}" ] ; then + return 0 + fi + + ( + cat "${1}" | + while read -r i ; do + for val in $i; do + case $val in + \#*) break ;; + ?*=*) key="${val%%=*}" ;; + =*) key="${tok}" ;; + *) [ "${key}" = "catalogue" -a "${tok}" != "" ] && echo "${tok}" ;; + esac + tok="${val#*=}" + done + done + ) | tr "," "\n" | fontpath2fontlist +} + +get_fontlist_from_all_xfs_configs() +{ + get_fontlist_from_xfs_config "/etc/openwin/fs/fontserver.cfg" + get_fontlist_from_xfs_config "/usr/openwin/lib/X11/fontserver.cfg" + get_fontlist_from_xfs_config "/etc/X11/fs-xtt/config" + get_fontlist_from_xfs_config "/etc/X11/fs/config" + get_fontlist_from_xfs_config "/etc/X11/xfs/config" + get_fontlist_from_xfs_config "${XPROJECTROOT}/lib/X11/fs/config" +} + +get_fontlist_from_xf86config() +{ + srcxconf="" + + # see xorg.conf(5x) manual page for the list of locations used here + [ "${srcxconf}" = "" -a -f "/etc/X11/xorg.conf" ] && srcxconf="/etc/X11/xorg.conf" + [ "${srcxconf}" = "" -a -f "/usr/X11R6/etc/X11/xorg.conf" ] && srcxconf="/usr/X11R6/etc/X11/xorg.conf" + [ "${srcxconf}" = "" -a -f "/etc/X11/xorg.conf-4" ] && srcxconf="/etc/X11/xorg.conf-4" + [ "${srcxconf}" = "" -a -f "/etc/X11/xorg.conf" ] && srcxconf="/etc/X11/xorg.conf" + [ "${srcxconf}" = "" -a -f "/etc/xorg.conf" ] && srcxconf="/etc/xorg.conf" + [ "${srcxconf}" = "" -a -f "/usr/X11R6/etc/X11/xorg.conf.${hostname}" ] && srcxconf="/usr/X11R6/etc/X11/xorg.conf.${hostname}" + [ "${srcxconf}" = "" -a -f "/usr/X11R6/etc/X11/xorg.conf-4" ] && srcxconf="/usr/X11R6/etc/X11/xorg.conf-4" + [ "${srcxconf}" = "" -a -f "/usr/X11R6/etc/X11/xorg.conf" ] && srcxconf="/usr/X11R6/etc/X11/xorg.conf" + [ "${srcxconf}" = "" -a -f "/usr/X11R6/lib/X11/xorg.conf.${hostname}" ] && srcxconf="/usr/X11R6/lib/X11/xorg.conf.${hostname}" + [ "${srcxconf}" = "" -a -f "/usr/X11R6/lib/X11/xorg.conf-4" ] && srcxconf="/usr/X11R6/lib/X11/xorg.conf-4" + [ "${srcxconf}" = "" -a -f "/usr/X11R6/lib/X11/xorg.conf" ] && srcxconf="/usr/X11R6/lib/X11/xorg.conf" + + # Xfree86 locations + [ "${srcxconf}" = "" -a -f "/etc/X11/XF86Config-4" ] && srcxconf="/etc/X11/XF86Config-4" + [ "${srcxconf}" = "" -a -f "/etc/X11/XF86Config" ] && srcxconf="/etc/X11/XF86Config" + + + if [ "${srcxconf}" = "" ] ; then + return 0 + fi + + currsection="" + cat "${srcxconf}" | + while read i1 i2 i3 i4 ; do + # Strip "\"" from I2 + i2="${i2#\"}" ; i2="${i2%\"}" + + case "${i1}" in + \#*) + continue + ;; + 'Section') + currsection="${i2}" + ;; + 'EndSection') + currsection="" + ;; + 'FontPath') + [ "$currsection" = "Files" ] && echo "${i2%:unscaled}" + ;; + esac + done | egrep -v -i "tcp/|tcp4/|tcp6/|unix/" + + return 0 +} + +get_fontlist_from_defoma() +{ + # Include Debian defoma font directory where relevant + if [ -d "/var/lib/defoma/x-ttcidfont-conf.d/dirs" ] ; then + find "/var/lib/defoma/x-ttcidfont-conf.d/dirs" -name fonts.dir | + while read i ; do echo "${i%/fonts.dir}" ; done + fi +} + +# Get list of system fonts +get_system_fontlist() +{ + ( + get_fontlist_from_defoma + + get_fontlist_from_xf86config + + # Getting font paths from XFS is mainly required for compatibilty to RedHat + get_fontlist_from_all_xfs_configs + + ## List all fonts in all locales installed on this machine + ( + [ -d "/usr/share/fonts" ] && find /usr/share/fonts -name fonts.dir + [ -d "${XPROJECTROOT}/lib/X11/fonts" ] && find "${XPROJECTROOT}/lib/X11/fonts" -name fonts.dir + ) | + while read i ; do echo "${i%/fonts.dir}" ; done + ) | sort -u +} + +# Filter fonts per given extended regular expressions +# (and make sure we filter any model-config fonts - they are managed by Xprt internally) +filter_fontlist() +{ + egrep -- "${1}" | fgrep -v "/models/" | egrep -v -- "${2}" +} + +# Filter font paths with unsupported font types +# (such as CID fonts) +filter_unsupported_fonts() +{ + egrep -v -i "/cid(/$|$)|/csl(/$|$)" +} + +# Validate fontpath +# Only return valid font path entries (note that these entries may +# include non-file stuff like font server references) +validate_fontlist() +{ + while read i ; do + case "${i}" in + # Check if font path entry is a font server... + tcp/''*|tcp4/''*|tcp6/''*|unix/''*) + echo "${i}" + ;; + # ... if not check if the path is accessible + # and has a valid "fonts.dir" index + *) + [ -f "${i}/fonts.dir" ] && echo "${i}" + ;; + esac + done +} + +# Build a comma-seperated list of fonts (font path) from a list of fonts +fontlist2fontpath() +{ + fp="" + read fp; + while read i ; do + fp="${fp},${i}" + done + + echo "$fp" +} + +# Build a list (one item per line) of fonts from a font path +fontpath2fontlist() +{ + while read i ; do + echo "${i}" | tr "," "\n" + done +} + +# Sort scaleable fonts (PS Type1 and TrueType) first in a font list +sort_scaleable_fonts_first() +{ + i="$(fontlist2fontpath)" + # First list PS Type1 fonts... + echo "${i}" | fontpath2fontlist | fgrep "/Type1" + # ... then TrueType fonts ... + echo "${i}" | fontpath2fontlist | egrep -i "/TrueType|/TT(/$|$)|/TTF(/$|$)" + # ... then all others + echo "${i}" | fontpath2fontlist | egrep -v -i "/Type1|/TrueType|/TT(/$|$)|/TTF(/$|$)" +} + +# Check if a X display is used by a Xserver or not +# Known bugs: +# - there is no way in plain bourne shell or bash (see comment about ksh93 +# below) to test if a Xserver sits only on a socket and not on a pipe +# - some Xserver's don't cleanup their stuff in /tmp on exit which may end +# in the problem that we don't detect possible free display numbers +# (one problem is that only ksh93 can do stuff like +# "cat "${lastdisplaynumreturned_store}" + return 0 + fi + done + + # Using "magic" value of 189 here due lack of a better solution + echo "189" + echo "189" >"${lastdisplaynumreturned_store}" + return 0 +} + +# Check if a process exists or not +pexists() +{ + [ "$1" = "" ] && return 1; + + # Use of /proc would be better but not all platforms (like AIX) have procfs + [ "$(ps -p $1 | fgrep $1)" != "" ] && return 0; + return 1 +} + +# Check if there is a spooler running... +is_spooler_running() +{ + # This covers Linux lpd, CUPS, Solaris and AIX 4.x - but what about + # AIX 5.x, HP-UX and IRIX ? + + [ "$(ps -A | egrep 'lpd|lpsched|cupsd|qdaemon' | fgrep -v 'grep')" != "" ] && return 0; + return 1 +} + +# Wait until the spooler system has been started (but not more than 30secs) +wait_for_print_spooler() +{ + for i in 1 2 3 4 5 6 7 8 9 10 ; do + is_spooler_running && return 0; + sleep 3 + done + + return 0 +} + +lock_server_registry() +{ + lock_counter=0 # counts in 1/100s + waiting_for_lock_msg_send="false" + while ! mkdir "${XP_SERVERS}.lock" 2>/dev/null ; do + # print notice after 2 seconds + if [ ${lock_counter} -gt 200 -a "${waiting_for_lock_msg_send}" != "true" ] ; then + echo "${0}: waiting for lock(=${XP_SERVERS}.lock)..." + waiting_for_lock_msg_send="true" + fi + + # tread the lock as "broken" after 20 seconds + if [ ${lock_counter} -gt 2000 ] ; then + echo "${0}: WARNING: lock timeout for lock(=${XP_SERVERS}.lock)." + return 0 + fi + + if [ -x /bin/usleep ] ; then + /bin/usleep 200000 + lock_counter=$((${lock_counter} + 20)) # 20/100s + else + sleep 1 + lock_counter=$((${lock_counter} + 100)) # 100/100s + fi + done +} + +unlock_server_registry() +{ + rmdir "${XP_SERVERS}.lock" +} + +# Kill dead registry locks (silently!) +kill_dead_registry_locks() +{ + rm -Rf "${XP_SERVERS}.lock" +} + +# Start Xprint servers +start_servers() +{ + # Write registry "intro" ... + lock_server_registry + echo "# Xprint server list" >>"${XP_SERVERS}" + echo "# File is for private use for ${0}." >>"${XP_SERVERS}" + echo "# Do not edit, rely on the content or file format." >>"${XP_SERVERS}" + unlock_server_registry + + hostname="$(hostname)" + + default_fontpath="$(get_system_fontlist | fontlist2fontpath)" + default_fontpath_acceptpattern=".*"; + default_fontpath_rejectpattern="_No_Match_"; # Match nothing + + curr=0 + while [ $curr -lt $num_xpstart ] ; do + if [ "${xpstart_remote_server[$curr]}" != "" ] ; then + # Remote Xprt, just put the entry into the registry + lock_server_registry + echo "display=${xpstart_remote_server[$curr]}" >>"${XP_SERVERS}" + unlock_server_registry + else + # Run block in seperate process to avoid that changes to the + # xpstart_* variables affect the next cycle + ( + # Use defaults if there are no special options + [ "${xpstart_fontpath[$curr]}" = "" ] && xpstart_fontpath[$curr]="${default_fontpath}"; + [ "${xpstart_fontpath_acceptpattern[$curr]}" = "" ] && xpstart_fontpath_acceptpattern[$curr]="$default_fontpath_acceptpattern"; + [ "${xpstart_fontpath_rejectpattern[$curr]}" = "" ] && xpstart_fontpath_rejectpattern[$curr]="$default_fontpath_rejectpattern"; + [ "${xpstart_displayid[$curr]}" = "" ] && xpstart_displayid[$curr]="$(FindFreeXDisplayNum)" + [ "${xpstart_logger[$curr]}" = "" ] && xpstart_logger[$curr]="logger -p lpr.notice -t Xprt_${xpstart_displayid[$curr]}"; + [ "${xpstart_logfile[$curr]}" = "" ] && xpstart_logfile[$curr]="/dev/null"; + [ "${xpstart_xprt_binary[$curr]}" = "" ] && xpstart_xprt_binary[$curr]="${XPRT_BIN}"; + if [ "${xpstart_xprt_binary[$curr]}" = "/usr/openwin/bin/Xprt" -o "$(uname -s)" = "SunOS" ] ; then + # Solaris /usr/openwin/bin/Xprt does not support "-nolisten tcp" + # yet nor is it possible to run a Xserver on a unix socket only + # in Solaris since access to the unix domain sockets in + # /tmp/.X11-pipe and /tmp/.X11-unix is restricted to applications + # with group-id "root" (e.g. the Xprt server would need to be + # setgid "root" that plain users can start it listening on a unix + # socket only) + [ "${xpstart_options[$curr]}" = "" ] && xpstart_options[$curr]="-ac -pn" + else + [ "${xpstart_options[$curr]}" = "" ] && xpstart_options[$curr]="-ac -pn -nolisten tcp" + fi + + # Check if the Xprt binary is available + if [ ! -x "${xpstart_xprt_binary[$curr]}" ] ; then + # Debian policy 9.3.2 says just stop quietly here + exit 0 + + error_echo "Can't find \"${xpstart_xprt_binary[$curr]}\"." + exit 1 # exit block + fi + + # Verify and set location of font encodings directory file + if [ "${xpstart_font_encodings_dir[$curr]}" = "" ] ; then + if [ -f "${XPROJECTROOT}/lib/X11/fonts/xf86encodings/encodings.dir" ] ; then + xpstart_font_encodings_dir[$curr]="${XPROJECTROOT}/lib/X11/fonts/xf86encodings/encodings.dir" + elif [ -f "${XPROJECTROOT}/lib/X11/fonts/encodings/encodings.dir" ]; then + xpstart_font_encodings_dir[$curr]="${XPROJECTROOT}/lib/X11/fonts/encodings/encodings.dir" + else + xpstart_font_encodings_dir[$curr]="${XPROJECTROOT}/share/fonts/X11/encodings/encodings.dir"; + fi + fi + + unset FONT_ENCODINGS_DIRECTORY + if [ ! -f "${xpstart_font_encodings_dir[$curr]}" ] ; then + warning_echo "Can't find \"${xpstart_font_encodings_dir[$curr]}\", TrueType font support may not work." + fi + + export FONT_ENCODINGS_DIRECTORY="${xpstart_font_encodings_dir[$curr]}" + + # Generate font path (containing only valid font path elements) + # from input font path and filter expressions + curr_fp=$(echo "${xpstart_fontpath[$curr]}" | + fontpath2fontlist | + filter_fontlist "${xpstart_fontpath_acceptpattern[$curr]}" "${xpstart_fontpath_rejectpattern[$curr]}" | + filter_unsupported_fonts | + sort_scaleable_fonts_first | + validate_fontlist | + fontlist2fontpath) + + # Set Xserver auditing level option + unset curr_audit + if [ "${xpstart_auditlevel[$curr]}" != "" ] ; then + curr_audit="-audit ${xpstart_auditlevel[$curr]}" + fi + + # Set Xprt -XpFile option + unset curr_xpfile + if [ "${xpstart_xpfile[$curr]}" != "" ] ; then + curr_xpfile="-XpFile ${xpstart_xpfile[$curr]}" + fi + + # Set custom XPCONFIGDIR (if there is one) + unset XPCONFIGDIR + if [ "${xpstart_xpconfigdir[$curr]}" != "" ] ; then + export XPCONFIGDIR="${xpstart_xpconfigdir[$curr]}" + fi + + # If someone uses "-nolisten tcp" make sure we do not add a hostname to force local transport + if [ "$(echo "${xpstart_options[$curr]}" | egrep "nolisten.*tcp")" != "" ] ; then + xp_display=":${xpstart_displayid[$curr]}" + else + xp_display="${hostname}:${xpstart_displayid[$curr]}" + fi + + ( + ( + DAEMON_OPTS="${xpstart_options[$curr]} ${curr_xpfile} ${curr_audit} -fp ${curr_fp} :${xpstart_displayid[$curr]}" + + + + PIDFILE=/var/run/Xprt_${curr}.pid + start-stop-daemon --start --background --oknodo --quiet --pidfile ${PIDFILE} --make-pidfile --exec ${xpstart_xprt_binary[$curr]} -- $DAEMON_OPTS + + + server_pid="$(cat ${PIDFILE})" + + # Append the new server to the registry + lock_server_registry + echo "display=${xp_display} display_id=${xpstart_displayid[$curr]} pid=${server_pid}" >>"${XP_SERVERS}" + unlock_server_registry + + ) 2>&1 | while read i ; do echo "$i" | tee -a "${xpstart_logfile[$curr]}" | ${xpstart_logger[$curr]} ; done + ) <&- >&- 2>&- & + ) + fi + + curr=$(($curr + 1)) + done + + # Remove tmp. file created by |FindFreeXDisplayNum()| + rm -f "${lastdisplaynumreturned_store}" + + # Done. + lock_server_registry + echo "# EOF." >>"${XP_SERVERS}" + unlock_server_registry + return 0 +} + + +# Convenience function to check setup and start Xprt server(s) +do_start() +{ + if [ -f "${XP_SERVERS}" ] ; then + numservers="$(do_get_xpserverlist | wc -l)" + if [ ${numservers} -gt 0 ] ; then + verbose_echo "Xprint servers are already running." + return 0 + else + verbose_echo "Old server registry found, cleaning-up..." + do_stop + fi + fi + + # Check if we can write the registry file + touch "${XP_SERVERS}" 2>/dev/null + if [ ! -f "${XP_SERVERS}" ] ; then + error_echo "Cannot create \"${XP_SERVERS}\"." + # exit code 4 = user had insufficient privilege (LSB) + exit 4 + fi + + if ! setup_config ; then + error_echo "setup_config failed." + exit 1 + fi + + # Provide two paths here - one which simply starts the Xprt servers, + # assuming that there is a print spooler already running (or that + # ${XPCONFIG}/C/print/Xprinters provides static print queue entries + # (like for the PSspooldir print model)) and a 2nd path which + # explicitly checks if the print queue daemons are running + if true ; then + msg "Starting Xprint servers: Xprt." + start_servers + else + # Continue in the background if there is no spooler running yet (that + # we don't hold off the boot process nor run in a possible race-condition + # when /etc/init.d/lpd was not called yet but the runlevel script waits + # for us to finish first ... + if is_spooler_running ; then + msg "Starting Xprint servers: Xprt." + start_servers + else + msg "Starting Xprint servers (in the background): Xprt." + (wait_for_print_spooler ; start_servers) & + sleep 5 + fi + fi + + if [ "${CURRLOGNAME}" = "root" -a -d /var/lock/subsys/ ] ; then + touch /var/lock/subsys/xprint + fi +} + +# Convenience function to stop Xprt server(s) +do_stop() +{ + msg "Stopping Xprint servers: Xprt." + + # need to run setup_config to grab values of xpstart_xprt_binary, etc. + if ! setup_config ; then + error_echo "setup_config failed." + exit 1 + fi + + curr=0 + while [ $curr -lt $num_xpstart ] ; do + [ "${xpstart_xprt_binary[$curr]}" = "" ] && xpstart_xprt_binary[$curr]="${XPRT_BIN}"; + PIDFILE=/var/run/Xprt_${curr}.pid + if [ -f ${PIDFILE} ] ; then + start-stop-daemon --stop --oknodo --quiet --pidfile ${PIDFILE} --exec ${xpstart_xprt_binary[$curr]} + + + rm -f ${PIDFILE} + fi + curr=$(($curr + 1)) + done + + lock_server_registry + if [ -f "${XP_SERVERS}" ] ; then + reglist="$(cat "${XP_SERVERS}")" + rm -f "${XP_SERVERS}" + fi + unlock_server_registry + + if [ "${reglist}" != "" ] ; then + echo "${reglist}" | + grep "^display=.*:.* pid=[0-9]*$" | + while read i ; do + ( + eval ${i} + if pexists ${pid} ; then + kill ${pid} + fi + + # Remove the X sockets/pipes which are not in use anymore + # (It would be better if the Xservers would cleanup this + # automatically, but most Xservers do not do that... ;-( + # Note that this will not work on Solaris where applications + # must run with groupid="root" if they want to write into + # /tmp/.X11-unix/ and/or /tmp/.X11-pipe/) + if [ "${display_id}" != "" ] ; then + rm -f "/tmp/.X${display_id}-lock" 2>/dev/null + rm -f "/tmp/.X11-unix/X${display_id}" 2>/dev/null + rm -f "/tmp/.X11-pipe/X${display_id}" 2>/dev/null + fi + ) + done + fi + + if [ "${CURRLOGNAME}" = "root" -a -d /var/lock/subsys/ ] ; then + rm -f /var/lock/subsys/xprint + fi + + # Remove any outstanding (dead) locks and cleanup + rm -f "${XP_SERVERS}" + kill_dead_registry_locks +} + +# Convenience function to obtain a list of available Xprint servers +do_get_xpserverlist() +{ + if [ -f "${XP_PER_USER_SERVERS}" -o -f "${XP_GLOBAL_SERVERS}" ] ; then + xpserverlist=$( + # Enumerate both per-user and global servers (in that order) + ( + [ -f "${XP_PER_USER_SERVERS}" ] && cat "${XP_PER_USER_SERVERS}" + [ -f "${XP_GLOBAL_SERVERS}" ] && cat "${XP_GLOBAL_SERVERS}" + ) | + egrep "^display=.*:.* pid=[0-9]*$|^display=.*:[0-9]*$" | + while read i ; do + ( + pid="none" + eval ${i} + # Check if the Xprt process exists (if possible) + if [ "$pid" != "none" ] ; then + if pexists ${pid} ; then + echo ${display} + fi + else + echo ${display} + fi + ) + done | tr "[\n]" " " + ) + # Only produce output if we have some entries... + [ "${xpserverlist}" != "" ] && echo "${xpserverlist}" + fi +} + +do_restart() +{ + msg "Restarting Xprint server(s): Xprt." + do_stop + sleep 1 + do_start +} + +do_diag() +{ + echo "##### Diag start $(date)." + + # General info + echo "## General info start." + ( + echo "PATH=\"${PATH}\"" + echo "TZ=\"${TZ}\"" + echo "LANG=\"${LANG}\"" + echo "uname -a=\"$(uname -a)\"" + echo "uname -s=\"$(uname -s)\"" + echo "uname -p=\"$(uname -p)\"" + echo "uname -i=\"$(uname -i)\"" + echo "uname -m=\"$(uname -m)\"" + echo "has /etc/SuSE-release ... $([ -f "/etc/SuSE-release" ] && echo "yes" || echo "no")" + echo "has /etc/redhat-release ... $([ -f "/etc/redhat-release" ] && echo "yes" || echo "no")" + echo "has /etc/debian_version ... $([ -f "/etc/debian_version" ] && echo "yes" || echo "no")" + echo "how many Xprt servers are running ...$(ps -ef | fgrep Xprt | fgrep -v "grep" | wc -l)" + ) 2>&1 | while read i ; do echo " $i" ; done + echo "## General info end." + + # Testing font paths + echo "## Testing font paths start." + ( + get_system_fontlist | + filter_unsupported_fonts | + sort_scaleable_fonts_first | + validate_fontlist | while read d ; do + echo "#### Testing \"${d}\" ..." + if [ ! -d "$d" ] ; then + echo "# Error: $d does not exists." + continue + fi + if [ ! -r "$d" ] ; then + echo "# Error: $d not readable." + continue + fi + if [ ! -f "${d}/fonts.dir" ] ; then + echo "# Error: ${d}/fonts.dir not found." + continue + else + if [ ! -r "${d}/fonts.dir" ] ; then + echo "# Error: ${d}/fonts.dir not readable." + continue + fi + fi + if [ -f "${d}/fonts.alias" ] ; then + if [ ! -r "${d}/fonts.alias" ] ; then + echo "# Error: ${d}/fonts.alias not readable." + fi + fi + + if [ "$(cat "${d}/fonts.dir" | fgrep 'cursor')" != "" ] ; then + echo "${d}/fonts.dir has cursor font." + fi + if [ "$(cat "${d}/fonts.dir" | fgrep 'fixed')" != "" ] ; then + echo "${d}/fonts.dir has fixed font." + fi + + if [ -r "${d}/fonts.alias" ] ; then + if [ "$(cat "${d}/fonts.alias" | fgrep 'cursor')" != "" ] ; then + echo "${d}/fonts.alias has cursor font." + fi + if [ "$(cat "${d}/fonts.alias" | fgrep 'fixed')" != "" ] ; then + echo "${d}/fonts.alias has fixed font." + fi + fi + + linenum=0 + cat "${d}/fonts.dir" | while read i1 i2 i3 i4 ; do + linenum=$((${linenum} + 1)) + [ ${linenum} -eq 1 ] && continue + + if [ ! -f "${d}/${i1}" ] ; then + echo "ERROR: ${d}/fonts.dir line ${linenum} has non-exististant font \"${i1}\" (=\"${i1} ${i2} ${i3} ${i4}\")" + fi + done + done + ) 2>&1 | while read i ; do echo " $i" ; done + echo "## Testing font paths end." + + echo "##### Diag End $(date)." +} + +# Set platform-defaults for setup_config() +setup_config_defaults() +{ + curr_num_xpstart="${1}" + + #### Defaults for Linux/Solaris + # Start Xprt using builtin XPCONFIGDIR at a free display numer + # (Solaris(=SunOS5.x)'s /usr/openwin/bin/Xprt supports TrueType fonts, + # therefore we don't need to filter them) + xpstart_fontpath[${curr_num_xpstart}]=""; + xpstart_fontpath_acceptpattern[${curr_num_xpstart}]=".*"; + xpstart_fontpath_rejectpattern[${curr_num_xpstart}]="/Speedo|/F3bitmaps|/F3"; + xpstart_displayid[${curr_num_xpstart}]=""; + xpstart_xpconfigdir[${curr_num_xpstart}]=""; + xpstart_xpfile[${curr_num_xpstart}]=""; + xpstart_auditlevel[${curr_num_xpstart}]="4"; + xpstart_options[${curr_num_xpstart}]=""; + xpstart_logger[${curr_num_xpstart}]=""; + # Check whether we have /dev/stderr (needed for old AIX + old Debian) + if [ -w "/dev/stderr" ] ; then + xpstart_logfile[${curr_num_xpstart}]="/dev/stderr"; + else + xpstart_logfile[${curr_num_xpstart}]="/dev/tty"; + fi + xpstart_xprt_binary[${curr_num_xpstart}]=""; + + # Custom rules for the GISWxprintglue package on Solaris + # (which uses Solaris's /usr/openwin/bin/Xprt but a custom config) + if [ "${XPCUSTOMGLUE}" = "GISWxprintglue" ] ; then + xpstart_xpconfigdir[${curr_num_xpstart}]="/opt/GISWxprintglue/server/etc/XpConfig" + xpstart_xprt_binary[${curr_num_xpstart}]="/usr/openwin/bin/Xprt" + fi + # Custom rules for the GISWxprint package on Solaris + # (which uses both it's own Xprt and a custom config) + if [ "${XPCUSTOMGLUE}" = "GISWxprint" ] ; then + xpstart_xpconfigdir[${curr_num_xpstart}]="/opt/GISWxprint/server/etc/XpConfig" + xpstart_xprt_binary[${curr_num_xpstart}]="/opt/GISWxprint/bin/Xprt" + xpstart_font_encodings_dir[${curr_num_xpstart}]="/opt/GISWxprint/lib/X11/fonts/encodings/encodings.dir" + fi + + ####################################################### + ### + ### Debian Xprint package default configuration + ### + if [ "${XPCUSTOMGLUE}" = "DebianGlue" ] ; then + # Set XPCONFIGDIR=/usr/share/Xprint/xserver + xpstart_xpconfigdir[${curr_num_xpstart}]="/usr/share/Xprint/xserver"; + + # Use fixed display ID (":64"), or else all client programs will have to be + # restarted simply to update XPSERVERLIST to the latest ID when upgrading, + # which would be a nightmare. + xpstart_displayid[${curr_num_xpstart}]=64; + + # Do not send any messages to console + xpstart_logfile[${curr_num_xpstart}]="/dev/null"; + + # By default use binary provided by Debian's "xprt-xprintorg" package + # (=/usr/bin/Xprt), otherwise leave blank (e.g. use script's default + # (=/usr/X11R6/bin/Xprt)) + if [ -x "/usr/bin/Xprt" ] ; then + xpstart_xprt_binary[${curr_num_xpstart}]="/usr/bin/Xprt"; + fi + fi + ### + ### End Debian default configuration + ### + ####################################################### +} + +fetch_etc_initd_xprint_envvars() +{ + curr_num_xpstart="${1}" + + ## Process some $ETC_INITD_XPRINT_* vars after all which may be used by + # a user to override the hardcoded values here when starting Xprt per-user + # (a more flexible way is to provide an own setup config script in + # "~./Xprint_per_user_startup" - see above) + if [ "${ETC_INITD_XPRINT_XPRT_PATH}" != "" ] ; then + xpstart_xprt_binary[${curr_num_xpstart}]="${ETC_INITD_XPRINT_XPRT_PATH}" + fi + if [ "${ETC_INITD_XPRINT_XPCONFIGDIR}" != "" ] ; then + xpstart_xpconfigdir[${curr_num_xpstart}]="${ETC_INITD_XPRINT_XPCONFIGDIR}" + fi + if [ "${ETC_INITD_XPRINT_XPFILE}" != "" ] ; then + xpstart_xpfile[${curr_num_xpstart}]="${ETC_INITD_XPRINT_XPFILE}" + fi + if [ "${ETC_INITD_XPRINT_LOGFILE}" != "" ] ; then + xpstart_logfile[${curr_num_xpstart}]="${ETC_INITD_XPRINT_LOGFILE}" + fi + if [ "${ETC_INITD_XPRINT_DISPLAYID}" != "" ] ; then + xpstart_displayid[${curr_num_xpstart}]="${ETC_INITD_XPRINT_DISPLAYID}" + fi + if [ "${ETC_INITD_XPRINT_FONTPATH}" != "" ] ; then + xpstart_fontpath[${curr_num_xpstart}]="${ETC_INITD_XPRINT_FONTPATH}" + fi + if [ "${ETC_INITD_XPRINT_XPRT_OPTIONS}" != "" ] ; then + xpstart_options[${curr_num_xpstart}]="${ETC_INITD_XPRINT_XPRT_OPTIONS}" + fi + if [ "${ETC_INITD_XPRINT_AUDITLEVEL}" != "" ] ; then + xpstart_auditlevel[${curr_num_xpstart}]="${ETC_INITD_XPRINT_AUDITLEVEL}" + fi + if [ "${ETC_INITD_XPRINT_XF86ENCODINGSDIR}" != "" ] ; then + xpstart_font_encodings_dir[${curr_num_xpstart}]="${ETC_INITD_XPRINT_XF86ENCODINGSDIR}" + fi +} + +############################################################################ +# setup_config() sets the configuration parameters used to start one +# or more Xprint servers ("Xprt"). +# The following variables are used: +# - "num_xpstart" - number of servers to start +# - "xpstart_fontpath[index]" - custom font path. Leave blank if you want +# the platform-specific default +# - "xpstart_fontpath_acceptpattern[index]" - extended regular expression +# (see egrep(1)) used to filter the font path - items only pass this +# filter if they match the pattern (leave blank if you want to filter +# nothing) +# - "xpstart_fontpath_rejectpattern[index]" - extended regular expression +# (see egrep(1)) used to filter the font path - items only pass this +# filter if they do not match the pattern (leave blank if you want to +# filter nothing) +# - "xpstart_font_encodings_dir[index]" - location of "encodings.dir". +# Leave blank to use the default. +# - "xpstart_displayid[index]" - display id to use for the Xprint server +# (leave blank to choose the next available free display id) +# - "xpstart_xpconfigdir[index]" - value for custom XPCONFIGDIR (leave blank +# if you don not want that that XPCONFIGDIR is set at Xprt startup) +# - "xpstart_xpfile[index]" - value used for Xprt's "-XpFile" option (leave +# blank if you do not want to set this option) +# - "xpstart_auditlevel[index]" - set Xserver auditing level (leave blank to +# use no auditing) +# - "xpstart_options[index]" - set further Xprt options (leave blank to set +# no further options) +# - "xpstart_logger[index]" - utility which gets stderr/stdout messages from +# Xprt and sends them to a logging daemon. Leave blank to use /usr/bin/logger +# to send such messages to the lpr.notice syslog) +# - "xpstart_logfile[index]" - log file to append stderr/stdout messages from +# Xprt to. Leave blank to send messages to /dev/null +# - "xpstart_xprt_binary[index]" - set custom Xprt binary (leave blank to use +# the platform-specifc default) +setup_config() +{ + num_xpstart=0; + + if [ "${ETC_INITD_XPRINT_CUSTOM_SETUP_CONFIG}" != "" ] ; then + user_cfg="${ETC_INITD_XPRINT_CUSTOM_SETUP_CONFIG}" + else + user_cfg="${HOME}/.Xprint_per_user_startup" + fi + + # Source per-user ~/.Xprint_per_user_startup file if there is one + # (and do not use the script's defaults below) + if [ -r "${user_cfg}" ] ; then + # Define API version which should be checked by ${HOME}/.Xprint_per_user_startup + # ${HOME}/.Xprint_per_user_startup should bail-out if the version differ + etc_initd_xprint_api_version=2 + + # Source per-user settings script + . "${user_cfg}" + + # done with setting the config for per-user Xprt instances + return 0; + else + # Use /etc/init.d/xprint's builtin config + # Each entry should start with |setup_config_defaults| to pull the + # platform defaults and finish with |num_xpstart=$(($num_xpstart + 1))| + # to end the entry + + # Set platform-defaults + setup_config_defaults "${num_xpstart}" + + ## -- snip -- + + # Admins can put their stuff "in" here... + + ## -- snip -- + + # Override script's builtin values with those a user may set via the + # $ETC_INIITD_XPRINT_* env vars + fetch_etc_initd_xprint_envvars "${num_xpstart}" + + num_xpstart=$((${num_xpstart} + 1)) + + return 0; + fi + + #### Sample 1: + # # Start Xprt on a free display ID with custom XPCONFIGDIR and without + # # Speedo and TrueType fonts + # xpstart_fontpath_rejectpattern[$num_xpstart]="/Speedo|/TrueType|/TT(/$|$)|/TTF(/$|$)"; + # xpstart_xpconfigdir[$num_xpstart]="/home/gisburn/cwork/Xprint/Xprt_config/XpConfig"; + # xpstart_auditlevel[$num_xpstart]="4"; + # xpstart_options[$num_xpstart]="-ac -pn"; + #num_xpstart=$(($num_xpstart + 1)) + + + #### Sample 2: + # # Start Xprt without TrueType fonts on a display 55 with custom + # # XPCONFIGDIR + # xpstart_fontpath_rejectpattern[$num_xpstart]="/TrueType|/TT(/$|$)|/TTF(/$|$)"; + # xpstart_displayid[$num_xpstart]=55; + # xpstart_xpconfigdir[$num_xpstart]="/home/gisburn/cwork/Xprint/Xprt_config/XpConfig"; + # xpstart_auditlevel[$num_xpstart]=4; + # xpstart_options[$num_xpstart]="-ac -pn"; + #num_xpstart=$(($num_xpstart + 1)) + + #### Sample 3: + # # Start Xprt without TrueType fonts on a display 56 with custom + # # XPCONFIGDIR and alternate "Xprinters" file + # xpstart_fontpath_rejectpattern[$num_xpstart]="/TrueType|/TT(/$|$)|/TTF(/$|$)"; + # xpstart_displayid[$num_xpstart]=56; + # xpstart_xpconfigdir[$num_xpstart]="/etc/XpConfig/default"; + # xpstart_xpfile[$num_xpstart]="/etc/XpConfig/default/Xprinters_test2" + # xpstart_auditlevel[$num_xpstart]="4"; + # xpstart_options[$num_xpstart]="-ac -pn"; + # xpstart_xprt_binary[$num_xpstart]=""; + #num_xpstart=$(($num_xpstart + 1)) + + #### Sample 4: + # # Start Xprt with Solaris ISO-8859-7 (greek(="el") locale) fonts on + # # display 57 + # xpstart_fontpath[$num_xpstart]="/usr/openwin/lib/locale/iso_8859_7/X11/fonts/75dpi,/usr/openwin/lib/locale/iso_8859_7/X11/fonts/Type1,/usr/openwin/lib/X11/fonts/misc/"; + # xpstart_fontpath_acceptpattern[$num_xpstart]=""; + # xpstart_fontpath_rejectpattern[$num_xpstart]="_No_Match_"; + # xpstart_displayid[$num_xpstart]="57"; + # xpstart_auditlevel[$num_xpstart]="4"; + # xpstart_options[$num_xpstart]="-ac -pn"; + #num_xpstart=$(($num_xpstart + 1)) + + #### Sample 5: + # # Start Xprt with the font list of an existing Xserver (excluding Speedo fonts) on + # # display 58 + # # Note that this only works within a X session. At system boot time + # # there will be no $DISPLAY to fetch the information from!! + # xpstart_fontpath[$num_xpstart]="$(get_fontlist_from_display ${DISPLAY} | fontlist2fontpath)"; + # xpstart_fontpath_acceptpattern[$num_xpstart]=""; + # xpstart_fontpath_rejectpattern[$num_xpstart]=""; + # xpstart_displayid[$num_xpstart]="58"; + # xpstart_xpconfigdir[$num_xpstart]=""; + # xpstart_auditlevel[$num_xpstart]="4"; + # xpstart_options[$num_xpstart]="-ac -pn"; + # xpstart_xprt_binary[$num_xpstart]=""; + #num_xpstart=$(($num_xpstart + 1)) + + #### Sample 6: + # # List remote Xprt's here + # # (note that there is no test to check whether these DISPLAYs are valid!) + # xpstart_remote_server[$num_xpstart]="sera:12" ; num_xpstart=$(($num_xpstart + 1)) + # xpstart_remote_server[$num_xpstart]="gandalf:19" ; num_xpstart=$(($num_xpstart + 1)) +} + +############################################################################ + +# Main +case "$1" in + ## Start Xprint servers + 'start') + do_start + ;; + + ## Stop Xprint servers + # Note that this does _not_ kill Xprt instances started using this script + # by non-root users + 'stop') + do_stop + ;; + + ## Restart Xprint servers + 'restart') + do_restart + ;; + + ## Reload configuration without stopping and restarting + 'reload') + # not supported + msg "reload not supported, use 'restart' or 'force-reload'" + exit 3 + ;; + + ## Restart Xprint only if it is already running + 'condrestart'|'try-restart'|'force-reload') + # only restart if it is already running + [ -f /var/lock/subsys/xprint ] && do_restart || : + ;; + + ## Get list of all Xprint servers for this user + # (incl. per-user and system-wide instances) + 'get_xpserverlist') + do_get_xpserverlist + ;; + + ## Get status of Xprint servers, RedHat-style + 'status') + x="$(do_get_xpserverlist)" + if [ "${x}" != "" ] ; then + msg "Xprint (${x}) is running..." + exit 0 + else + msg "Xprint is stopped" + exit 3 + fi + ;; + + ## Wrapper + 'wrapper') + cmd="${2}" + [ "${cmd}" = "" ] && fatal_error "No command given." + shift ; shift + export XPSERVERLIST="$(do_get_xpserverlist)" + [ "${XPSERVERLIST}" = "" ] && fatal_error "No Xprint servers found." + exec "${cmd}" "$@" + ;; + + ## Wrapper for "xplsprinters" + 'lsprinters') + [ "${ETC_INITD_XPRINT_XPLSPRINTERS_PATH}" != "" ] && cmd="${ETC_INITD_XPRINT_XPLSPRINTERS_PATH}" + [ ! -x "${cmd}" -a "${XPCUSTOMGLUE}" = "GISWxprintglue" ] && cmd="/opt/GISWxprintglue/bin/xplsprinters" + [ ! -x "${cmd}" -a "${XPCUSTOMGLUE}" = "GISWxprint" ] && cmd="/opt/GISWxprint/bin/xplsprinters" + [ ! -x "${cmd}" -a "${XPROJECTROOT}" != "" ] && cmd="${XPROJECTROOT}/bin/xplsprinters" + [ ! -x "${cmd}" ] && cmd="/usr/bin/xplsprinters" + [ ! -x "${cmd}" ] && cmd="xplsprinters" + + shift + export XPSERVERLIST="$(do_get_xpserverlist)" + [ "${XPSERVERLIST}" = "" ] && fatal_error "No Xprint servers found." + exec "${cmd}" "$@" + ;; + + ## Diagnostics + 'diag') + do_diag + ;; + + ## Print usage + *) + msg "Usage: $0 { start | stop | restart | force-reload | status | condrestart | try-restart | wrapper | lsprinters | get_xpserverlist | diag }" + exit 2 +esac +exit 0 + +# EOF. --- xorg-server-1.4.2.orig/debian/control +++ xorg-server-1.4.2/debian/control @@ -0,0 +1,260 @@ +Source: xorg-server +Section: x11 +Priority: optional +Maintainer: Debian X Strike Force +Uploaders: David Nusinow , Steve Langasek , Julien Cristau , Drew Parsons , Brice Goglin +# all the Build-Depends up to x11proto-xf86-dri-dev are for the normal Xorg +# server, and common dependencies for the DIX. +# x11proto-xf86dri-dev and libdrm-dev are for DRI support for the Xorg server. +# x11proto-print-dev and libfreetype6-dev are for Xprint +# everything on is for the DMX and Xnest servers. +Build-Depends: debhelper (>= 4.0.0), lsb-release, pkg-config, bison, flex, + x11proto-bigreqs-dev, x11proto-composite-dev (>= 1:0.4), x11proto-core-dev (>= 7.0.9), + x11proto-damage-dev (>= 1.1), x11proto-evie-dev, x11proto-fixes-dev (>= 4.0), + x11proto-kb-dev (>= 1.0.3), x11proto-xinerama-dev, x11proto-randr-dev (>= 1.2), + x11proto-record-dev, x11proto-render-dev (>= 2:0.9.3), x11proto-resource-dev, + x11proto-scrnsaver-dev, x11proto-trap-dev, x11proto-video-dev, + x11proto-xcmisc-dev, x11proto-xext-dev (>= 6.9.99.0), + x11proto-xf86bigfont-dev, x11proto-xf86dga-dev, x11proto-xf86misc-dev, + x11proto-xf86vidmode-dev, xtrans-dev, libxau-dev (>= 1:0.99.1), + x11proto-input-dev (>= 1.4.2), + libxdmcp-dev (>= 1:0.99.1), libxfont-dev, libfontenc-dev, + libxkbfile-dev (>= 1:0.99.1), libpixman-1-dev (>= 0.9.4-2), + x11proto-xf86dri-dev, libdrm-dev (>= 2.3.0) [!hurd-i386], + x11proto-print-dev, libfreetype6-dev, xfonts-utils, + mesa-swx11-source (>> 7.0.1~rc2-1), + x11proto-gl-dev (>= 1.4.8), libgl1-mesa-dev (>= 6.5.1), + libxmuu-dev (>= 1:0.99.1), libxext-dev (>= 1:0.99.1), + libx11-dev (>= 1:0.99.2), libxrender-dev (>= 1:0.9.0), + libxi-dev (>= 1:0.99.1), x11proto-dmx-dev, quilt, libdmx-dev (>= 1:1.0.1), + libxpm-dev (>= 1:3.5.3), libxaw7-dev (>= 1:0.99.1), + libxt-dev (>= 1:0.99.1), libxmu-dev (>= 1:0.99.1), + libxtst-dev (>= 1:0.99.1), libxres-dev (>= 1:0.99.1), + libxfixes-dev (>= 1:3.0.0), libdbus-1-dev [!hurd-i386], libhal-dev [!hurd-i386] +Build-Conflicts: xlibs-static-dev +Standards-Version: 3.7.3 +Vcs-Git: git://git.debian.org/git/pkg-xorg/xserver/xorg-server +Vcs-Browser: http://git.debian.org/?p=pkg-xorg/xserver/xorg-server.git + +Package: xserver-xorg-core +Architecture: any +Depends: x11-common (>= 1:7.0.0), ${shlibs:Depends}, ${misc:Depends}, xserver-xorg +Recommends: xkb-data, xfonts-base +Suggests: xfonts-100dpi | xfonts-75dpi, xfonts-scalable +Conflicts: xserver-xorg (<< 6.8.2-38), xserver-xfree86 (<< 1:7.0.0), + xserver-xorg-video, xserver-common, xserver-xorg-video-1.0, xserver-xorg-input, + xserver-xorg-video-1.9, xserver-xorg-input-wacom (<< 0.7.8) +Replaces: xserver-xorg (<< 6.8.2-38), xserver-xfree86 (<< 1:7.0.0), + xserver-common +Provides: xserver +Description: Xorg X server - core server + The Xorg X server is an X server for several architectures and operating + systems, which is derived from the XFree86 4.x series of X servers. + . + The Xorg server supports most modern graphics hardware from most vendors, + and supersedes all XFree86 X servers. + . + The Xorg server either needs fonts installed on the local host, or needs to + know of a remote hosts that provides font services (with xfs, for instance). + The former means that fonts packages are mandatory. The latter means that + font packages may be gratuitous. To err on the side of caution, install at + least the xfonts-base, xfonts-100dpi or xfonts-75dpi, and xfonts-scalable + packages. + . + More information about X.Org can be found at: + + + + . + This package is built from the X.org xserver module. + +Package: xserver-xorg-dev +Architecture: any +Depends: ${misc:Depends}, libpixman-1-dev, x11proto-core-dev, x11proto-input-dev (>= 1.4), x11proto-xext-dev, x11proto-video-dev, x11proto-randr-dev (>= 1.2), x11proto-render-dev (>= 2:0.9.3), x11proto-fonts-dev +Description: Xorg X server - development files + This package provides development files for the X.Org ('Xorg') X server. + This is not quite the same as the DDK (Driver Development Kit) from the + XFree86 4.x and X.Org 6.7, 6.8 and 6.9 series of servers; it provides + headers and a pkg-config file for drivers using autotools to build + against. + . + Unless you are developing or building a driver, you probably want + xserver-xorg and/or xserver-xorg-core instead. + . + More information about X.Org can be found at: + + + + . + This package is built from the X.org xserver module. + +Package: xdmx +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: distributed multihead X server + Xdmx is a proxy X server that uses one or more other X servers as its + display device(s). It provides multi-head X functionality for displays that + might be located on different machines. Xdmx functions as a front-end X server + that acts as a proxy to a set of back-end X servers. All of the visible + rendering is passed to the back-end X servers. Clients connect to the Xdmx + front-end, and everything appears as it would in a regular multi-head + configuration. If Xinerama is enabled (e.g., with +xinerama on the command + line), the clients see a single large screen. + . + More information about X.Org can be found at: + + + + . + This package is built from the X.org xserver module. + +Package: xdmx-tools +Architecture: any +Depends: xdmx, ${shlibs:Depends}, ${misc:Depends} +Replaces: xdmx (<= 2:1.1.1-10) +Description: Distributed Multihead X tools + This package provides a collection of tools used for administration of + the Xdmx server; see the xdmx package for more information. + . + More information about X.Org can be found at: + + + + . + This package is built from the X.org xserver module. + +Package: xnest +Architecture: any +Depends: x11-common, ${shlibs:Depends}, ${misc:Depends} +Description: Nested X server + Xnest is a nested X server that simply relays all its requests to another + X server, where it runs as a client. This means that it appears as another + window in your current X session. Xnest relies upon its parent X server + for font services. + . + Use of the Xephyr X server instead of Xnest is recommended. + . + More information about X.Org can be found at: + + + + . + This package is built from the X.org xserver module. + +Package: xvfb +Architecture: any +Depends: x11-common, ${shlibs:Depends}, ${misc:Depends} +Recommends: xbase-clients, xfonts-base +Description: Virtual Framebuffer 'fake' X server + Xvfb provides 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. The primary use of this server was intended to be server testing, + but other novel uses for it have been found, including testing clients + against unusual depths and screen configurations, doing batch processing with + Xvfb 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. + . + This package also contains a convenience script called xvfb-run which + simplifies the automated execution of X clients in a virtual server + environment. This convenience script requires the use of the xauth + program. + . + More information about X.Org can be found at: + + + + . + This package is built from the X.org xserver module. + +Package: xserver-xephyr +Architecture: any +Depends: x11-common, ${shlibs:Depends}, ${misc:Depends} +Recommends: xbase-clients, xfonts-base +Description: nested X server + Xephyr is an X server that can be run inside another X server, + much like Xnest. It is based on the kdrive X server, and as a + result it supports newer extensions than Xnest, including render and + composite. + . + More information about X.Org can be found at: + + + + . + This package is built from the X.org xserver module. + +#Package: xserver-xfbdev +#Architecture: alpha amd64 arm armeb armel hppa i386 ia64 lpia m32r m68k mips mipsel powerpc ppc64 sh3 sh3eb sh4 sh4eb sparc +#Depends: ${shlibs:Depends}, ${misc:Depends} +#Recommends: xbase-clients +#Description: Linux framebuffer device tiny X server +# xserver-xfbdev is a Linux framebuffer device tiny X server based on the +# kdrive X server. +# . +# More information about X.Org can be found at: +# +# +# +# . +# This package is built from the X.org xserver module. + +Package: xprint +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, xprint-common, libxfont1 (>= 1:1.1) +Recommends: xprint-utils +Conflicts: xprt (<= 4.3.0.dfsg.1-10) +Description: X11 print system (binary) + Xprint is an advanced printing system which enables X11 applications + to use devices like printers, fax or create documents in formats like + PostScript, PDF, PCL, etc. + . + This package provides Xprt, the Xprint server compiled from + xprint.mozdev.org, an X.org subproject. Xprint provides superior support + for printing from Mozilla, including non-Latin characters and MathML. + TrueType fonts are supported. + . + Xprint uses ttf2pt1 internally for some font support. + . + More information about X.Org can be found at: + + + + . + This package is built from the X.org xserver module. + +Package: xprint-common +Architecture: all +Depends: xbase-clients, xfonts-encodings, x11-common (>= 1:7.0.12), ${shlibs:Depends}, ${misc:Depends} +Recommends: xprint, xfonts-base +Conflicts: xprt-common +Replaces: xprt-common +Description: Xprint - the X11 print system (configuration files) + Xprint is an advanced printing system which enables X11 applications + to use devices like printers, FAX or create documents in formats like + PostScript, PDF, PCL, etc. + . + This package provides the configuration and Postscript definition files + required to run Xprt, the Xprint server. Xprt is provided by xprint. + . + More information about X.Org can be found at: + + + + . + This package is built from the X.org xserver module. + +Package: xserver-xorg-core-dbg +Architecture: any +Depends: xserver-xorg-core (= ${binary:Version}) +Priority: extra +Description: Xorg - the X.Org X server (debugging symbols) + The Xorg X server is an X server for several architectures and operating + systems, which is derived from the XFree86 4.x series of X servers. + . + The Xorg server supports most modern graphics hardware from most vendors, + and supersedes all XFree86 X servers. + . + This package provides debugging symbols for the Xorg X server and associated + modules. --- xorg-server-1.4.2.orig/debian/README.printing-problems +++ xorg-server-1.4.2/debian/README.printing-problems @@ -0,0 +1,162 @@ +Printing Problems +----------------- + +This file is a mini-FAQ for two printing problems: + +Q1) Spaces between words are lost (words run together) + +Q2) Image is too big (font size too large) + OR + Image is too small (only takes up 1/4 of the page) + + +======================================================================= +Q1) Spaces between words are lost (words run together) + +At the time of the release of sarge, there is an unresolved problem +printing certain webpages from firefox using Xprint. The problem has been +reproduced with mozilla-firefox (0.9.3-2) and xprint (0.1.0.alpha1), +although the situation seems to have improved with firefox 1.0.1. + +mozilla proper (mozilla-browser 2:1.7.2-2) does not exhibit the +problem, it prints fine on the package maintainer's system, although +others have unfortunately reported seeing the problem there. + +The symptom of the problem is that spaces between words are lost, +words are printed strung all together. The font may be sans-serif, +where serif font is displayed on screen. + +The problem appears to happen on pages where the font is not +explicitly chosen in the HTML code. An example is Debian's home page, +www.debian.org. Other pages which specify the font to be used do not +seem to be affected. + +There are three known workarounds for the problem. + +1) Only use the default fonts in mozilla/firefox. + + The printing error will start happening if you change font settings + using Edit->Preferences (in particular if you set the serif font). + Changing the setting back again to the default value of "serif" will + not fix the problem. + + This is because setting the font places a "font.name.serif.x-western" + entry into ~/.mozilla/firefox/default.***/prefs.js. Even if the value + of the entry is "serif", it's mere presence will ruin printing. + + The workaround is to manually delete the "font.name.serif.x-western" + entry from prefs.js. + + This seems to fix the problem with the Debian home page, but depending + the page and language you want to print with you might find you will need + to delete other font.name entries as well. + +2) Remove Xprint's own font directory. + + Xprint contains font information in the directory + /usr/share/Xprint/xserver/C/print/models/PSdefault/fonts + If this directory is removed, then firefox prints www.debian.org + with correct spacing between words. The font used is sans-serif. + Xprint obtains information about fonts from other parts of the system. + + Since this workaround has not been fully tested and its consequences + are not fully understood (other locales and printer models in + Xprint link to this directory), the fonts directory will be left + intact for the official release of Xprint in Debian. + + A side-effect is that the date stamps for news entries on + www.debian.org are rendered using sans-serif font, where they + ought to be, I believe, rendered using a monospace font. + + +3) Use default stylesheet settings for firefox. + + User directories for firefox contain sample default style settings + in the chrome directory, at + ~/.firefox/default//chrome/userContent-example.css + This file, userContent-example.css, can be renamed to userContent.css, + and the following style added: + +@media print { + body { + font-family: times, serif; + } + tt, pre { + font-family: courier, monospace; + } +} + + This will instruct firefox to use serif font for the main text of web + pages where the default font is not specified. The spacing between + words will be rendered correctly. + + System administrators wishing to provide this style snippet + automatically to all users will want to make the adjustments in + /usr/lib/mozilla-firefox/defaults/profile/chrome/ + + Note, the same can be done for mozilla proper, if needed. + + +The problem is being tracked on the Debian Bug Tracking System at bugs +#235592 and #251067, and upstream at +http://xprint.freedesktop.org/bugzilla/show_bug.cgi?id=1112 + + +======================================================================== +Q2) Image is too big (font size too large) + OR + Image is too small (only takes up 1/4 of the page) + +This question is a standard Xprint FAQ (Q70). + +The problem means your default printer resolution is set to the wrong +value. The value is set in /etc/Xprint/C/print/attributes/document (or possibly +en_US/print/... rather than C/print/..., depending on your locale): + +*default-printer-resolution: 600 + +The standard default value is set to 600dpi. If your printer can only handle +300dpi, then four pixels (2x2) will be used for every one in your image, making +it print on paper larger than it ought to. The solution is to change the default +resolution to 300. + +Likewise if the default value is set to 300, but your printer can only handle +600dpi, then the pixels will only take up half the space on paper that they are +supposed to, so the image will only occupy a quarter of the page (1/2 x 1/2). +This problem was often reported under previous versions of Xprint, before the +default resolution was set to 600. In the latest version we have made the +assumption that 300dpi printers are today relatively rare, and so have set the +default value to 600. A side-effect is the first problem discussed in the +previous paragraph, for 300dpi-only printers. + +For your convenience, a debconf question has been provided enabling you to set +the default resolution at installation time (or after running +"dpkg-reconfigure xprint-common"). + +Note that these problems do not affect all printers. Some 600dpi printers will +happily render 300dpi images, using a 2x2 block for each pixel in the image to +give a normal physical image size on paper. + +Your printer's resolutions may possibly also need to be set consistently in the +underlying spooler. For instance CUPS settings can usually be accessed at +http://localhost:631/printers (use the "Configure Printer" link). + +If you have different printers which need to be run at different resolutions, +you will need to manually set a value for default-printer-resolution for each printer +separately (that is, for each one which differs from the default value). +See FAQ Q211. For instance, if the printer named "old_printer" needs to run at +300 dpi, while others work at 600dpi, then you need to use: +*default-printer-resolution: 600 +old_printer.default-printer-resolution: 300 + +We can't please everybody all the time! Please set your default resolution +according to your own needs. We hope that in a future version, Xprint will be +able to set these values dynamically from the underlying printing spooler +(CUPS, if not others). Watch http://bugzilla.mozdev.org/show_bug.cgi?id=5517 +for further developments. + + + +Good luck! + +Drew Parsons , 15 Mar 2005. --- xorg-server-1.4.2.orig/debian/xprint.install +++ xorg-server-1.4.2/debian/xprint.install @@ -0,0 +1 @@ +usr/bin/Xprt --- xorg-server-1.4.2.orig/debian/xserver-xorg-core.install +++ xorg-server-1.4.2/debian/xserver-xorg-core.install @@ -0,0 +1,17 @@ +etc/X11/xserver/SecurityPolicy +usr/lib/xorg/modules/*.so +usr/lib/xorg/modules/extensions/*.so +usr/lib/xorg/modules/fonts/* +usr/lib/xorg/modules/linux/*.so +usr/lib/xorg/modules/freebsd/*.so +usr/lib/xorg/modules/multimedia/*.so +usr/bin/Xorg +usr/share/man/man1/Xserver.1 +usr/share/man/man1/Xorg.1 +usr/share/man/man4/exa.4 +usr/share/man/man4/fbdevhw.4 +usr/share/man/man5/xorg.conf.5 +usr/bin/cvt +usr/bin/gtf +usr/share/man/man1/cvt.1 +usr/share/man/man1/gtf.1 --- xorg-server-1.4.2.orig/debian/xserver-xephyr.install +++ xorg-server-1.4.2/debian/xserver-xephyr.install @@ -0,0 +1 @@ +usr/bin/Xephyr --- xorg-server-1.4.2.orig/debian/xserver-xfbdev.install +++ xorg-server-1.4.2/debian/xserver-xfbdev.install @@ -0,0 +1 @@ +usr/bin/Xfbdev --- xorg-server-1.4.2.orig/debian/watch +++ xorg-server-1.4.2/debian/watch @@ -0,0 +1,2 @@ +version=3 +http://xorg.freedesktop.org/releases/individual/xserver/ xorg-server-(.*)\.tar\.gz --- xorg-server-1.4.2.orig/debian/xprint-common.README.Debian +++ xorg-server-1.4.2/debian/xprint-common.README.Debian @@ -0,0 +1,82 @@ +xprint for Debian +=========================== + +This package supplies Xprt, the Xprint server. It is able to work with the +mozilla printing system, allowing non-latin characters and MathML to be +printed, among other improvements over the default mozilla printing driver. + + +Running the Xprint server +----------------------- + +The Xprint server is started and stopped via /etc/init.d/xprint, +provided in package xprint-common. + +As of version 0.0.8, Xprint supports TrueType fonts. + +Xprint requires a print server such as lprng or CUPS to be installed. It +uses lpc or lpstat to identify available printers. + +The Xprint server is not registered in /etc/inetd.conf. If you require the use +of the Xprint server across a network, you will be responsible for +this yourself (use update-inetd to register the server). Note that +this question is not the same as using a networked printer via a local +Xprint server. The printers themselves are configured via /etc/cups/printers.conf, +/etc/printcap or similar, independently of Xprint. + + +----------------------------- +Xprint server will not start: +Error: could not open default font 'fixed' + +Some users have reported experiencing this problem, which prevents Xprt from +starting. We have not yet been able to precisely pinpoint the cause of the +problem. It appears to happen when some TrueType fonts are not correctly +installed. It may be that Xprt finds the bad fonts and quits working through +the font list, rather than simply ignoring the bad fonts as it ought to. Hence +Xprt does not manage to get to the font directory in the font list containing +the fixed fonts. + +Some users have reported a workaround in /etc/init.d/xprint: +In line 343, use + "sort -u -r" +instead of + "sort -u" + +This has not been patched in to the package since it does not actually fix +the problem, it simply provides an alternative means of (hopefully) finding a +fixed font, by reversing the order in which font directories are searched. + + + +Running Xprint clients +---------------------- + +Client programs such as mozilla will require the Xprint server to be +identified in variable XPSERVERLIST. This variable is automatically defined +for all X sessions in /etc/X11/Xsession.d/92xprint-xpserverlist.sh. If +required, the value for this variable can be obtained manually using +/etc/init.d/xprint, via "/etc/init.d/xprint get_xpserverlist". + +You may find it helpful to define your default printer, with, for example, + export LPDEST=lp +Unfortunately, default printers set within CUPS are not currently +recognised. + +You can test that Xprt is working by running xplsprinters. +xphelloworld prints a simple test page. Both these test programs are provided +by xprint, along with a handful of others. + + +Printing Problems +----------------- + +If you experience the problem that words are run together on the +printed page with no spaces between them, then please read +README.printing-problems for further instructions. + +This file also describes how to change the printer resolution settings if your +image on paper is printed too large or too small. + + + -- Drew Parsons , 17 Feb 2005 --- xorg-server-1.4.2.orig/debian/copyright +++ xorg-server-1.4.2/debian/copyright @@ -0,0 +1,952 @@ +This package was downloaded from +http://xorg.freedesktop.org/releases/individual/xserver/ +The upstream tarball has been modified to remove the files listed in +debian/prune/non-free. + + Licenses + + The X.Org Foundation + + March 2004 + +1. Introduction + +The X.org Foundation X Window System distribution is a compilation of code +and documentation from many sources. This document is intended primarily as +a guide to the licenses used in the distribution: you must check each file +and/or package for precise redistribution terms. None-the-less, this summary +may be useful to many users. No software incorporating the XFree86 1.1 +license has been incorporated. + +This document is based on the compilation from XFree86. + +2. XFree86 License + +XFree86 code without an explicit copyright is covered by the following copy- +right/license: + +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 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 +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 CON- +NECTION 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 deal- +ings in this Software without prior written authorization from the XFree86 +Project. + +3. Other Licenses + +Portions of code are covered by the following licenses/copyrights. See indi- +vidual files for the copyright dates. + +3.1 X/MIT Copyrights + +3.1.1 X Consortium + +Copyright (C) X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +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 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 X Consortium 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 X Consortium. + +X Window System is a trademark of X Consortium, Inc. + +3.1.2 The Open Group + +Copyright 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, FIT- +NESS 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. + +3.2 Berkeley-based copyrights: + +o + +3.2.1 General + +Redistribution and use in source and binary forms, with or without modifica- +tion, 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 MER- +CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- +CIAL, 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 OTH- +ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. + +3.2.2 UCB/LBL + +Copyright (c) 1993 The Regents of the University of California. All rights +reserved. + +This software was developed by the Computer Systems Engineering group at +Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and contributed to +Berkeley. + +All advertising materials mentioning features or use of this software must +display the following acknowledgement: This product includes software devel- +oped by the University of California, Lawrence Berkeley Laboratory. + +Redistribution and use in source and binary forms, with or without modifica- +tion, 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. All advertising materials mentioning features or use of this software + must display the following acknowledgement: This product includes soft- + ware developed by the University of California, Berkeley and its con- + tributors. + + 4. Neither the name of the University 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 REGENTS 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 DIS- +CLAIMED. 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. + +3.2.3 The NetBSD Foundation, Inc. + +Copyright (c) 2003 The NetBSD Foundation, Inc. All rights reserved. + +This code is derived from software contributed to The NetBSD Foundation by +Ben Collver + +Redistribution and use in source and binary forms, with or without modifica- +tion, 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. All advertising materials mentioning features or use of this software + must display the following acknowledgement: This product includes soft- + ware developed by the NetBSD Foundation, Inc. and its contributors. + + 4. Neither the name of The NetBSD Foundation nor the names of its con- + tributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSE- +QUENTIAL 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 DAM- +AGE. + +3.2.4 Theodore Ts'o. + +Copyright Theodore Ts'o, 1994, 1995, 1996, 1997, 1998, 1999. All rights +reserved. + +Redistribution and use in source and binary forms, with or without modifica- +tion, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + and the entire permission notice in its entirety, including the dis- + claimer of warranties. + + 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. he 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 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE, ALL OF WHICH ARE HEREBY DISCLAIMED. IN NO +EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- +CIAL, 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 OTH- +ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF NOT +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +3.2.5 Theo de Raadt and Damien Miller + +Copyright (c) 1995,1999 Theo de Raadt. All rights reserved. Copyright (c) +2001-2002 Damien Miller. All rights reserved. + +Redistribution and use in source and binary forms, with or without modifica- +tion, 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 AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- +CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- +CIAL, 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 OTH- +ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. + +3.2.6 Todd C. Miller + +Copyright (c) 1998 Todd C. Miller + +Permission to use, copy, modify, and distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright +notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND TODD C. MILLER DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MER- +CHANTABILITY AND FITNESS. IN NO EVENT SHALL TODD C. MILLER BE LIABLE FOR ANY +SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER +RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CON- +TRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION +WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +3.2.7 Thomas Winischhofer + +Copyright (C) 2001-2004 Thomas Winischhofer + +Redistribution and use in source and binary forms, with or without modifica- +tion, 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 EXPRESSED 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, SPE- +CIAL, 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 OTH- +ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. + +3.3 NVIDIA Corp + +Copyright (c) 1996 NVIDIA, Corp. All rights reserved. + +NOTICE TO USER: The source code is copyrighted under U.S. and international +laws. NVIDIA, Corp. of Sunnyvale, California owns the copyright and as +design patents pending on the design and interface of the NV chips. Users +and possessors of this source code are hereby granted a nonexclusive, roy- +alty-free copyright and design patent license to use this code in individual +and commercial software. + +Any use of this source code must include, in the user documentation and +internal comments to the code, notices to the end user as follows: + +Copyright (c) 1996 NVIDIA, Corp. NVIDIA design patents pending in the U.S. +and foreign countries. + +NVIDIA, CORP. MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOURCE +CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WAR- +RANTY OF ANY KIND. NVIDIA, CORP. DISCLAIMS ALL WARRANTIES WITH REGARD TO +THIS SOURCE CODE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA, CORP. BE LIABLE +FOR ANY SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY DAM- +AGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE. + +3.4 GLX Public License + +GLX PUBLIC LICENSE (Version 1.0 (2/11/99)) ("License") + +Subject to any third party claims, Silicon Graphics, Inc. ("SGI") hereby +grants permission to Recipient (defined below), under Recipient's copyrights +in the Original Software (defined below), to use, copy, modify, merge, pub- +lish, distribute, sublicense and/or sell copies of Subject Software (defined +below), and to permit persons to whom the Subject Software is furnished in +accordance with this License to do the same, subject to all of the following +terms and conditions, which Recipient accepts by engaging in any such use, +copying, modifying, merging, publishing, distributing, sublicensing or sell- +ing: + +1. Definitions. + + (a) "Original Software" means source code of computer software code + which is described in Exhibit A as Original Software. + + (b) "Modifications" means any addition to or deletion from the sub- + stance or structure of either the Original Software or any previous + Modifications. When Subject Software is released as a series of + files, a Modification means (i) any addition to or deletion from + the contents of a file containing Original Software or previous + Modifications and (ii) any new file that contains any part of the + Original Code or previous Modifications. + + (c) "Subject Software" means the Original Software or Modifications + or the combination of the Original Software and Modifications, or + portions of any of the foregoing. + + (d) "Recipient" means an individual or a legal entity exercising + rights under, and complying with all of the terms of, this License. + For legal entities, "Recipient" includes any entity which controls, + is controlled by, or is under common control with Recipient. For + purposes of this definition, "control" of an entity means (a) the + power, direct or indirect, to direct or manage such entity, or (b) + ownership of fifty percent (50%) or more of the outstanding shares + or beneficial ownership of such entity. + +2. Redistribution of Source Code Subject to These Terms. Redistributions of +Subject Software in source code form must retain the notice set forth in +Exhibit A, below, in every file. A copy of this License must be included in +any documentation for such Subject Software where the recipients' rights +relating to Subject Software are described. Recipient may distribute the +source code version of Subject Software under a license of Recipient's +choice, which may contain terms different from this License, provided that +(i) Recipient is in compliance with the terms of this License, and (ii) the +license terms include this Section 2 and Sections 3, 4, 7, 8, 10, 12 and 13 +of this License, which terms may not be modified or superseded by any other +terms of such license. If Recipient distributes the source code version under +a different license Recipient must make it absolutely clear that any terms +which differ from this License are offered by Recipient alone, not by SGI. +Recipient hereby agrees to indemnify SGI for any liability incurred by SGI as +a result of any such terms Recipient offers. + +3. Redistribution in Executable Form. The notice set forth in Exhibit A must +be conspicuously included in any notice in an executable version of Subject +Software, related documentation or collateral in which Recipient describes +the user's rights relating to the Subject Software. Recipient may distribute +the executable version of Subject Software under a license of Recipient's +choice, which may contain terms different from this License, provided that +(i) Recipient is in compliance with the terms of this License, and (ii) the +license terms include this Section 3 and Sections 4, 7, 8, 10, 12 and 13 of +this License, which terms may not be modified or superseded by any other +terms of such license. If Recipient distributes the executable version under +a different license Recipient must make it absolutely clear that any terms +which differ from this License are offered by Recipient alone, not by SGI. +Recipient hereby agrees to indemnify SGI for any liability incurred by SGI as +a result of any such terms Recipient offers. + +4. Termination. This License and the rights granted hereunder will terminate +automatically if Recipient fails to comply with terms herein and fails to +cure such breach within 30 days of the breach. Any sublicense to the Subject +Software which is properly granted shall survive any termination of this +License absent termination by the terms of such sublicense. Provisions which, +by their nature, must remain in effect beyond the termination of this License +shall survive. + +5. No Trademark Rights. This License does not grant any rights to use any +trade name, trademark or service mark whatsoever. No trade name, trademark or +service mark of SGI may be used to endorse or promote products derived from +the Subject Software without prior written permission of SGI. + +6. No Other Rights. This License does not grant any rights with respect to +the OpenGL API or to any software or hardware implementation thereof or to +any other software whatsoever, nor shall any other rights or licenses not +expressly granted hereunder arise by implication, estoppel or otherwise with +respect to the Subject Software. Title to and ownership of the Original Soft- +ware at all times remains with SGI. All rights in the Original Software not +expressly granted under this License are reserved. + +7. Compliance with Laws; Non-Infringement. Recipient shall comply with all +applicable laws and regulations in connection with use and distribution of +the Subject Software, including but not limited to, all export and import +control laws and regulations of the U.S. government and other countries. +Recipient may not distribute Subject Software that (i) in any way infringes +(directly or contributorily) the rights (including patent, copyright, trade +secret, trademark or other intellectual property rights of any kind) of any +other person or entity or (ii) breaches any representation or warranty, +express, implied or statutory, which under any applicable law it might be +deemed to have been distributed. + +8. Claims of Infringement. If Recipient at any time has knowledge of any one +or more third party claims that reproduction, modification, use, distribu- +tion, import or sale of Subject Software (including particular functionality +or code incorporated in Subject Software) infringes the third party's intel- +lectual property rights, Recipient must place in a well-identified web page +bearing the title "LEGAL" a description of each such claim and a description +of the party making each such claim in sufficient detail that a user of the +Subject Software will know whom to contact regarding the claim. Also, upon +gaining such knowledge of any such claim, Recipient must conspicuously +include the URL for such web page in the Exhibit A notice required under Sec- +tions 2 and 3, above, and in the text of any related documentation, license +agreement or collateral in which Recipient describes end user's rights relat- +ing to the Subject Software. If Recipient obtains such knowledge after it +makes Subject Software available to any other person or entity, Recipient +shall take other steps (such as notifying appropriate mailing lists or news- +groups) reasonably calculated to inform those who received the Subject Soft- +ware that new knowledge has been obtained. + +9. DISCLAIMER OF WARRANTY. SUBJECT SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE SUBJECT SOFTWARE IS FREE OF DEFECTS, MER- +CHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON- INFRINGING. SGI ASSUMES NO +RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE. SHOULD ANY SOFTWARE +PROVE DEFECTIVE IN ANY RESPECT, SGI ASSUMES NO COST OR LIABILITY FOR ANY SER- +VICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN +ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY SUBJECT SOFTWARE IS AUTHORIZED +HEREUNDER EXCEPT UNDER THIS DISCLAIMER. + +10. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THE- +ORY, WHETHER TORT (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE OR STRICT LIA- +BILITY), CONTRACT, OR OTHERWISE, SHALL SGI OR ANY SGI LICENSOR BE LIABLE FOR +ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY +CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK +STOPPAGE, LOSS OF DATA, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER +COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF +THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY +TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SGI's NEGLIGENCE TO +THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO +NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, +SO THAT EXCLUSION AND LIMITATION MAY NOT APPLY TO RECIPIENT. + +11. Indemnity. Recipient shall be solely responsible for damages arising, +directly or indirectly, out of its utilization of rights under this License. +Recipient will defend, indemnify and hold harmless Silicon Graphics, Inc. +from and against any loss, liability, damages, costs or expenses (including +the payment of reasonable attorneys fees) arising out of Recipient's use, +modification, reproduction and distribution of the Subject Software or out of +any representation or warranty made by Recipient. + +12. U.S. Government End Users. The Subject Software is a "commercial item" +consisting of "commercial computer software" as such terms are defined in +title 48 of the Code of Federal Regulations and all U.S. Government End +Users acquire only the rights set forth in this License and are subject to +the terms of this License. + +13. Miscellaneous. This License represents the complete agreement concerning +subject matter hereof. If any provision of this License is held to be unen- +forceable, such provision shall be reformed so as to achieve as nearly as +possible the same economic effect as the original provision and the remainder +of this License will remain in effect. This License shall be governed by and +construed in accordance with the laws of the United States and the State of +California as applied to agreements entered into and to be performed entirely +within California between California residents. Any litigation relating to +this License shall be subject to the exclusive jurisdiction of the Federal +Courts of the Northern District of California (or, absent subject matter +jurisdiction in such courts, the courts of the State of California), with +venue lying exclusively in Santa Clara County, California, with the losing +party responsible for costs, including without limitation, court costs and +reasonable attorneys fees and expenses. The application of the United Nations +Convention on Contracts for the International Sale of Goods is expressly +excluded. Any law or regulation which provides that the language of a con- +tract shall be construed against the drafter shall not apply to this License. + +Exhibit A + +The contents of this file are subject to Sections 2, 3, 4, 7, 8, 10, 12 and +13 of the GLX Public License Version 1.0 (the "License"). You may not use +this file except in compliance with those sections of the License. You may +obtain a copy of the License at Silicon Graphics, Inc., attn: Legal Services, +2011 N. Shoreline Blvd., Mountain View, CA 94043 or at +http://www.sgi.com/software/opensource/glx/license.html. + +Software distributed under the License is distributed on an "AS IS" basis. +ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED +WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF NON- +INFRINGEMENT. See the License for the specific language governing rights and +limitations under the License. + +The Original Software is GLX version 1.2 source code, released February, +1999. The developer of the Original Software is Silicon Graphics, Inc. Those +portions of the Subject Software created by Silicon Graphics, Inc. are Copy- +right (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. + +3.5 CID Font Code Public License + +CID FONT CODE PUBLIC LICENSE (Version 1.0 (3/31/99))("License") + +Subject to any applicable third party claims, Silicon Graphics, Inc. ("SGI") +hereby grants permission to Recipient (defined below), under SGI's copyrights +in the Original Software (defined below), to use, copy, modify, merge, pub- +lish, distribute, sublicense and/or sell copies of Subject Software (defined +below) in both source code and executable form, and to permit persons to whom +the Subject Software is furnished in accordance with this License to do the +same, subject to all of the following terms and conditions, which Recipient +accepts by engaging in any such use, copying, modifying, merging, publica- +tion, distributing, sublicensing or selling: + +1. Definitions. + + a. "Original Software" means source code of computer software code + that is described in Exhibit A as Original Software. + + b. "Modifications" means any addition to or deletion from the sub- + stance or structure of either the Original Software or any previous + Modifications. When Subject Software is released as a series of + files, a Modification means (i) any addition to or deletion from + the contents of a file containing Original Software or previous + Modifications and (ii) any new file that contains any part of the + Original Code or previous Modifications. + + c. "Subject Software" means the Original Software or Modifications + or the combination of the Original Software and Modifications, or + portions of any of the foregoing. + + d. "Recipient" means an individual or a legal entity exercising + rights under the terms of this License. For legal entities, "Recip- + ient" includes any entity that controls, is controlled by, or is + under common control with Recipient. For purposes of this defini- + tion, "control" of an entity means (i) the power, direct or indi- + rect, to direct or manage such entity, or (ii) ownership of fifty + percent (50%) or more of the outstanding shares or beneficial own- + ership of such entity. + + e. "Required Notice" means the notice set forth in Exhibit A to + this License. + + f. "Accompanying Technology" means any software or other technology + that is not a Modification and that is distributed or made publicly + available by Recipient with the Subject Software. Separate soft- + ware files that do not contain any Original Software or any previ- + ous Modification shall not be deemed a Modification, even if such + software files are aggregated as part of a product, or in any + medium of storage, with any file that does contain Original Soft- + ware or any previous Modification. + +2. License Terms. All distribution of the Subject Software must be made sub- +ject to the terms of this License. A copy of this License and the Required +Notice must be included in any documentation for Subject Software where +Recipient's rights relating to Subject Software and/or any Accompanying Tech- +nology are described. Distributions of Subject Software in source code form +must also include the Required Notice in every file distributed. In addition, +a ReadMe file entitled "Important Legal Notice" must be distributed with each +distribution of one or more files that incorporate Subject Software. That +file must be included with distributions made in both source code and exe- +cutable form. A copy of the License and the Required Notice must be included +in that file. Recipient may distribute Accompanying Technology under a +license of Recipient's choice, which may contain terms different from this +License, provided that (i) Recipient is in compliance with the terms of this +License, (ii) such other license terms do not modify or supersede the terms +of this License as applicable to the Subject Software, (iii) Recipient hereby +indemnifies SGI for any liability incurred by SGI as a result of the distri- +bution of Accompanying Technology or the use of other license terms. + +3. Termination. This License and the rights granted hereunder will terminate +automatically if Recipient fails to comply with terms herein and fails to +cure such breach within 30 days of the breach. Any sublicense to the Subject +Software that is properly granted shall survive any termination of this +License absent termination by the terms of such sublicense. Provisions which, +by their nature, must remain in effect beyond the termination of this License +shall survive. + +4. Trademark Rights. This License does not grant any rights to use any trade +name, trademark or service mark whatsoever. No trade name, trademark or ser- +vice mark of SGI may be used to endorse or promote products derived from or +incorporating any Subject Software without prior written permission of SGI. + +5. No Other Rights. No rights or licenses not expressly granted hereunder +shall arise by implication, estoppel or otherwise. Title to and ownership of +the Original Software at all times remains with SGI. All rights in the Origi- +nal Software not expressly granted under this License are reserved. + +6. Compliance with Laws; Non-Infringement. Recipient shall comply with all +applicable laws and regulations in connection with use and distribution of +the Subject Software, including but not limited to, all export and import +control laws and regulations of the U.S. government and other countries. +Recipient may not distribute Subject Software that (i) in any way infringes +(directly or contributorily) the rights (including patent, copyright, trade +secret, trademark or other intellectual property rights of any kind) of any +other person or entity, or (ii) breaches any representation or warranty, +express, implied or statutory, which under any applicable law it might be +deemed to have been distributed. + +7. Claims of Infringement. If Recipient at any time has knowledge of any one +or more third party claims that reproduction, modification, use, distribu- +tion, import or sale of Subject Software (including particular functionality +or code incorporated in Subject Software) infringes the third party's intel- +lectual property rights, Recipient must place in a well-identified web page +bearing the title "LEGAL" a description of each such claim and a description +of the party making each such claim in sufficient detail that a user of the +Subject Software will know whom to contact regarding the claim. Also, upon +gaining such knowledge of any such claim, Recipient must conspicuously +include the URL for such web page in the Required Notice, and in the text of +any related documentation, license agreement or collateral in which Recipient +describes end user's rights relating to the Subject Software. If Recipient +obtains such knowledge after it makes Subject Software available to any other +person or entity, Recipient shall take other steps (such as notifying appro- +priate mailing lists or newsgroups) reasonably calculated to provide such +knowledge to those who received the Subject Software. + +8. DISCLAIMER OF WARRANTY. SUBJECT SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE SUBJECT SOFTWARE IS FREE OF DEFECTS, MER- +CHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. SGI ASSUMES NO +RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE. SHOULD ANY SOFTWARE +PROVE DEFECTIVE IN ANY RESPECT, SGI ASSUMES NO COST OR LIABILITY FOR ANY SER- +VICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN +ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY SUBJECT SOFTWARE IS AUTHORIZED +HEREUNDER EXCEPT UNDER THIS DISCLAIMER. + +9. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, +WHETHER TORT (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE OR STRICT LIABILITY), +CONTRACT, OR OTHERWISE, SHALL SGI OR ANY SGI LICENSOR BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SUBJECT SOFTWARE OR +THE USE OR OTHER DEALINGS IN THE SUBJECT SOFTWARE. SOME JURISDICTIONS DO NOT +ALLOW THE EXCLUSION OR LIMITATION OF CERTAIN DAMAGES, SO THIS EXCLUSION AND +LIMITATION MAY NOT APPLY TO RECIPIENT TO THE EXTENT SO DISALLOWED. + +10. Indemnity. Recipient shall be solely responsible for damages arising, +directly or indirectly, out of its utilization of rights under this License. +Recipient will defend, indemnify and hold SGI and its successors and assigns +harmless from and against any loss, liability, damages, costs or expenses +(including the payment of reasonable attorneys fees) arising out of (Recipi- +ent's use, modification, reproduction and distribution of the Subject Soft- +ware or out of any representation or warranty made by Recipient. + +11. U.S. Government End Users. The Subject Software is a "commercial item" +consisting of "commercial computer software" as such terms are defined in +title 48 of the Code of Federal Regulations and all U.S. Government End Users +acquire only the rights set forth in this License and are subject to the +terms of this License. + +12. Miscellaneous. This License represents the complete agreement concerning +subject matter hereof. If any provision of this License is held to be unen- +forceable by any judicial or administrative authority having proper jurisdic- +tion with respect thereto, such provision shall be reformed so as to achieve +as nearly as possible the same economic effect as the original provision and +the remainder of this License will remain in effect. This License shall be +governed by and construed in accordance with the laws of the United States +and the State of California as applied to agreements entered into and to be +performed entirely within California between California residents. Any liti- +gation relating to this License shall be subject to the exclusive jurisdic- +tion of the Federal Courts of the Northern District of California (or, absent +subject matter jurisdiction in such courts, the courts of the State of Cali- +fornia), with venue lying exclusively in Santa Clara County, California, with +the losing party responsible for costs, including without limitation, court +costs and reasonable attorneys fees and expenses. The application of the +United Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation that provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +Exhibit A + +Copyright (c) 1994-1999 Silicon Graphics, Inc. + +The contents of this file are subject to the CID Font Code Public License +Version 1.0 (the "License"). You may not use this file except in compliance +with the License. You may obtain a copy of the License at Silicon Graphics, +Inc., attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 +or at http://www.sgi.com/software/opensource/cid/license.html + +Software distributed under the License is distributed on an "AS IS" basis. +ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED +WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF NON- +INFRINGEMENT. See the License for the specific language governing rights and +limitations under the License. + +The Original Software (as defined in the License) is CID font code that was +developed by Silicon Graphics, Inc. Those portions of the Subject Software +(as defined in the License) that were created by Silicon Graphics, Inc. are +Copyright (c) 1994-1999 Silicon Graphics, Inc. All Rights Reserved. + +[NOTE: When using this text in connection with Subject Software delivered +solely in object code form, Recipient may replace the words "this file" with +"this software" in both the first and second sentences.] + +3.6 Bitstream Vera Fonts Copyright + +The fonts have a generous copyright, allowing derivative works (as long as +"Bitstream" or "Vera" are not in the names), and full redistribution (so long +as they are not *sold* by themselves). They can be be bundled, redistributed +and sold with any software. + +The fonts are distributed under the following copyright: + +Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is +a trademark of Bitstream, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of the fonts accompanying this license ("Fonts") and associated documentation +files (the "Font Software"), to reproduce and distribute the Font Software, +including without limitation the rights to use, copy, merge, publish, dis- +tribute, and/or sell copies of the Font Software, and to permit persons to +whom the Font Software is furnished to do so, subject to the following condi- +tions: + +The above copyright and trademark notices and this permission notice shall be +included in all copies of one or more of the Font Software typefaces. + +The Font Software may be modified, altered, or added to, and in particular +the designs of glyphs or characters in the Fonts may be modified and addi- +tional glyphs or characters may be added to the Fonts, only if the fonts are +renamed to names not containing either the words "Bitstream" or the word +"Vera". + +This License becomes null and void to the extent applicable to Fonts or Font +Software that has been modified and is distributed under the "Bitstream Vera" +names. + +The Font Software may be sold as part of a larger software package but no +copy of one or more of the Font Software typefaces may be sold by itself. + +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, +TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME FOUNDA- +TION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GEN- +ERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR +INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFT- +WARE. + +Except as contained in this notice, the names of Gnome, the Gnome Foundation, +and Bitstream Inc., shall not be used in advertising or otherwise to promote +the sale, use or other dealings in this Font Software without prior written +authorization from the Gnome Foundation or Bitstream Inc., respectively. For +further information, contact: fonts at gnome dot org. + +3.7 Bigelow & Holmes Inc and URW++ GmbH Luxi font license + +Luxi fonts copyright (c) 2001 by Bigelow & Holmes Inc. Luxi font instruction +code copyright (c) 2001 by URW++ GmbH. All Rights Reserved. Luxi is a regis- +tered trademark of Bigelow & Holmes Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of these Fonts and associated documentation files (the "Font Software"), to +deal in the Font Software, including without limitation the rights to use, +copy, merge, publish, distribute, sublicense, and/or sell copies of the Font +Software, and to permit persons to whom the Font Software is furnished to do +so, subject to the following conditions: + +The above copyright and trademark notices and this permission notice shall be +included in all copies of one or more of the Font Software. + +The Font Software may not be modified, altered, or added to, and in particu- +lar the designs of glyphs or characters in the Fonts may not be modified nor +may additional glyphs or characters be added to the Fonts. This License +becomes null and void when the Fonts or Font Software have been modified. + +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, +TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BIGELOW & HOLMES INC. OR URW++ +GMBH. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GEN- +ERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR +INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFT- +WARE. + +Except as contained in this notice, the names of Bigelow & Holmes Inc. and +URW++ GmbH. shall not be used in advertising or otherwise to promote the +sale, use or other dealings in this Font Software without prior written +authorization from Bigelow & Holmes Inc. and URW++ GmbH. + +For further information, contact: + +info@urwpp.de or design@bigelowandholmes.com + + $Id: LICENSE,v 1.3 2004/09/03 23:41:21 kem Exp $ + + +======================================================================== +Certain files in this package (e.g. GL/glx/g_*) are covered by the SGI +Free Software License B, Version 1.1, http://oss.sgi.com/projects/FreeB + +SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + +Copyright (C) [dates of first publication] 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. + +============================================================================= +Xprint uses ttf2pt1 for Freetype support. + + -- ttf2pt1 licence -- + +The following copyright notice applies to all the files provided +in this distribution unless explicitly noted otherwise +(the most notable exception being t1asm.c). + + Copyright (c) 1997-2002 by the AUTHORS: + Andrew Weeks + Frank M. Siegert + Mark Heath + Thomas Henlich + Sergey Babkin , + Turgut Uyar + Rihardas Hepas + Szalay Tamas + Johan Vromans + Petr Titera + Lei Wang + Chen Xiangyang + Zvezdan Petkovic + Rigel + All rights reserved. + + 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. All advertising materials mentioning features or use of this software + must display the following acknowledgement: + This product includes software developed by the TTF2PT1 Project + and its contributors. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS 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 AUTHORS 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. + +For the approximate list of the AUTHORS' responsibilities see the +project history. + +Other contributions to the project are: + +Turgut Uyar + The Unicode translation table for the Turkish language. + +Rihardas Hepas + The Unicode translation table for the Baltic languages. + +Szalay Tamas + The Unicode translation table for the Central European languages. + +Johan Vromans + The RPM file. + +Petr Titera + The Unicode map format with names, the forced Unicode option. + +Frank M. Siegert + Port to Windows + +Lei Wang +Chen Xiangyang + Translation maps for Chinese fonts. + +Zvezdan Petkovic + The Unicode translation tables for the Cyrillic alphabet. + +Rigel + Generation of the dvips encoding files, modification to the Chinese maps. + +I. Lee Hetherington + The Type1 assembler (from the package 't1utils'), its full copyright + notice: + Copyright (c) 1992 by I. Lee Hetherington, all rights reserved. + Permission is hereby granted to use, modify, and distribute this program + for any purpose provided this copyright notice and the one below remain + intact. --- xorg-server-1.4.2.orig/debian/inputabiver +++ xorg-server-1.4.2/debian/inputabiver @@ -0,0 +1 @@ +2 --- xorg-server-1.4.2.orig/debian/xprint.changelog.Debian +++ xorg-server-1.4.2/debian/xprint.changelog.Debian @@ -0,0 +1,810 @@ +xprint (1:1.1.99.3+git20060910-9) unstable; urgency=low + + * Galician debconf translation. Thanks Jacobo Tarrio. Closes: #408216. + * Patch 60_font_links makes symlinks to font files relative to local + directory, for easier management. Also ensures + NewCenturySchlbk-BoldItalic.pmf is installed. Closes: #412990. + + -- Drew Parsons Sat, 3 Mar 2007 00:32:11 +1100 + +xprint (1:1.1.99.3+git20060910-8) unstable; urgency=low + + * Spanish debconf translation. Thanks Fernando Cereza. Closes: #402984. + + -- Drew Parsons Tue, 2 Jan 2007 22:29:25 +1100 + +xprint (1:1.1.99.3+git20060910-7) unstable; urgency=low + + * Patch 50_byteswap.patch enables Xprint with GLX support on Hurd + and GNU/FreeBSD. Closes: #400869. + + -- Drew Parsons Fri, 1 Dec 2006 14:21:16 +1100 + +xprint (1:1.1.99.3+git20060910-6) unstable; urgency=low + + * Xprint 1.1.99.3 actually Build-Depends: mesa (>= 6.5.1). + Closes: #395519. + + -- Drew Parsons Sun, 12 Nov 2006 14:53:25 +1100 + +xprint (1:1.1.99.3+git20060910-5) unstable; urgency=low + + * Even though --disable-record is used, record is still built. This + is probably a bug in upstream Makefile.am, or possibly recordproto + ought to be added to the REQUIRED_MODULES in configure.ac. + Workaround with Build-Depends: x11proto-record-dev. + + -- Drew Parsons Mon, 2 Oct 2006 14:14:17 +1000 + +xprint (1:1.1.99.3+git20060910-4) unstable; urgency=low + + * Connect tabbed blocks in debian/rules in order to properly disable + dri, Xorg, Xvfb and Xnest at configure step. + * Refine extension dependencies and disables in line with what + Xprint actually supports, as defined in mi/miinitext.c. + + -- Drew Parsons Mon, 2 Oct 2006 02:12:13 +1000 + +xprint (1:1.1.99.3+git20060910-3) unstable; urgency=low + + * Restore OpenGL support. "Because I can". + * Incidentally, bugs fixed previously in experimental can be closed + by using -v with dpkg-buildpackage when next uploading to unstable. + + -- Drew Parsons Sun, 1 Oct 2006 21:03:11 +1000 + +xprint (1:1.1.99.3+git20060910-2) unstable; urgency=low + + * xfixes 4 is now in unstable, so bring the new xprint into unstable + * It really irritates me the way bugs fixed in experimental are not + fully closed when the upload to unstable is made. + Closes: #377659, #384775, #383166, #375125, #369834. + + -- Drew Parsons Wed, 20 Sep 2006 10:21:50 +1000 + +xprint (1:1.1.99.3+git20060910-1) experimental; urgency=low + + * Latest git. + Patches applied upstream: + 80_no_composite + 91_Xprint_README + 91_enforce_bash + 91_install_config + 91_install_etc + 94_man_typoes + * Install manpages via * to avoid defining .1 or .1x. Closes: #383166. + + -- Drew Parsons Sun, 10 Sep 2006 19:21:27 +1000 + +xprint (1:1.1.99.2+git20060627-0.4) experimental; urgency=low + + * Swapped patch 80_check_windowpixmap for 80_no_composite. Composite has + no role in Xprint. + * LSB compliance: force-reload only operates conditionally when Xprt is + already running. Thanks Sven Mueller. Closes: #377659. + * Added Portuguese debconf translation, thanks Rui Branco. Closes: #384775. + * Adjust debian/xprint.manpages to allow for a shifting suffix. + Closes: #383166. + + -- Drew Parsons Sun, 27 Aug 2006 13:51:57 +1000 + +xprint (1:1.1.99.2+git20060627-0.3) experimental; urgency=low + + * Why doesn't dpkg -l damn well report versions correctly? + Build-Depends: libxfont-dev (>=1:1.1) not (>=1.1). + + -- Drew Parsons Tue, 27 Jun 2006 21:04:24 +1000 + +xprint (1:1.1.99.2+git20060627-0.2) experimental; urgency=low + + * Oops should add versioned build-depends on libxfont-dev too. + + -- Drew Parsons Tue, 27 Jun 2006 19:28:03 +1000 + +xprint (1:1.1.99.2+git20060627-0.1) experimental; urgency=low + + * Latest upstream git: Xprint subdirectory moved to hw. + Patches updated accordingly. + * Actually create the patch allowing build with new libxfont (freetype + 2.2) and avoiding a segfault (patch 80_check_windowpixmap). + * Versioned dependencies on x11proto-fixes-dev, libxfont1. Closes: #375125. + * Standards version 3.7.2. + + -- Drew Parsons Tue, 27 Jun 2006 13:31:08 +1000 + +xprint (1:1.1.99.2+git20060614-0.1) experimental; urgency=low + + * New upstream version (including lastest git). + * Russian debconf translation. СпаÑибо Юрию Козлову. Closes: #369834. + * Upload to experimental while we wait for dependencies (libxfont 1.1, + libxfixes 4) to reach unstable. + + -- Drew Parsons Thu, 22 Jun 2006 16:04:40 +1000 + +xprint (1:1.0.2-1) unstable; urgency=low + + * New upstream version (hey! slashdot is good for something after all! + (http://linux.slashdot.org/article.pl?sid=06/05/02/2216235) + * Only include the required ft.h, ftfuncs.h files in ./extras. + + -- Drew Parsons Thu, 4 May 2006 17:46:57 +1000 + +xprint (1:1.0.1-7) unstable; urgency=low + + * Build-Depends: libgl1-mesa-dev|libgl-dev. + + -- Drew Parsons Mon, 1 May 2006 22:58:28 +1000 + +xprint (1:1.0.1-6) unstable; urgency=low + + * I wonder if I should install pbuilder? + * Build-Depends: mesa-common-dev (only needed when compiling with + OpenGL support). Guess what, closes: #365386. + + -- Drew Parsons Mon, 1 May 2006 22:22:40 +1000 + +xprint (1:1.0.1-5) unstable; urgency=low + + * Build-Depends: pkg-config *sigh*. + + -- Drew Parsons Mon, 1 May 2006 17:55:46 +1000 + +xprint (1:1.0.1-4) unstable; urgency=low + + * Added Build-Depends: xutils-dev to get BUILD_LINUXDOC etc defined for + configure.ac. + * Looking more closely at "checking for XSERVERCFLAGS", need to add + Build-Depends: libxau-dev, libxdmcp-dev. + + -- Drew Parsons Mon, 1 May 2006 17:32:46 +1000 + +xprint (1:1.0.1-3) unstable; urgency=low + + * Build-Depends: libtool. Closes: #365386 (again). + + -- Drew Parsons Mon, 1 May 2006 09:31:33 +1000 + +xprint (1:1.0.1-2) unstable; urgency=low + + * Dutch debconf translation. Thanks Kurt De Bree. Closes: #363035. + * Restore dh_installdebconf in debian/rules to get debconf back again. + * Added xprint-common Depends: xfonts-encodings, since /etc/init.d.xprint + expects to be able to find encodings.dir. + * Since /etc/init.d/xprint no longer knows about /usr/X11R6/bin, let + xprint-common Depends on x11-common (>=1:7.0.12) to ensure Xprt is in + /usr/bin (even if it comes from an old package, where it would be + forced to use the /usr/X11R6/bin symlink). Closes: #363245. + * Make /etc/init.d/xprint exit quietly if the Xprt binary can't be found. + Closes: #270054. + * Added Build-Depends: automake1.9. Closes: #365386. + * Standards version 3.7.0. + * Restore xprint-common debconf files lost in X11R7 transition (where did + they disappear to?) + * Added lintian override to xprint-common to not trigger + "package-depends-on-an-x-font-package" on Depends: xfonts-encodings. + + -- Drew Parsons Mon, 1 May 2006 00:35:12 +1000 + +xprint (1:1.0.1-1) unstable; urgency=low + + * Xprint from X11R7! Closes: #360446, #356987, #362884. + * Xprt does not build in Xorg 7.0, hence need CVS (X11R7.1). However CVS + needs xfixes 4 which will not be available in Debian until the XSF + prepares 7.1. So backport patches (relating to build with FreeType + support). + * Please be advised that as a consequence of the above there will be a + degradation of output quality until Debian is able to upgrade to 7.1 + (due end of May). Please hold back from filing bug reports about font + quality until that upgrade has occurred. My apologies for the + inconvenience. + * Build-depends updated to follow modular X11R7. + * Xprint utilities removed (transferred to xprint-utils). + * Set debhelper compatibility version to 5. + * Updated xprint init file to expect encodings.dir in + /usr/share/fonts/X11/encodings. + + -- Drew Parsons Mon, 17 Apr 2006 14:03:06 +1000 + +xprint (1:0.1.0.alpha1-13) unstable; urgency=low + + * Got to actually install the overrides file for it to take effect, dammit. + * Swedish debconf translation. Thanks, Daniel Nylander. Closes: #330651. + * Patch 91_xsession_ifexec: only define XPSERVERLIST in + /etc/X11/Xsession.d/92xprint-xpserverlist if /etc/init.d/xprint is + present and executable. Some administrators may wish to disable xprint + by making the init script non-executable. Closes: #330812. + * Break a circular dependency by downgrading xprint-common's Depends: on + xprint to a Recommends:. Closes: #339928. + * Added a paragraph to README.printing-problems indicating that CUPS + settings may also need to be adjusted if the printer resolution is + mismatched. Closes: #342714. + + -- Drew Parsons Sun, 11 Dec 2005 21:10:52 +1100 + +xprint (1:0.1.0.alpha1-12) unstable; urgency=low + + * Patch 93_init_startstopdaemon has the side effect that some log messages + (errors and warnings) from Xprt are lost, including attempted connections. + Let me know if you want all such messages back again. + * Ditch the xprt and xprt-xprintorg dummy packages. Closes: #322078, #303123. + * Time to start stripping binaries. Closes: #164952. + * Vietnamese debconf translation. Thanks Clytie Siddall. Closes: #324267. + * Added xprint-overrides to ignore pesky lintian warnings. + * Removed 93_check_default_start, since the facility to control rc scripts + is provided elsewhere (see command update-rc.d, or packages rcconf, + sysv-rc-conf or file-rc). This means /etc/default/Xprint is no longer + used. Use the facilities mentioned above if you want Xprint installed + but not to start up by default. + However, it is true that the manner in which Debian handles packages is + only partially implemented. Packages start their daemons using + invoke-rc.d, whose operations may be controlled by /usr/sbin/policy-rc.d + it exists. But it does not exist. Therefore upon upgrade (or + dpkg-reconfigure), the Xprt daemon will be started, even if you have + correctly set the rc symlinks. You will need to stop it by hand + "/etc/init.d/xprint stop" (this only applies to upgrades, your rc + configuration will be honoured at boot). This is a general Debian + problem, for having daemons installed but not running. It is *not* an + Xprint problem. Sorry. See Bug#291766 for further discussion. + + -- Drew Parsons Sat, 10 Sep 2005 00:38:08 +1000 + +xprint (1:0.1.0.alpha1-11) unstable; urgency=low + + * Created patch 93_init_startstopdaemon to use start-stop-daemon to launch + and kill Xprt. It handles backgrounding of the Xprt process, so we + don't get rogue /etc/init.d/xprint processes running alongside Xprt. + Note during stop, we retain kill ${pid} to facilitate compatibility when + upgrading (otherwise the new init script won't have a + /var/run/Xprt_0.pid file to kill when upgrading from the old version). + Closes: #229252, #255240, #313315. + * Patch 94_man_typoes fixes spelling errors. Thanks A. Costa. + Fixed in *.sgml docbook files, propagated to man and html using + docbookconv.sh (also altered to adapt to Debian's current XSLT + structure, accounting for the fact that docbook2man cannot read the sgml + file at the moment). Note there are problems generating the derived doc + files using HasDocBookTools in config/cf/xprint_host.def, so html and + man are generated by hand and included in the patch. + Closes: #306701, #306702. + * New standards version: 3.6.2. + + -- Drew Parsons Sat, 2 Jul 2005 23:05:44 +1000 + +xprint (1:0.1.0.alpha1-10) unstable; urgency=high + + * Reduced the priority of the printer resolution debconf question to + "medium", since the default of 600 is fine for most printers today. + Closes: #298954. + * Reduced the amount of the text in the debconf question. + Closes: #298956, #298959. + * Added new binaries and man pages to xprint.install. + * New patch 92_lib_not_lib64_on_amd64ppc64: ppc64 and amb64 use + /usr/X11R6/lib not /usr/X11R6/lib64. Reported upstream, Xprint bug #2803. + Closes: #301028. + * New patch 91_no_ExecCommand: ExecCommand does not belong in + attributes.{c|h}, and gcc4 complains about it. See Debian bug #301028 and + upstream Xprint bug #2254. + * New patch 93_spooltodir_check_file_exists. Closes: #295139. + * 93_spooltodir_check_file_exists also checks size of file name is not too + long. Closes: #284620. + + -- Drew Parsons Fri, 25 Mar 2005 18:29:49 +1100 + +xprint (1:0.1.0.alpha1-9) unstable; urgency=medium + + * Taking over xprt, which has been expelled from XFree86. + * Take the opportunity the rationalise package naming: + - use "xprint" rather than "xprint-xprintorg". Since the Xprint + development version (known as xprint.xprintorg but hosted at + xprint.mozdev.org) has been accepted as the official X.org development + version, it is now unlikely that the separate domain xprint.org will be + registered. + - xprint contains Xprt and other architecture-dependent binaries + - xprint-common contains architecture-independent files (config files, + including /etc/init.d/xprint) + - xprt and xprt-xprintorg become dummy packages. Closes: #294324. + * Even without Super-Cow powers, this Xprint washes whiter than. + Closes: #275656. + * Add example of different resolutions for different printers to + README.printing-problems. Closes: #293539. + * In xprint-common.postinst, explicitly stop server before letting debhelper + (dh_installinit) start it. This avoids complaints in the situation where + Xprt was started by a simultaneous upgrade of the xprint package. + Closes: #292355. + * For simplicity of maintenance, removed debconf question about old + arrangement of config files. Since Xprint is not in woody, this will not + cause upgrade problems. + * Bump up the epoch to ensure a smooth upgrade of xprt (from + 4.3.0.dfsg.1-10). + + -- Drew Parsons Thu, 17 Feb 2005 21:02:18 +1100 + +xprint-xprintorg (0.1.0.alpha1-8) unstable; urgency=low + + * Updated debconf translations: + - Brazilian (thanks Andre Luis Lopes) + - German (thanks Erik Schanze) + - Czech (thanks Miroslav Kure) + + -- Drew Parsons Sun, 30 Jan 2005 13:16:30 +1100 + +xprint-xprintorg (0.1.0.alpha1-7) unstable; urgency=medium + + * Updated debconf translations: + - Danish, (thanks Morten Bo Johansen) + - Japanese (thanks Hideki Yamane) + - French (thanks Christian Perrier) + + Closes: #291425, #292363, #292459. + + -- Drew Parsons Thu, 27 Jan 2005 19:09:39 +1100 + +xprint-xprintorg (0.1.0.alpha1-6) unstable; urgency=medium + + * Added debconf question to set the default printer resolution. + Closes: #280159. + + -- Drew Parsons Wed, 19 Jan 2005 01:44:29 +1100 + +xprint-xprintorg (0.1.0.alpha1-5) unstable; urgency=high + + * Related to the dash problem again, just remove /bin/sh altogether from + 92xprint-xpserverlist; this should be simpler than changing it to + /bin/bash. Will close #288585 (but leave open pending upstream fix). + Closes: #288844. + + -- Drew Parsons Tue, 11 Jan 2005 19:59:08 +1100 + +xprint-xprintorg (0.1.0.alpha1-4) unstable; urgency=low + + * Force /etc/init.d/xprint to use bash, since there are conflicts with + dash when it is /bin/sh. Patch 91_enforce_bash. Closes: #288630. Also + closes #288585, but I will leave this open as a reminder to upstream to + fix the non-Posix code. + * On a related note, upstream simply no longer asks Linux systems to use ksh + at all, so 91_bash_before_ksh is deprecated. Hence, "test -a" is no + longer used. Closes: #285056, #256241. + * xset is still being used in /etc/init.d/xprint to build the fontlist, so + XPROJECTROOT (or /usr/X11R6/bin) still needs to be defined. + Closes: #282723. + * Removed square brackets around \n, used by tr in /etc/init.d/xprint. + Patch 93_init_tr_fix. Closes: #258419, #264983. + + -- Drew Parsons Wed, 5 Jan 2005 13:59:18 +1100 + +xprint-xprintorg (0.1.0.alpha1-3) unstable; urgency=medium + + * There have been enough positive reports about 1.0alpha1 in experimental + (contrasted with negative reports of the version in sarge), + that I think it is time to get it into unstable and sarge. + * I'll keep the "0.1.0" versioning for now. I'll almost certainly make the + final 1.0 version to be "1.0". + * Added Danish debconf translation. Thanks Morten Bo Johansen. + Closes: #285957. + + -- Drew Parsons Mon, 3 Jan 2005 14:43:04 +1100 + +xprint-xprintorg (0.1.0.alpha1-2) experimental; urgency=low + + * Build-Depends: flex, bison. Closes: #284920. + * amd64 support confirmed. Closes: #278510, #282655. + * I was joking about the cubes rotating on your paper. But the OpenGL + support is real. + + -- Drew Parsons Sun, 12 Dec 2004 00:29:23 +1100 + +xprint-xprintorg (0.1.0.alpha1-1) experimental; urgency=low + + * New upstream version: 1.0alpha1, preview of the forthcoming v1.0. + * Based on X.Org 6.8.2, with innumerable improvements: + - better handling of broken fonts + - OpenGL support (yes, rotating cubes on your printer paper) + - better greyscale support + - generally more stable + - supports amd64 + * Recommended by upstream to go into sarge. + + -- Drew Parsons Tue, 7 Dec 2004 17:47:27 +1100 + +xprint-xprintorg (0.0.9.final.001-9) unstable; urgency=medium + + * Added patch 92_close_std_files to get /etc/init.d/xprint to close the + standard file descriptors (stdin/out/err) when Xprt is invoked. This + solves a number of problems, such as hanging sessions of dpkg-reconfigure, + ssh, chroot. Thanks for the patch, Nicolas Boullis. + Closes: #233260, #265827, #234132. OK, #234132 also refers to the bash + shells, which are still there, but there are other bug reports dealing + with them. + + -- Drew Parsons Tue, 7 Dec 2004 10:03:30 +1100 + +xprint-xprintorg (0.0.9.final.001-8) unstable; urgency=medium + + * Added patch 93_check_default_start, which checks if START_XPRINT=0 in + /etc/default/xprint before starting Xprt. Thanks Anthony DeRobertis. + Closes: #281973. + * Created debian/default to be installed as /etc/default/xprint. + * Suggests: xbase-clients, since xset is used by /etc/init.d/xprint. + Closes: #282723. + + -- Drew Parsons Thu, 2 Dec 2004 19:00:42 +1100 + +xprint-xprintorg (0.0.9.final.001-7) unstable; urgency=medium + + * Added Czech translation for debconf templates. Thanks Miroslav Kure. + Closes: #274073. + * Added Eugeniy Meshcheryakov's patch (93_xprint_fonts_fix) to improve + TrueType font handling. Closes: #272368. + * Added new workaround to README.printing-problems for printing problem + with Debian home page: delete "font.name.serif.x-western" entry from + pref.js. + * Removed Recommends: xprt from xprt-common, since it Depends: on it. + + -- Drew Parsons Fri, 12 Nov 2004 14:37:23 +1100 + +xprint-xprintorg (0.0.9.final.001-6) unstable; urgency=high + + * Added another question to README.printing-problems to address the + problem when the image is printed too large or too small (default + printer resolution in /etc/Xprint/C/print/attributes/document + needs to be adjusted for your printer). Closes: #262958, #267964. + * Removed man page for xpxmhelloworld: binary is not provided. + + -- Drew Parsons Sun, 12 Sep 2004 22:31:15 +1000 + +xprint-xprintorg (0.0.9.final.001-5) unstable; urgency=high + + * README.printing-problems needs to be added to debian/xprt-common.docs. + + -- Drew Parsons Sun, 22 Aug 2004 14:12:13 +1000 + +xprint-xprintorg (0.0.9.final.001-4) unstable; urgency=high + + * Added README.printing-problems, describing the printing problem of + words being run together without spaces. The file suggests two + workarounds (remove Xprint's fonts directories, or add a + firefox/mozilla stylesheet). Thanks to Jan Willem Stumpel for the + CSS workaround and to Yaacov Akiba Slama for the fonts directory + workaround. + * Set urgency to high to get this workaround description into sarge. + + -- Drew Parsons Sun, 22 Aug 2004 12:30:57 +1000 + +xprint-xprintorg (0.0.9.final.001-3) unstable; urgency=low + + * Created patch (91_no_sh_suffix_in_Xsession.d) to not provide .sh + suffix to Xsession.d script. Closes: #264978. + * Added Erik Schanze's German debconf translation. Closes: #264611. + * Added a note to README.Debian concerning the "could not open + default font 'fixed'" problem preventing Xprt from starting, which + has been reported by some users. The bug has not yet been + reproduced on a system which does not already experience it, + making it difficult to fix it properly. A work-around ("sort -u -r" + instead of "sort -u" in /etc/init.d/xprint) is suggested. This + concerns bugs such as #259281, #257731, #259281. Apparently the + 009.001 release did not help. Maybe v010 will get it at last? + + -- Drew Parsons Sun, 15 Aug 2004 18:20:13 +1000 + +xprint-xprintorg (0.0.9.final.001-2) unstable; urgency=low + + * Added Brazilian Portuguese (pt_BR) debconf translation. + Thanks Andre Luis Lopes. Closes: #262554. + * Uses Dwayne C. Litzenberger's patch (92_xprint-security-holes-fix.patch) + to print to file into the user's $HOME directory instead of /tmp. + In subdirectory ../Xprintjobs. Security patch. Closes: #262871. + * xprt-xprintorg includes binaries and manpages for other auxiliary + programs: xprehashprinterlist, xpsimplehelloworld, xpxthelloworld. + The manpage for xpxmhelloworld is omitted since the binary is not built. + The general man page for Xprint is also included. + + -- Drew Parsons Sun, 8 Aug 2004 18:59:52 +1000 + +xprint-xprintorg (0.0.9.final.001-1) unstable; urgency=low + + * Upstream maintenance release v009.001. + - only use basic optimisation on PPC. Closes: #252362, #258844. + - default printer resolution in /usr/share/Xprint/xserver/C/print/attributes/document + is now 600dpi not 300dpi. Closes: #254704, #256175. + - should no longer hang when using CUPS. Closes: #256850. + - /etc/init.d/xprint now has a simpler copyright statement, without + "all rights reserved". Closes: #250887. + - incorporates lpr/CUPS patch (10-lpr-cups). + * Will hopefully deal with a number of TrueType-related font + problems (e.g. #259281, #257731, #259281). Bugs will be closed in + the next upload, pending positive reports from bug reporters. + * Treat /usr/share/Xprint/xserver/C/print/Xprinters as a config file + (place in /etc/). Closes: #258413. + * Patch applied to use bash in preference to ksh. Bug #256241 will + be closed once the '-a' posix issue is appropriately settled. + * Patch 92_lsprinter_path checks command is executable, and adds + test for /usr/bin/xplsprinters. Closes: #257750. + + -- Drew Parsons Mon, 19 Jul 2004 19:29:22 +1000 + +xprint-xprintorg (0.0.9.final-3) unstable; urgency=low + + * Applied patch (92_make_amd64) to enable building on AMD 64. + Closes: #254752. + * Added handling for DEB_BUILD_OPTIONS' noopt (i.e. -O0) in + debian/rules, using the code sample in Policy 10.1. turned on -g + by default (the debug keyword is deprecated, it should always be + on). See bug #252659 (but I think it's not yet passed to Xprint's + imake system). + + -- Drew Parsons Fri, 18 Jun 2004 19:13:09 +1000 + +xprint-xprintorg (0.0.9.final-2) unstable; urgency=low + + * Applied upstream patch to fix some lpr/CUPS problems + (see http://pdx.freedesktop.org/cgi-bin/bugzilla/show_bug.cgi?id=608) + - BugZilla #608 ("Can not print on Debian/CUPS due to error |Xprt_64: + lpr: unable to print file: server-error-not-accepting-jobs|"): + Xprt did setup the list of supplementary group ids, causing print + failure when the the calling user must be a member in a specific + group to be allowed to print. + (patch placed in debian/patches/10-lpr-cups) + + -- Drew Parsons Sun, 9 May 2004 17:41:54 +1000 + +xprint-xprintorg (0.0.9.final-1) unstable; urgency=low + + * v0.9 official release (cvs20040322, released 28 March 2004). + * Rearranged debian/rules to build binary-indep and binary-arch + separately. Closes: #241066. + + -- Drew Parsons Fri, 2 Apr 2004 20:45:33 +1000 + +xprint-xprintorg (0.0.9.cvs20040301-1) unstable; urgency=low + + * New upstream version: v009 release candidate 2. + * Partially addresses the complaints about extra processes alongside the + Xprt daemon: tee no longer invoked for logging. Closes: #224189. + * Users finally convinced me there's no point only having xprt-common + Recommends: xprt-xprintorg. xprt-common is not required for client-only + setups (they only need XPSERVERLIST to be defined, which can be done + without /etc/init.d/xprint. Remember to switch off "-nolisten tcp" in the + Xprt server configuration if you want to do this). So having xprt-common + installed without xprt-xprintorg is not in fact particularly useful, + unless you really want the config files stored on a different host to the + Xprt server, which seems somehow pointless. + So, xprt-common now Depends: xprt-xprintorg ( | xprt). + Closes: #195070, #211002, #238559. + * xprt-common only contains config files, so it should really be + Architecture: all. Why wasn't this noticed before? + + -- Drew Parsons Sat, 20 Mar 2004 17:06:20 +1100 + +xprint-xprintorg (0.0.9.cvs20040216-2) unstable; urgency=low + + * Updated the Japanese debconf translation. Closes: #234254. + * Replaced Build-Depends: xlibs-dev in favour of the new separated + X libraries. + + -- Drew Parsons Wed, 25 Feb 2004 19:54:26 +1100 + +xprint-xprintorg (0.0.9.cvs20040216-1) unstable; urgency=low + + * New upstream version: v009 release candidate 1. + + -- Drew Parsons Sat, 21 Feb 2004 12:02:12 +1100 + +xprint-xprintorg (0.0.9.cvs20040114-3) unstable; urgency=low + + * The "Now He Tells Me" release. + * Build-depends: xutils. This provides mkfontdir, whose absence was the + real cause of the bug I tried to fix in -2. + + -- Drew Parsons Thu, 15 Jan 2004 17:18:09 +1030 + +xprint-xprintorg (0.0.9.cvs20040114-2) unstable; urgency=low + + * Build-depends: lesstif2-dev. In order to compile xpxmhelloworld and allow + the build to proceed. Not that I package xpxmhelloworld, ho-hum. + + -- Drew Parsons Thu, 15 Jan 2004 10:43:56 +1030 + +xprint-xprintorg (0.0.9.cvs20040114-1) unstable; urgency=low + + * New upstream version (0.0.9 gamma) + - fixes handling of missing xft servers (closes: #224952,#226642,#226703). + * Added Japanese template translation. Thanks Hideki Yamane! + Closes: #224180. + + -- Drew Parsons Wed, 14 Jan 2004 17:56:59 +1030 + +xprint-xprintorg (0.0.9.cvs20031220-1) unstable; urgency=low + + * New upstream version (0.0.9 beta). + - new improved font download engine. + - supports OpenType fonts. Closes: #211798, #216813. + - XFree86 config file is used to extract font paths (as well as standard + paths and the defoma directory). + - supports PDF output (find it in /tmp/Xprintjobs). + - improved CUPS support. cupsys-bsd is no longer mandatory (but still + works fine). Closes: #206657. + - uses lockfiles for Xprint servers started via /etc/init.d/xprint. + Closes: #198745. + * xprt-common Recommends: xfonts-base, in order to find encodings.dir. + It is not a strict dependency since the location of the file can be set + as a configuration option in /etc/init.d/xprint. Closes: #217524. + * xprt-xprintorg Provides: xprt. Strictly speaking this is only valid if + we create a virtual package called xprt, but what the hell. + "Future proofing"... ;) Closes: #206655. + + -- Drew Parsons Fri, 5 Dec 2003 23:08:13 +1100 + +xprint-xprintorg (0.0.8.cvs20030508-6) unstable; urgency=low + + * Added defoma directory to font directory in /etc/init.d/xprint. + Closes: #206557. + * Applied upstream patch to improve printer spool (CUPS) handling. + * New standards version 3.6.1. + + -- Drew Parsons Fri, 26 Sep 2003 09:33:31 +1000 + +xprint-xprintorg (0.0.8.cvs20030508-5) unstable; urgency=low + + * Something went awry with the changes in -4, so try again: + - French debconf translation. Closes: #199347. + + -- Drew Parsons Wed, 30 Jul 2003 20:25:03 +1000 + +xprint-xprintorg (0.0.8.cvs20030508-4) unstable; urgency=low + + * Updated upstream patch for /etc/init.d/xprint regarding LSB. + * French debconf translation provided by Christian Perrier. Closes: #199347. + + -- Drew Parsons Mon, 30 Jun 2003 18:49:09 +1000 + +xprint-xprintorg (0.0.8.cvs20030508-3) unstable; urgency=low + + * Applied upstream patch to make /etc/init.d/xprint compliant with LSB. + * Updated debconf template to new po format using debconf-gettextize. + Added Build-Depends: debhelper (>= 4.1.16). Tidied up some spaces and + formatting in template and Description in control. Closes: #198287. + + -- Drew Parsons Sun, 22 Jun 2003 00:45:13 +1000 + +xprint-xprintorg (0.0.8.cvs20030508-2) unstable; urgency=low + + * Identify that Xprt is the server in question during stop/start + messages from /etc/init.d/xprint. Closes: #194694, #196487. + + -- Drew Parsons Sat, 14 Jun 2003 13:37:50 +1000 + +xprint-xprintorg (0.0.8.cvs20030508-1) unstable; urgency=low + + * Final 0.0.8 release. + No significant changes from previous release candidate (mainly fixes for + Solaris). + * Description identifies that TrueType fonts are now supported in 0.0.8. + Closes: #190736. + * New standards version: 3.5.10. + + -- Drew Parsons Sun, 25 May 2003 12:47:06 +1000 + +xprint-xprintorg (0.0.8.cvs20030416-1) unstable; urgency=low + + * New upstream version: v0.0.8 release candidate #2. + * I forgot to mention last time, man pages were recompiled with docbook2man, + gives better results than docbook-to-man. + + -- Drew Parsons Wed, 23 Apr 2003 13:12:31 +1000 + +xprint-xprintorg (0.0.8.cvs20030403-1) unstable; urgency=low + + * New upstream version. + + -- Drew Parsons Sat, 12 Apr 2003 23:49:35 +1000 + +xprint-xprintorg (0.0.8.cvs20030328-2) unstable; urgency=low + + * Added libxaw7-dev to Build-Depends in debian/control. + Closes: #186782, #186785. + + -- Drew Parsons Sun, 30 Mar 2003 09:56:21 +1000 + +xprint-xprintorg (0.0.8.cvs20030328-1) unstable; urgency=low + + * Upstream CVS. "Beta" version for release 0.0.8. + * Upstream changes include: + - Xsession.d script defines XPSERVERLIST for all X sessions, + removing the need to set it in profile files. + Closes: #171174, #177104. + - "-nolisten tcp" is now implemented, allowing for improved network + security when using Xprt. + Note that you may need to reset XPSERVERLIST (possibly by restarting X), + since this improvement requires the Xprt "display" to be given as ":64" + rather than "localhost:64". + Closes: #162023. + - the use of TrueType fonts is now supported. + - man pages are now available for the Xprt and other support binaries. + - size of source tarball now reduced to about 10 MB. + * The Xprint FAQ is always updated fresh from each new upstream tarball. + Closes: #170903. + * The upstream source tarball is now handled using dbs, one of Debian's patch + handling tools. This should facilitate the incorporation of one-off + patches in the future, such as the "-nolisten tcp" patch. + I decided in this context to use the pristine upstream tarball without + modification, rather than removing the www directory from it. The size + of www is not significant. + * Identify use of debhelper v4 via debian/compat. + * Standards version 3.5.9. + + -- Drew Parsons Sat, 29 Mar 2003 02:53:12 +1100 + +xprint-xprintorg (0.0.7.cvs20021203-1) unstable; urgency=low + + * New upstream version (final release for v007). + + -- Drew Parsons Mon, 9 Dec 2002 18:13:38 +1100 + +xprint-xprintorg (0.0.7.cvs20021125-1) unstable; urgency=low + + * New upstream version (final release candidate for v007). + * Standards version 3.5.8. + * Upstream tarball created by make_xprint_tarball (invoked in + debian/rules) for Debian systems now recognises it is building for + Debian and places config files in /usr/share/Xprint, not + /usr/X11R6/lib/X11. debian/xprt-common.install changed accordingly. + * Added link from usr/share/Xprint/xserver/README to + usr/share/doc/xprt-common/README in debian/xprt-common.links. + * xserver/SecurityPolicy no longer exists, remove from + debian/xprt-common.links and debian/rules. + * Added attributes directory for en_US to config files in /etc/Xprint + (allows default paper for en_US to be letter, for everyone else A4). + Altered directory structure in /etc/Xprint to accomodate both C and en_US + locales. Changes made in rules, xprt-common.dirs, xprt-common.links. + Debconf invoked to remove old config files, if user permits it. + * Removed xprt-common.conffiles, since dh_installdeb (v3 and higher) + automatically lists everything in /etc as a conffile. + + -- Drew Parsons Mon, 2 Dec 2002 18:11:04 +1100 + +xprint-xprintorg (0.0.7.cvs20021101-1) unstable; urgency=low + + * New upstream version. + * Debian patches incorporated upstream (thanks Roland!). + * /etc/init.d/xprint now provided in upstream source. + Note that upstream has set the Xprint "display" to :64, not :12. + You may have to refresh shell variable XPSERVERLIST by restarting client + programs such as mozilla or by relogging in again. + * Binary stripping switched off (dh_strip commented out in debian/rules) + by upstream's request, see Debian bug #164952. Only temporary. + + -- Drew Parsons Tue, 5 Nov 2002 08:20:15 +1100 + +xprint-xprintorg (0.0.7.cvs20021004-1) unstable; urgency=low + + * New upstream version. + * Should facilitate build on sparc and mips. + + -- Drew Parsons Tue, 8 Oct 2002 15:24:44 +1000 + +xprint-xprintorg (0.0.7.cvs20020903-3) unstable; urgency=low + + * Change reference in README.Debian from /etc/environment to /etc/profile + for setting variable XPSERVERLIST. + + -- Drew Parsons Mon, 23 Sep 2002 22:38:35 +1000 + +xprint-xprintorg (0.0.7.cvs20020903-2) unstable; urgency=low + + * Moved check for Xprt binary to point where it is invoked in + debian/xprt-common.xprint (i.e. /etc/init.d/xprint). + Depends: on xprt[-xprintorg] should not be required, /etc/init.d/xprint may + complain, but this ought not to affect installation. + Closes: #161824. + + -- Drew Parsons Sun, 22 Sep 2002 11:09:43 +1000 + +xprint-xprintorg (0.0.7.cvs20020903-1) unstable; urgency=low + + * New package. Closes: #149658. + * 0.0.7 release branch from CVS tarball, 3 September 2002. + * Includes modified /etc/init.d/xprint script (v0.2) from + http://mozdev.org/bugs/show_bug.cgi?id=2037 + * Standards Version 3.5.7. + + -- Drew Parsons Sun, 15 Sep 2002 12:33:27 +1000 + --- xorg-server-1.4.2.orig/debian/xserver-xephyr.docs +++ xorg-server-1.4.2/debian/xserver-xephyr.docs @@ -0,0 +1 @@ +hw/kdrive/ephyr/README --- xorg-server-1.4.2.orig/debian/xprint-common.default +++ xorg-server-1.4.2/debian/xprint-common.default @@ -0,0 +1,10 @@ +# If you do not want Xprint to automatically start, then set START_XPRINT=0 +# By default, START_XPRINT=1, enabling Xprt, the Xprint server, to be started. + +# Note that this can be more effectively done by removing the start-up symlinks +# to /etc/init.d/xprint, e.g. +# rm /etc/rc[1-6].d/*xprint* + +# If you always want Xprint to run, you may safely remove this file. + +START_XPRINT=1 --- xorg-server-1.4.2.orig/debian/serverminver +++ xorg-server-1.4.2/debian/serverminver @@ -0,0 +1 @@ +2:1.4 --- xorg-server-1.4.2.orig/debian/xprint-common.docs +++ xorg-server-1.4.2/debian/xprint-common.docs @@ -0,0 +1,2 @@ +debian/xprint.changelog.Debian +debian/README.printing-problems --- xorg-server-1.4.2.orig/debian/xserver-xorg-core.NEWS +++ xorg-server-1.4.2/debian/xserver-xorg-core.NEWS @@ -0,0 +1,62 @@ +xorg-server (2:1.3.0.0.dfsg-3) unstable; urgency=low + + * The server now includes a patch to always include the font paths + defined at compile-time by default. This will help prevent errors with + finding fonts when a xorg.conf has alternate font paths specified. + + As a result of this, many of the font paths shipped in our default + xorg.conf are obsolete, and may be deleted. If you have no customized + your xorg.conf, a future update to the xserver-xorg package will + re-create the file from your stored preferences. + + If for some reason you do not want the server to look in the default + font paths, you can set the boolean variable "UseDefaultFontPath" to + "False" in the ServerFlags section of your xorg.conf. + + -- David Nusinow Tue, 24 Apr 2007 00:18:04 -0400 + +xorg-server (2:1.2.99.905-3) experimental; urgency=low + + * This server update includes a patch to enable proper module defaults in + the server. A default set of modules will be loaded unless you + specifically specify that they don't load. You may do this in the module + section of your xorg.conf using the "Disable" instruction. Note that + this will only override the default, not an explicit "Load". + + This change will not affect most users, however if you have a customized + xorg.conf in which you comment out "Load" lines to disable modules, you + will want to change those lines so that they are uncommented and say + "Disable" instead of "Load". The most notable example of this is the dri + module, which is now loaded by default. Those who experience crashes + when dri is enabled will want to make this change to ensure that their + system does not begin to crash again. + + -- David Nusinow Sat, 14 Apr 2007 12:41:37 -0400 + +xserver-xorg-core (1:1.0.2-5) unstable; urgency=low + + * Several users have reported an error on load like the following: + + "(EE) Failed to load module "GLcore" (loader failed, 7)" + + To resolve this error and the related ones in the logfile above it, + remove the line to load the glcore module in your /etc/X11/xorg.conf. + Other similar errors about module loading can be resolved the same way. + If you have not customized your config file by hand, you can run the + command "dpkg-reconfigure xserver-xorg" as root to do this for you. + + -- David Nusinow Wed, 12 Apr 2006 19:38:51 -0400 + +xserver-xorg-core (1:1.0.2-3) unstable; urgency=low + + * With the latest updates of Xorg, we have transitioned from X11R6 to + X11R7. Part of this transition involves changing the paths to the + xfonts and the xkb data files, as well as the modules loaded by the X + server. One way to automatically update the paths is to run + "dpkg-reconfigure xserver-xorg" as root and it will automatically + generate a new config file for you. Note that this will currently not + work for people who have customized config files due to a bug, so + you'll have to manually edit your config if you have customized it + previously. + + -- David Nusinow Wed, 12 Apr 2006 19:38:51 -0400 --- xorg-server-1.4.2.orig/debian/xprint-common.dirs +++ xorg-server-1.4.2/debian/xprint-common.dirs @@ -0,0 +1,4 @@ +etc/Xprint/C/print +etc/Xprint/en_US/print +etc/default +usr/share/lintian/overrides --- xorg-server-1.4.2.orig/debian/xserver-xorg-core.bug.script +++ xorg-server-1.4.2/debian/xserver-xorg-core.bug.script @@ -0,0 +1,122 @@ +#!/bin/sh + +# $Id$ + +PATH="/sbin:$PATH" +CONFIG_DIR=/etc/X11 +SERVER_SYMLINK="$CONFIG_DIR/X" +XORGCONFIG="$CONFIG_DIR/xorg.conf" +CONFIG_AUX_DIR=/var/lib/x11 +SERVER_SYMLINK_CHECKSUM="$CONFIG_AUX_DIR/${SERVER_SYMLINK##*/}.md5sum" +SERVER_SYMLINK_ROSTER="$CONFIG_AUX_DIR/${SERVER_SYMLINK##*/}.roster" +XORGCONFIG_CHECKSUM="$CONFIG_AUX_DIR/${XORGCONFIG##*/}.md5sum" +XORGCONFIG_ROSTER="$CONFIG_AUX_DIR/${XORGCONFIG##*/}.roster" + +exec >&3 + +if [ -e "$SERVER_SYMLINK_ROSTER" ]; then + printf "Contents of $SERVER_SYMLINK_ROSTER:\n" + cat "$SERVER_SYMLINK_ROSTER" +else + printf "$SERVER_SYMLINK_ROSTER does not exist.\n" +fi + +printf "\n" + +if [ -e "$SERVER_SYMLINK" ]; then + if [ -e "$SERVER_SYMLINK_CHECKSUM" ]; then + if [ "$(readlink "$SERVER_SYMLINK" | md5sum)" = \ + "$(cat "$SERVER_SYMLINK_CHECKSUM")" ]; then + printf "%s target unchanged from checksum in %s.\n" \ + "$SERVER_SYMLINK" "$SERVER_SYMLINK_CHECKSUM" + else + printf "%s target does not match checksum in %s.\n" \ + "$SERVER_SYMLINK" "$SERVER_SYMLINK_CHECKSUM" + fi + else + printf "$SERVER_SYMLINK_CHECKSUM does not exist.\n" + fi + printf "\n" + printf "X server symlink status:\n" + ls -dl "$SERVER_SYMLINK" + ls -dl "$(readlink "$SERVER_SYMLINK")" +else + printf "$SERVER_SYMLINK does not exist.\n" +fi + +if ! [ -L "$SERVER_SYMLINK" ]; then + printf "$SERVER_SYMLINK is not a symlink.\n" +fi + +if ! [ -x "$SERVER_SYMLINK" ]; then + printf "$SERVER_SYMLINK is not executable.\n" +fi + +printf "\n" + +if [ -e "$XORGCONFIG_ROSTER" ]; then + printf "Contents of $XORGCONFIG_ROSTER:\n" + cat "$XORGCONFIG_ROSTER" +else + printf "$XORGCONFIG_ROSTER does not exist.\n" +fi + +printf "\n" + +if which lspci > /dev/null 2>&1; then + printf "VGA-compatible devices on PCI bus:\n" + LC_ALL=C lspci | grep 'VGA compatible controller:' + LC_ALL=C lspci -n | grep 'Class 0300:' +else + printf "The lspci command was not found; not including PCI data.\n" +fi + +printf "\n" + +if [ -e "$XORGCONFIG" ]; then + if [ -e "$XORGCONFIG_CHECKSUM" ]; then + if [ "$(md5sum "$XORGCONFIG")" = "$(cat "$XORGCONFIG_CHECKSUM")" ]; then + printf "%s unchanged from checksum in %s.\n" "$XORGCONFIG" \ + "$XORGCONFIG_CHECKSUM" + else + printf "%s does not match checksum in %s.\n" "$XORGCONFIG" \ + "$XORGCONFIG_CHECKSUM" + fi + else + printf "$XORGCONFIG_CHECKSUM does not exist.\n" + fi + printf "\n" + printf "Xorg X server configuration file status:\n" + ls -dl "$XORGCONFIG" + printf "\n" + printf "Contents of $XORGCONFIG:\n" + iconv -c -t ascii "$XORGCONFIG" + printf "\n" +else + printf "$XORGCONFIG does not exist.\n" +fi + +printf "\n" + +XORG_LOGS=$(ls -dt /var/log/Xorg.*.log 2>/dev/null) + +if [ -n "$XORG_LOGS" ]; then + printf "Xorg X server log files on system:\n" + ls -dlrt /var/log/Xorg.*.log 2>/dev/null + printf "\n" + for LOG in $XORG_LOGS; do + if [ -f "$LOG" ]; then + printf "Contents of most recent Xorg X server log file\n" + printf "%s:\n" "$LOG" + cat "$LOG" + # the log files are large; only show the most recent + break + fi + done +else + printf "No Xorg X server log files found.\n" +fi + +printf "\n" + +# vim:set ai et sts=4 sw=4 tw=0: --- xorg-server-1.4.2.orig/debian/xprint-common-overrides +++ xorg-server-1.4.2/debian/xprint-common-overrides @@ -0,0 +1,2 @@ +# xfonts-encodings is not a font package +xprint-common binary: package-depends-on-an-x-font-package depends: xfonts-encodings --- xorg-server-1.4.2.orig/debian/xprint-common.links +++ xorg-server-1.4.2/debian/xprint-common.links @@ -0,0 +1,5 @@ +etc/Xprint/C/print/attributes usr/share/Xprint/xserver/C/print/attributes +etc/Xprint/C/print/Xprinters usr/share/Xprint/xserver/C/print/Xprinters +etc/Xprint/C/print/ddx-config usr/share/Xprint/xserver/C/print/ddx-config +etc/Xprint/en_US/print/attributes usr/share/Xprint/xserver/en_US/print/attributes +usr/share/Xprint/xserver/README usr/share/doc/xprint-common/README --- xorg-server-1.4.2.orig/debian/xdmx-tools.install +++ xorg-server-1.4.2/debian/xdmx-tools.install @@ -0,0 +1,7 @@ +usr/bin/dmx* +usr/bin/vdltodmx +usr/bin/xdmx +usr/bin/xdmxconfig +usr/share/man/man1/vdltodmx.1 +usr/share/man/man1/dmxtodmx.1 +usr/share/man/man1/xdmxconfig.1 --- xorg-server-1.4.2.orig/debian/xserver-xorg-dev.install +++ xorg-server-1.4.2/debian/xserver-xorg-dev.install @@ -0,0 +1,3 @@ +usr/include/xorg/* +usr/lib/pkgconfig/xorg-server.pc +usr/share/aclocal/* --- xorg-server-1.4.2.orig/debian/xprint-common.templates +++ xorg-server-1.4.2/debian/xprint-common.templates @@ -0,0 +1,21 @@ +# These templates have been reviewed by the debian-l10n-english +# team +# +# If modifications/additions/rewording are needed, please ask +# debian-l10n-english@lists.debian.org for advice. +# +# Even minor modifications require translation updates and such +# changes should be coordinated with translators and reviewers. + +Template: xprint-common/default_printer_resolution +Type: string +Default: 600 +_Description: Default printer resolution: + By default, Xprint assumes a printer resolution of 600 dpi. This should be + well suited for the majority of printers. + . + On certain 1200 dpi printers, however, the image might appear squashed in the + corner of the page, or it might be blown up too large on 300 dpi printers. If + you are experiencing such printing problems, you may want to set + the default printer resolution to a more appropriate value. See + /usr/share/doc/xprint-common/README.printing-problems.gz for more details. --- xorg-server-1.4.2.orig/debian/xprint.manpages +++ xorg-server-1.4.2/debian/xprint.manpages @@ -0,0 +1 @@ +debian/tmp/usr/share/man/man1/Xprt* --- xorg-server-1.4.2.orig/debian/xvfb.install +++ xorg-server-1.4.2/debian/xvfb.install @@ -0,0 +1,4 @@ +usr/bin/Xvfb +usr/bin/xvfb-run +usr/share/man/man1/xvfb-run.1 +usr/share/man/man1/Xvfb.1 --- xorg-server-1.4.2.orig/debian/xnest.install +++ xorg-server-1.4.2/debian/xnest.install @@ -0,0 +1,2 @@ +usr/bin/Xnest +usr/share/man/man1/Xnest.1 --- xorg-server-1.4.2.orig/debian/xprint.dirs +++ xorg-server-1.4.2/debian/xprint.dirs @@ -0,0 +1,3 @@ +usr/share/doc +usr/bin +usr/share/lintian/overrides --- xorg-server-1.4.2.orig/debian/changelog +++ xorg-server-1.4.2/debian/changelog @@ -0,0 +1,1481 @@ +xorg-server (2:1.4.2-10) unstable; urgency=medium + + * Cherry-pick from upstream: GLcore: make googleearth not crash the server + on sw-rendering (closes: #495483). + + -- Julien Cristau Fri, 09 Jan 2009 02:26:06 +0100 + +xorg-server (2:1.4.2-9) unstable; urgency=low + + * Cherry-pick patches from upstream to make xf86ScaleAxis() work correctly. + * Steal patch from Fedora: more sanity checks to stop vmmouse from + segfaulting the server (closes: #503459). + + -- Julien Cristau Thu, 13 Nov 2008 23:32:47 +0100 + +xorg-server (2:1.4.2-8) unstable; urgency=low + + * Add patch from Petr Salinger to fix PCI domain support on kfreebsd + (closes: #499501). + * xfree86: xf86SetDepthBpp needs to respect the driver's depth24flags. + Instead of forcing a 32bpp framebuffer, we pick a value that the driver + actually supports (closes: #504819, #486925); cherry-picked from upstream + git. + + -- Julien Cristau Tue, 11 Nov 2008 20:46:52 +0100 + +xorg-server (2:1.4.2-7) unstable; urgency=low + + * Update debian/copyright to the SGI Free Software License B, version 2.0. + It now mirrors the free X11 license used by X.Org. + http://www.sgi.com/company_info/newsroom/press_releases/2008/september/opengl.html + * Not closing bug#211765 for now, because GL/glx/glxext.c and + hw/dmx/glxProxy/glxext.c are covered by the GLX Public License, which is + still not free. SGI has since released their code under FreeB, but that + doesn't necessarily apply to contributions from other people. Hopefully + this can be cleared up soon, though. + * xvfb-run: append to $ERRORFILE instead of truncating it, so the error + output from Xvfb is not deleted when we run 'xauth remove'. + + -- Julien Cristau Tue, 30 Sep 2008 00:39:58 +0200 + +xorg-server (2:1.4.2-6) unstable; urgency=low + + * Xevie: always set rep.length to 0 (closes: #497337). Thanks, Thorvald + Natvig! + * Xevie: swap replies if necessary, to not confuse clients with a different + endianness. + * Cherry-picked from upstream git: + XF86VidMode: Correct a NULL pointer dereference (closes: #498289) + + -- Julien Cristau Mon, 15 Sep 2008 01:21:13 +0200 + +xorg-server (2:1.4.2-5) unstable; urgency=low + + * Don't pretend we support randr 1.2 when queried by swapped clients. The + dispatch code for RandR 1.2 requests would return BadImplementation anyway + (closes: #495833). + * Cherry-picked from upstream: + + exa: fix assert logic thinko. + + -- Julien Cristau Tue, 26 Aug 2008 19:27:34 +0200 + +xorg-server (2:1.4.2-4) unstable; urgency=low + + * Re-enable patch 47_fbdevhw_magic_numbers.diff, fixes xen framebuffer + (closes: #493901). Thanks, Olivier Tétard! If someone knows why I + disabled it a year ago, I'd love to know. + + -- Julien Cristau Fri, 15 Aug 2008 19:15:54 +0200 + +xorg-server (2:1.4.2-3) unstable; urgency=low + + * Add Romanian debconf translation (closes: #489069). Thanks, Eddy + PetriÈ™or! + * Update Dutch debconf translation (closes: #491663). Thanks, Thijs + Kinkhorst! + * Pull from server-1.4-branch: + - Xi: ChangeDeviceControl presence events should set the appropriate + devchange + - Fix potential crasher in xf86CrtcRotate() + * Cherry-picked from 1.5: + - Work around the DIX losing mmWidth/mmHeight for RandR 1.1 DDXen + (closes: #491526). + + -- Julien Cristau Sat, 02 Aug 2008 23:22:32 +0200 + +xorg-server (2:1.4.2-2) unstable; urgency=low + + [ Julien Cristau ] + * GLX: zero the buffer used in __glXDisp_GetVisualConfigs (backport from + upstream). + + [ Brice Goglin ] + * Cherry-pick various patches from upstream: + - Fix incorrect test regarding keyboard map. + - xfree86: append, not prepend, new input devices to xf86InputDevs. + + -- Julien Cristau Fri, 18 Jul 2008 10:53:26 +0200 + +xorg-server (2:1.4.2-1) unstable; urgency=low + + [ Julien Cristau ] + * New upstream release. + * Security fixes from the previous upload are included upstream. + * Cherry-pick patches from upstream git to make the LeftOf and Above options + in xorg.conf actually work (closes: #466526). + * 48_xaa_nooffscreenpixmaps.diff: disable XAA offscreen pixmaps by default; + they can be enabled with Option "XaaOffscreenPixmaps" (closes: #478277, + #433331). + * Cherry-pick various patches from upstream for Xorg's modes code: + - add quirks for monitors with broken EDID (closes: #473260) + - fix max clock computation + - inherit the preferred mode from the global configuration (so if you have + Modes "800x600" in the Display subsection the server will honor it + instead of ignoring it) + * Backport patch from upstream git to fix emulation of int1A PCI BIOS + services (closes: #404885). Thanks, Robert de Bath! + + [ Brice Goglin ] + * Update patches to not require -p0, closes: #485185. + + -- Julien Cristau Thu, 26 Jun 2008 01:57:18 +0200 + +xorg-server (2:1.4.1~git20080517-2) unstable; urgency=high + + * High urgency upload for security fixes. + * New patch from upstream to fix multiple security issues reported by + iDefense: + CVE-2008-2360 - RENDER Extension heap buffer overflow + CVE-2008-2361 - RENDER Extension crash + CVE-2008-2362 - RENDER Extension memory corruption + CVE-2008-1379 - MIT-SHM arbitrary memory read + CVE-2008-1377 - RECORD and Security extensions memory corruption + + -- Julien Cristau Mon, 09 Jun 2008 14:59:04 +0200 + +xorg-server (2:1.4.1~git20080517-1) unstable; urgency=low + + [ Julien Cristau ] + * Pass -DPRE_RELEASE=0 in CPPFLAGS, so we don't print the pre-release + warning in the Xorg log. + * Pull from upstream server-1.4-branch + + drop patch 40_default_dpi_96.patch applied upstream + + refresh patches 03_auto_load_driver.diff and + 04_auto_load_driver_no_conf.diff + * Don't build-depend on packages with a -1 debian revision. + * Drop the XS- prefix from Vcs-* control fields. + * Add x11-common to the Depends field of xnest, xvfb and xserver-xephyr (its + init script sets up the /tmp/.X11-unix directory). + * Re-enable the dmx DDX, and build the xdmx and xdmx-tools packages (the + build is now fixed upstream); closes: #449254. + + [ Drew Parsons ] + * Patch 95_xprint_disable_dbus disables dbus in Xprint by providing + dummy config functions. Taken from upstream commit + 2a3d1421e0cc18822ae8f478fcc272e16a9e9340, with removal of + CONFIG_LIB from configure.ac shifted to 94_xprint_XSERVER_LIBS. + Closes: #472180. + * Enable the xprint DDX, and build the xprint and xprint-common packages. + + -- Julien Cristau Sun, 18 May 2008 13:36:11 +0200 + +xorg-server (2:1.4.1~git20080507-1) unstable; urgency=low + + * Pull from upstream server-1.4-branch, highlights: + - the server should now scale input events correctly + - xkb keymap failures now give an explanation instead of just a 'failed to + load' message + * Drop patch 51_xkb-and-loathing.diff, applied upstream + * Refresh patches 13_debian_add_xkbpath_env_variable.diff, + 21_glx_align_fixes.patch, 46_reduce_wakeups_from_smart_scheduler.patch and + 94_xprint_XSERVER_LIBS. + * chmod +x configure in debian/rules clean so we can build a git snapshot + where configure is not in the tarball. + * Cherry-pick fix from upstream's master branch to re-arm the DPMS timer + when re-enabling DPMS (closes: #397197). + + -- Julien Cristau Thu, 08 May 2008 15:34:38 +0200 + +xorg-server (2:1.4.1~git20080131-4) unstable; urgency=low + + * fix AlwaysCore handling: enabling AlwaysCore in xorg.conf 1) is the + default, and 2) shouldn't prevent the device from sending core events + (closes: #461760). + + -- Julien Cristau Tue, 29 Apr 2008 20:14:22 +0200 + +xorg-server (2:1.4.1~git20080131-3) unstable; urgency=low + + * XKB: Fix processInputProc wrapping (cherry-picked from upstream). + Thanks to Thomas Jaeger. This should fix the bug with some keys getting + stuck (closes: #473165). + * xkb: when copying the keymap, make sure the structs default to 0/NULL + (cherry-picked from upstream). Fixes a crash and closes: #461783. + * __glXDRIbindTexImage: Fail if no texture bound to pixmap's texture target + (cherry-picked from upstream). + * EXA: Fix off-by-one in polyline drawing (cherry-picked from upstream). + * EXA: Skip empty glyphs (cherry-picked from upstream). + * Fix overly-restrictive integer overflow check in EXA pixmap creation + (cherry-picked from upstream). Fixes BadAlloc errors returned by + XCreatePixmap for pixmaps of width 8192 or greater (closes: #471782). + + Following patches by Bart Trojanowski, stolen from the ubuntu package: + * 15_X86EMU-added-blacklist-for-I-O-port-in-0-0xFF-range.patch + - Restrict access to I/O ports in range 0-0xFF from x86emu. + * 16_X86EMU-pass-the-correct-bus-dev-fn-tag-to-pci-emula.patch + - Fix improper emulation of PCI access General Software BIOS. + * Add 17_x86emu_handle_cpuid.patch to fix X86EMU CPUID handling. + (closes: #451089). + + -- Julien Cristau Wed, 02 Apr 2008 00:20:15 +0200 + +xorg-server (2:1.4.1~git20080131-2) unstable; urgency=low + + [ Brice Goglin ] + * Add 46_reduce_wakeups_from_smart_scheduler.patch to reduce + power consumption, closes: #462700. + + [ Drew Parsons ] + * Restore Xprint, cherry-picking commits + f7f79724fdea0cc6fda0e90e56431df937d49335 and + d67e210f3458b62d7d4a6032aabfda0004d661c1 from master (xserver 1.5). + Include patch 94_xprint_XSERVER_LIBS to give new meaning of + XSERVER_LIBS as expected in configure.ac from master (see commit + a02db0d500cac20d0f0f107d27c064a175018421). Delete + 94_xprint_XSERVER_LIBS when we upgrade to xserver 1.5. + + [ Julien Cristau ] + * Re-enable patch 51_xkb-and-loathing.diff: ignore SIGALRM around calls to + Popen()/Pclose() to fix a hang when opening menus in OpenOffice.org + (once again closes: #433131) + * Refresh all patches to make patch-audit happy. + * Pull from upstream server-1.4-branch as of March 14th. + * 42_dont_break_grab_and_focus_for_window_when_redirecting.diff removed, + applied upstream. + * Don't build xprint just yet, because it needs NEW processing. + + [ David Nusinow ] + * Add 11_dont_crash_on_bad_dri_mode. See bugzilla #13860 + + -- Julien Cristau Fri, 14 Mar 2008 15:18:16 +0100 + +xorg-server (2:1.4.1~git20080131-1) unstable; urgency=low + + [ Brice Goglin ] + * Add 45_only_XF86_APM_CAPABILITY_CHANGED_for_video_change_acpi_events.diff + to prevent XF86_APM_CAPABILITY_CHANGED from being issued for all ACPI + events, thanks Sjoerd Simons, closes: #461463. + + [ David Nusinow ] + * Update Japanese translation from Hideki Yamane. closes: #462761 + * New upstream pull + + Fixes crashes due to absent LED's being referenced + + -- David Nusinow Thu, 31 Jan 2008 21:43:12 -0500 + +xorg-server (2:1.4.1~git20080118-1) unstable; urgency=low + + [ Brice Goglin ] + * Add 42_dont_break_grab_and_focus_for_window_when_redirecting.diff + to prevent password authentication bypass, closes: #449108. + + [ Julien Cristau ] + * New upstream snapshot + + includes the security fixes from the previous version + + fixes regression introduced by the fix for CVE-2007-6429 in the MIT-SHM + extension (closes: #461410) + + -- Brice Goglin Fri, 18 Jan 2008 22:20:32 +0100 + +xorg-server (2:1.4.1~git20080105-2) unstable; urgency=low + + [ David Nusinow ] + * Improve dpms logging patch to correctly label message type + + [ Brice Goglin ] + * Grab upstream commit db9ae863536fff80b5463d99e71dc47ae587980d + to set DEFAULT_DPI to 96 instead of 75. + + [ Julien Cristau ] + * Fix multiple security issues + + CVE-2007-6427: XInput Extension Memory Corruption + + CVE-2007-6428: TOG-CUP Extension Memory Corruption + + CVE-2007-6429: EVI Extension Integer Overflow, + MIT-SHM Extension Integer Overflow + + CVE-2007-5760: XFree86-Misc Extension Invalid Array Index + + CVE-2007-5958: file existence disclosure + + CVE-2008-0006: PCF font parser buffer overflow + * Bump Standards-Version to 3.7.3 (no changes). + + -- Julien Cristau Thu, 17 Jan 2008 15:10:03 +0100 + +xorg-server (2:1.4.1~git20080105-1) unstable; urgency=low + + * Don't reference non-existent bug-reporting.txt file in xvfb-run.1 + * New upstream git pull, again from the server-1.4-branch + + Drop 08_xkb_infinite_loop.diff, it's upstream now + * Improve logging when DPMS is enabled implicitly + + Adds 08_better_dpms_logging.diff + + -- David Nusinow Sun, 06 Jan 2008 16:56:38 -0500 + +xorg-server (2:1.4.1~git20071212-2) unstable; urgency=low + + * Add patch 08_xkb_infinite_loop.diff from upstream bug#13511: papers over + an infinite loop in event processing (closes: #451989). + + -- Julien Cristau Sat, 22 Dec 2007 00:02:01 +0100 + +xorg-server (2:1.4.1~git20071212-1) unstable; urgency=low + + [ Julien Cristau ] + * debian/rules: Use lsb_release -i -s to get the vendor name, instead of + hardcoding "Debian". + * debian/control: build-dep on lsb-release. + * Cherry-pick commit f30abe30 from master: edid quirk for MAX 0x77e monitor. + * Add patch 44_preferredmode_infinite_loop.diff from upstream git: fixes an + infinite loop when PreferredMode is used in xorg.conf. + + [ David Nusinow ] + * New upstream version. This is based on the server-1.4-branch, and includes + all the changes in the 1.4.0.90 (pre-)release as well as additional fixes. + This is primarily a bugfix release + + Remove 12_bgPixel_fix_64bit_issue.diff. Applied upstream + + -- David Nusinow Wed, 12 Dec 2007 20:19:11 -0500 + +xorg-server (2:1.4.1~git20071119-1) unstable; urgency=low + + * Ship a .orig.tar.gz that's been autoreconf'ed. Closes: #451891 + * Re-enable validation of the screen section of xorg.conf + Modify 14_default_screen_section.diff. This also fixes a problem where the + server can't find the device section when it is specified in the screen + section. Closes: #451950 + + -- David Nusinow Mon, 19 Nov 2007 20:38:04 -0500 + +xorg-server (2:1.4.1~git20071117-1) unstable; urgency=low + + [ Julien Cristau ] + * Add conflict on xserver-xorg-input-wacom (<< 0.7.8) to xserver-xorg-core. + That driver is built against the old ABI, but doesn't provide + xserver-xorg-input. + + [ David Nusinow ] + * Add 14_default_screen_section.diff. This allows you to not have a screen + section in your xorg.conf. A basic default one with a simple identifier + will be created for you in this case using all default values + + [ Christian Perrier ] + * Debconf translations: + * Galician. Closes: #444764 + * German. Closes: #444917 + * Brazilian Portuguese. Closes: #445266 + * Russian. Closes: #443859 + * Portuguese. Closes: #445051 + * Slovak. Closes: #446418, #448220 + + [ Brice Goglin ] + * Bump x11proto-core-dev build-dependency to >= 7.0.9, + thanks Max Kellermann, closes: #446869. + + [ David Nusinow ] + * New upstream stable snapshot + + fixes a bunch of input-related bugs, notably keyboard leds + (closes: #440743 and its pile of duplicates) + * Remove patches merged in this snapshot + + 08_exa_fix_exaFillRegionTiled_fallback.diff + + 11_exa_no_negative_tile_offsets.diff + + 42_fix_RemoveGeneralSocket_crash_from_dbus.diff + + 44_XKB_mapping_changes_for_all_core-sending_devices.diff + + 45_GetKeyboardEvents_reject_out-of-range_keycodes.diff + * Make xephyr recommend xfonts-base. Closes: #451542 + + -- David Nusinow Sat, 17 Nov 2007 18:54:02 -0500 + +xorg-server (2:1.4-3) unstable; urgency=low + + [ David Nusinow ] + * Minor cleanups of 03_autoload_drivers.diff. Thanks to Julien for + spotting all these ugly bits + + Newline after #else when picking the driver (this is the failsafe + choice) + + Change by hacked "ids" file name suffix check to use strncmp and check + for ".ids" + + Use strncpy instead of strncat unnecessarily + * Add support for a partially configured device section + Implemented in 03_autoload_driver.diff. Now if you have a device section + but lack a driver, it'll use the settings. This will allow you to just + have a device section and enable EXA but not have to specify the driver or + anything else. + * Add 07_autoconfig_screen_with_device_section.diff + This patch allows the Screen section to not specify a device section. If + this happens, the server will automatically use the first device section + listed in the xorg.conf instead + + [ Brice Goglin ] + * Allow building the Xfbdev server in new package xserver-xfbdev, but leave + it disabled for now (see #439764). + * Add upstream commit 27ad5d74c20f01516a1bff73be283f8982fcf0fe as patch + 44_XKB_mapping_changes_for_all_core-sending_devices.diff to fix broken + xmodmap invocation in .xsession, closes: #443044. + * Add upstream commit 0e800ca4651a947ccef239e6fe7bf64aab92257c as patch + 45_GetKeyboardEvents_reject_out-of-range_keycodes.diff to fix crash + in GetKeyboardValuatorEvents, closes: #443697. + + [ Christian Perrier ] + * Debconf templates and debian/control reviewed by the debian-l10n- + english team as part of the Smith review project. Closes: #442210 + * Debconf translation updates: + - Swedish. Closes: #443047 + - Czech. Closes: #443100 + - French + - Vietnamese. Closes: #443174 + - Italian. Closes: #422414 + * New debconf translations + - Hungarian. Closes: #442956 + - Thai. Closes: #442962 + - Tamil. Closes: #443027 + - Basque. Closes: #443156 + - Hebrew. Closes: #443204 + - Bulgarian. Closes: #443226 + - Finnish. Closes: #443611 + + [ Julien Cristau ] + * Add patch backported from upstream commit + 13949f997289068354e83bc83e50d97b8232efb1 to remove the type1 module: patch + 05_kill_type1.diff replaces 48_disable_type1.diff, and is now enabled in + debian/patches/series. + * Don't build kdrive-based servers we're not shipping. + * Use ${binary:Version} instead of ${Source-Version}. + * Add 08_exa_fix_exaFillRegionTiled_fallback.diff by Michel Dänzer to punt + on fallback case not handled correctly in exaFillRegionTiled (backported + from master's c7d6d1f5); closes: #444203. + * Add 11_exa_no_negative_tile_offsets.diff by Michel Dänzer to make sure + tile offsets passed to drivers are never negative (backported from + master's 006f6525). + * Add 12_bgPixel_fix_64bit_issue.diff by Hong Liu: bgPixel (unsigned long) + is 64-bit on x86_64, so -1 != 0xffffffff (master's 9adea807). + + -- Julien Cristau Sat, 29 Sep 2007 16:14:35 +0200 + +xorg-server (2:1.4-2) unstable; urgency=low + + [ Brice Goglin ] + * Add 42_fix_RemoveGeneralSocket_crash_from_dbus.diff to fix a crash + when leaving, closes: #440547. + * Add 43_allow_override_BIOS_EDID_preferred_mode.diff to allow overriding + BIOD/EDID preferred mode with Option PreferredMode in the config file. + + [ David Nusinow ] + * Upload to unstable + + -- David Nusinow Sun, 16 Sep 2007 14:24:18 -0400 + +xorg-server (2:1.4-1) experimental; urgency=low + + * New upstream release (X.Org 7.3) + + RandR doesn't mark Xinerama as active when no crtcs are enabled + (closes: #431746) + * Add proper depends to xserver-xorg-dev: + x11proto-core-dev, x11proto-input-dev (>= 1.4), x11proto-xext-dev, + x11proto-video-dev, x11proto-randr-dev (>= 1.2), x11proto-render-dev (>= + 2:0.9.3), x11proto-fonts-dev + * Bump serverminver to 2:1.4, videoabiver to 2, inputabiver to 2. + + -- Julien Cristau Mon, 10 Sep 2007 14:35:38 +0200 + +xorg-server (2:1.3.99.2-1) experimental; urgency=low + + [ David Nusinow ] + * Refactor auto_load_driver patch to allow the same method to be used when + there is no xorg.conf present + * Add 04_auto_load_driver_no_config.diff to use my auto_load_driver method + when there's no xorg.conf present + + [ Brice Goglin ] + * Simplify output redirections in the reportbug script, + thanks Justin Pryzby, closes: #358390. + * Add missing URL in long descriptions, update links to the upstream + module, fix some capitalization, thanks Christian Perrier. + + [ Julien Cristau ] + * New upstream release candidate. + + bump build dep on renderproto to >= 0.9.3, and on pixman to >= 0.9.4-2. + + bump video abi version and serverminver. + * Drop the Conflict on fglrx-driver, which is taken care of by the abi + version. + + -- Julien Cristau Tue, 04 Sep 2007 17:32:19 +0200 + +xorg-server (2:1.3.99.0-2) experimental; urgency=low + + * Improve 03_auto_load_driver.diff + + Move memory cleanup and directory closing to after the end label to + prevent leaks. Thanks Julien. + + Allow a driver to claim everything from a specific vendor. It does so by + only specifying a vendor ID and leaving the latter four digits empty. + + -- David Nusinow Sun, 19 Aug 2007 16:06:54 -0400 + +xorg-server (2:1.3.99.0-1) experimental; urgency=low + + [ Julien Cristau, David Nusinow ] + * New upstream release candidate. + + X is now more tolerant of devices without a CtrlProc (closes: #269860). + + cvt(1) and gtf(1) typos fixed (closes: #432065). + + Make sure DRIScreenPrivIndex is -1 when no DRI screen private is + allocated. (closes: #413697). + + __glXDRIscreenProbe: Use drmOpen/CloseOnce (closes: #419614). + + segfault in swrast_Triangle fixed in mesa (closes: #407502). + + the Xvfb manpage doesn't refer to /usr/tmp anymore (closes: #270257). + + typos in Xserver(1) fixed (closes: #306688). + + * Remove patches that were pushed upstream + + 03_xnest_manpage_overhaul.diff + + 04_read_rom_in_chunks.diff + + 05_module_defaults.diff + + 07_stolen_from_HEAD_xorgconf_manpage.diff + + 08_s390_servermd.diff + + 12_security_policy_in_etc.diff + + 16_s390_fix.diff + + 18_execinfo_configured.patch + + 23_kfreebsd_support.diff + + 24_hurd_ioperm_fix.diff + + 32_disable_sparc_pci_bridge.diff + + 39_alpha_build_flags.patch + + 40_consolidate_portPriv_pDraw_assignments.diff + + 42_only_run_special_key_behaviours_on_non-XKB.diff + + 44_fedora-xephyr-keysym-madness.diff (different fix applied upstream) + + 45_CVE-2007-2437.diff + + 46_export-ramdac-symbols.diff + + 49_map_keyboard_driver_to_kbd.diff + + 50_alpha_no_include_asm_pci.h.diff + + 94_use_default_font_path.diff + + 125_glx_remove-stray__GLinterface.diff, + 126_glxproxy_remove-stray__GLinterface.diff and + 127_mesa-6.5.3-compat.diff (obsolete) + + * Update other patches: + + 09_debian_xserver_rtff.diff disabled (doesn't apply, and isn't even + used AFAICS; + + 11_define_XFree86Server.diff dropped, to be fixed in drivers instead; + + 13_debian_add_xkbpath_env_variable.diff refreshed; + + 21_glx_align_fixes.patch updated; + + 43_xephyr_crash_at_exit.diff dropped (doesn't apply); + + 47_fbdevhw_magic_numbers.diff disabled for now; + + 48_disable_type1.diff disabled for now; + + 51_xkb-and-loathing.diff disabled for now. + + [ Julien Cristau ] + * Add build-dep on x11proto-input-dev (>= 1.4.2), libpixman-1-dev + (>= 0.9.0), libdbus-1-dev, libhal-dev (except on hurd-i386 for the last + two). + * Bump build-dep on mesa-swx11-source to >> 7.0.1~rc2-1. + * Bump serverminver to this version, videoabiver to 1.9, inputabiver to + 0.9 (so this doesn't clash with a release and drivers have to be + rebuilt). + * Bump build-dep on compositeproto to >= 0.4. + * Install the upstream changelog. + * Disable the xprint and dmx DDX for now, they fail to build. + * xserver-xorg-dev needs a dependency on libpixman-1-dev. + * Add explanations about our tarball and upstream URL to debian/copyright. + + [ Drew Parsons ] + * Update Xprint build to include pixman. + + [ David Nusinow ] + * Add 03_auto_load_driver.diff. This patch allows the server to select a + driver and automatically create a Devices section when none is specified + in your xorg.conf. It chooses the driver based on a set of PCI ID's that + the driver itself provides in /usr/share/xserver-xorg/pci. If no driver + claims the PCI ID of your primary video card, then it will choose a + fallback based on your system. + + -- Julien Cristau Sat, 18 Aug 2007 18:28:49 +0200 + +xorg-server (2:1.3.0.0.dfsg-13) UNRELEASED; urgency=low + + [ Debconf templates translations ] + * Italian added. Closes: #422414 + * Slovak added. Closes: #438578 + + -- Christian Perrier Sun, 26 Aug 2007 12:09:52 +0200 + +xorg-server (2:1.3.0.0.dfsg-12) unstable; urgency=low + + [ Brice Goglin ] + * Add 51_xkb-and-loathing.diff to fix a hang in OpenOffice.org + when opening menus, closes: #433131. + * Install the exa(4) and fbdevhw(4) manpages. + + [ Julien Cristau ] + * Update the xorg.conf(5) manpage to get documentation for RandR 1.2 + options: + + 07_stolen_from_HEAD_xorgconf_manpage.diff: new patch; + + 07_xorgconf_manpage_overhaul.diff dropped; + + 34_xorg.conf_man_typos.patch dropped; + + 05_module_defaults.diff, 94_use_default_font_path.diff: dropped hunks + applying to hw/xfree86/doc/man/xorg.conf.man.pre. + * Add patch 11_define_XFree86Server.diff: XFree86Server needs to be defined + in xorg-server.h and exported to drivers. + * Add patches 125_glx_remove-stray__GLinterface.diff + 126_glxproxy_remove-stray__GLinterface.diff and 127_mesa-6.5.3-compat.diff + to build with mesa >= 6.5.3, and bump build-dependency on + mesa-swx11-source. + * Include the Debian package version in OSVENDOR to make it appear in the + X log. + + -- Julien Cristau Thu, 09 Aug 2007 16:32:14 +0200 + +xorg-server (2:1.3.0.0.dfsg-11) unstable; urgency=low + + * Yet another alpha build fix: also remove the asm/pci.h include from + os-support/linux/lnx_axp.c. Include "lnx.h" and instead. + + -- Julien Cristau Sat, 14 Jul 2007 20:09:35 +0200 + +xorg-server (2:1.3.0.0.dfsg-10) unstable; urgency=medium + + * hw/xfree86/common/compiler.h and declare incompatible + prototypes for outb and friends, so change the patch from -9 to not + #include and rely on declarations in lnx.h itself for the + IOBASE_* macros. + + -- Julien Cristau Sat, 14 Jul 2007 18:06:14 +0200 + +xorg-server (2:1.3.0.0.dfsg-9) unstable; urgency=medium + + * Include instead of in + hw/xfree86/os-support/linux/lnx.h, as the latter isn't exported to + userspace anymore; fixes FTBFS on alpha. Thanks, Steve Langasek! + + -- Julien Cristau Sat, 14 Jul 2007 12:17:10 +0200 + +xorg-server (2:1.3.0.0.dfsg-8) unstable; urgency=medium + + * Medium-urgency upload to get the fix for #428794 in testing faster, + hopefully. + + [ Brice Goglin ] + * Add 47_fbdevhw_magic_numbers.diff: patch by Adam Jackson to keep the + fbdev2xfree_timing() function from changing the pixel clock value if the + fbdev driver claims that it is 0. + + [ Julien Cristau ] + * Don't build the type1 font module. + * Add patch by Alan Coopersmith to map (case-insensitively) the old + "keyboard" input driver to "kbd" (addresses: #428794). I'm not + reassigning the bug to xserver-xorg-core for now so as not to break + testing by letting xserver-xorg-input-keyboard transition before the fixed + xorg-server. + + -- Julien Cristau Sat, 14 Jul 2007 01:48:20 +0200 + +xorg-server (2:1.3.0.0.dfsg-7) unstable; urgency=low + + [ Brice Goglin ] + * Add 40_consolidate_portPriv_pDraw_assignments.diff to avoid a crash + in xf86XVReputVideo (closes: #424899, #431655). + * Add 41_vbe_filter_less.diff to not reject VESA modes early since + xf86ValidateModes should handle them just fine (closes: #424684). + * Add 42_only_run_special_key_behaviours_on_non-XKB.diff to fix special + keys in Xephyr (closes: #415025). + * Add 43_xephyr_crash_at_exit.diff to avoid crashing Xephyr when first + client disconnect (closes: #420421). + + -- Julien Cristau Wed, 04 Jul 2007 23:42:40 +0200 + +xorg-server (2:1.3.0.0.dfsg-6) unstable; urgency=low + + * Change fglrx conflict to << 8.37.6 (closes: #424975). + + -- Julien Cristau Fri, 01 Jun 2007 14:58:39 +0200 + +xorg-server (2:1.3.0.0.dfsg-5) unstable; urgency=low + + [ Brice Goglin ] + * Add 24_hurd_ioperm_fix.diff to fix xf86Enable/DisableIO on Hurd with + recent GNU Mach. Thanks Samuel Thibault! + * Add 06_use_proc_instead_of_sysfs_for_pci_domains.diff since sysfs-based + PCI management code is broken at least on sparc and powerpc. + Closes: #422077, #422095. Thanks to Jim Watson for testing! + * Install the Xephyr README, closes: #395888. + * Update 07_xorgconf_manpage_overhaul.diff to drop the reference to the + xorg.conf example which we do not install since Xserver 1.3 does automatic + configuration, the manpage is very well documented, and we generate a + config file during installation. Closes: #222932. + * Fix warning in /etc/init.d/xprint when /usr/lib/X11/fonts does not exist. + Closes: #422352. Thanks Cristian Ionescu-Idbohrn! + * Pull upstream commit 9c80eda826448822328bb678a7d284cc43fffb17 to disable + RandR's fake xinerama geometry when there's more than one protocol screen + (closes: #420679). + + [ Julien Cristau ] + * Add patch to make sure that the ramdac symbols are present in the server + and drivers can use them (closes: #423129). + * xserver-xorg-core Conflicts with fglrx-driver, which broke with 1.3. + We'll need to make this versioned (or drop it) when fglrx is fixed. + + -- Julien Cristau Wed, 16 May 2007 15:17:55 +0200 + +xorg-server (2:1.3.0.0.dfsg-4) unstable; urgency=low + + * Cherry-pick patch from upstream git to fix security issue in the Xrender + extension: malicious clients can cause a division by zero in the server + (closes: #422936). Reference: CVE-2007-2437. Thanks, Micah Anderson! + + -- Julien Cristau Wed, 09 May 2007 02:11:08 +0200 + +xorg-server (2:1.3.0.0.dfsg-3) unstable; urgency=low + + * Include 94_use_default_font_path.diff. This patch is like Eugene's patch + to always look in the default font path from the past, but now we provide + an option to disable looking in the default font path at runtime. This + will allow people to specify additional font paths in their xorg.conf + without losing their current paths. This will also help avoid people + having ye olde "fixed font" problem. + * Fix compilation warnings for 05_module_defaults.diff. Previously the patch + used a generic pointer for the options record, but now we use the actual + XF86OptionsPtr type. + + -- David Nusinow Thu, 26 Apr 2007 22:39:52 -0400 + +xorg-server (2:1.3.0.0.dfsg-2) unstable; urgency=low + + * Add Brice Goglin's fix for 05_module_defaults.diff, so that it also works + when there is no module section at all. Thanks to Michel Dänzer for + helping also. + + -- David Nusinow Sat, 21 Apr 2007 09:34:12 -0400 + +xorg-server (2:1.3.0.0.dfsg-1) unstable; urgency=low + + * Upload to unstable. + * Add XS-Vcs-* to debian/control. + * Remove non-free file hw/xfree86/doc/README.DRI from the upstream tarball. + * Bump serverminver to 2:1.3.0.0. + + -- Julien Cristau Fri, 20 Apr 2007 07:54:14 +0200 + +xorg-server (2:1.3.0.0-1) experimental; urgency=low + + * New upstream release + + -- David Nusinow Thu, 19 Apr 2007 22:27:05 -0400 + +xorg-server (2:1.2.99.905-3) experimental; urgency=low + + [ Julien Cristau ] + * xvfb now Recommends: xfonts-base (closes: #314598). + + [ David Nusinow ] + * Add 05_module_defaults.diff. This provides default modules loading + capabilities for the server that may be overrided easily. Previously the + server would load a set of default modules, but only if none were + specified in the xorg.conf, or if you didn't have a xorg.conf at all. This + patch provides a default set and you can add only the "Load" instructions + to xorg.conf that you want without losing the defaults. Similarly, if you + don't want to load a module that's loaded by default, you can add + "Disable modulename" to your xorg.conf (see man xorg.conf in this release + for details). See upstream bug #10541 for more. + + -- David Nusinow Sun, 15 Apr 2007 11:17:45 -0400 + +xorg-server (2:1.2.99.905-2) experimental; urgency=low + + * Install the cvt and gtf utilities and their manpages (closes: #414792). + * Build the xserver-xorg-core-dbg package, which contains debugging symbols + for Xorg and /usr/lib/xorg/modules/**/*.so + + -- Julien Cristau Mon, 09 Apr 2007 20:38:22 +0200 + +xorg-server (2:1.2.99.905-1) experimental; urgency=low + + * New upstream release candidate. + + includes fix for CVE-2007-1003: XC-MISC Extension ProcXCMiscGetXIDList() + Memory Corruption. + + -- Julien Cristau Fri, 06 Apr 2007 12:05:40 +0200 + +xorg-server (2:1.2.99.903-1) experimental; urgency=low + + [ Drew Parsons ] + * Add exclude entries to dh_install in debian/rules. + + [ Julien Cristau ] + * Prepare packaging to ship debugging symbols for xserver-xorg-core in + xserver-xorg-core-dbg, but leave it commented out so we can get rc3 in the + archive first. + * New upstream release candidate. + + bump serverminver to 2:1.2.99.903. + + -- Julien Cristau Tue, 27 Mar 2007 07:33:29 +0200 + +xorg-server (2:1.2.99.902-1) experimental; urgency=low + + [ Drew Parsons ] + * Bring xprint back into the xorg fold. + - include existing patches: + - 91_ttf2pt1 allows Xprint to use ttf2pt1 for Type1 font handling + (but extract and apply manually the patch to + hw/xprint/ps/Makefile.am so it may be applied by autoconf) + - 91_ttf2pt1_updates brings ttf2pt1 into the modern X11R7.1 world + - 92_xprint-security-holes-fix.patch places PS/PDF file output + into the user's home directory (~/Xprintjobs), more secure than + a shared /tmp/Xprintjobs + - 93_spooltodir_check_file_exists ensures output filenames are + less than 256 characters in length + - 93_xprint_fonts_fix released references to font names after use. + - enable freetype support for Xprint. + - add descriptions to debian/control and Build-Dependency on + x11proto-print-dev + * Run autoreconf to update changes to hw/xprint/ps/Makefile.am. + + [ Brice Goglin ] + * Apply patch from adrian@smop.co.uk to our xvfb-run wrapper + to check whether Xvfb started ok and fix its cleanup + (closes: #351042). + + [ Julien Cristau ] + * New upstream release candidate. + * Bump serverminver to 2:1.2.99.902. + * Drop patch 42_build_int10_submodules.diff, and use x86emu on all + architectures instead (closes: #410879). + * Refresh patches: + + 12_security_policy_in_etc.diff + + 21_glx_align_fixes.patch + + 23_kfreebsd_support.diff + * Delete a few files generated by configure on clean, since they seem to + have been included in the tarball. + + -- Julien Cristau Thu, 15 Mar 2007 04:28:00 +0100 + +xorg-server (2:1.2.99.901-1) experimental; urgency=low + + * New upstream release candidate. + + Remove patches 24 (hurd support), 35 (randr byteswap) and 43 (set damage + version), applied upstream. + + Bump build-dep on x11proto-randr-dev to >= 1.2, and on + x11proto-damage-dev to >= 1.1. + + -- Julien Cristau Wed, 7 Mar 2007 19:58:53 +0100 + +xorg-server (2:1.2.0-6) experimental; urgency=low + + * Set videoabiver to 1.0, same as in xorg-server 1.1. + + -- Julien Cristau Fri, 2 Mar 2007 16:38:12 +0100 + +xorg-server (2:1.2.0-5) experimental; urgency=low + + * Add input ABI versioning metadata. Rename serverabiver file to + videoabiver, and add inputabiver. Bump serverminver to 2:1.2.0-5 to deal + with this change. + + -- David Nusinow Thu, 1 Mar 2007 22:09:45 -0500 + +xorg-server (2:1.2.0-4) experimental; urgency=low + + [ Julien Cristau ] + * Don't strip modules when DEB_BUILD_OPTIONS contains nostrip. Thanks, + Cyril Brulebois! + + [ David Nusinow ] + * Move serverabiver file to serverminver. Use serverabiver to store the + actual video ABI version number (1.1 right now). This will allow drivers + to automatically generate their Provides: xserver-xorg-video-* line when + built against a particular server version. The rename of the files + is to better denote what they actually are. + * Bump the serverminver to 2:1.2.0-4 because of this change + + -- David Nusinow Wed, 21 Feb 2007 21:53:51 -0500 + +xorg-server (2:1.2.0-3) experimental; urgency=low + + [ Julien Cristau ] + * Pass --with-os-name and --with-os-vendor to configure. + * Bump serverabiver to 2:1.2.0-1. + * Add patch from upstream git to set the supported damage version from the + server, instead of from the damage headers. xserver 1.2.0 supports damage + 1.0, not 1.1. + + -- Julien Cristau Sat, 17 Feb 2007 12:03:03 +0100 + +xorg-server (2:1.2.0-2) experimental; urgency=low + + * Delete useless debian/substvars. + * Change my email address in debian/control. + * Fix patch 42_build_int10_submodules.diff. The definition of + xf86InitInt10() was moved to int10/helper_exec.c between 1.1.1 and 1.2.0, + so we move it to int10/helper_mem.c, which we build in the main int10 + module, not the vm86 and x86emu submodules. Thanks to Cédric Augonnet and + Brice Goglin for the report and testing. + + -- Julien Cristau Sat, 10 Feb 2007 20:57:57 +0100 + +xorg-server (2:1.2.0-1) experimental; urgency=low + + * New upstream release. + + 40_xorg-xserver-1.1.0-dbe-render.diff dropped. + + 38_GetDrawableAttributes.patch dropped. + + 37_build-mesa-mipmap.patch dropped. + + 33_Xserver_man_typos.patch dropped. + + 24_hurd_support.diff massively reduced. + + 13_debian_add_xkbpath_env_variable.diff refreshed. + + 07_xorgconf_manpage_overhaul.diff updated. + + 42_build_int10_submodules.diff updated. + * Bump build-dep on mesa-swx11-source to >= 6.5.2. + * Version build-dependencies on x11proto-composite-dev and x11proto-kb-dev + to match configure.ac. + * Add build-dep on libxfixes-dev (needed for Xdmx). + + -- Julien Cristau Fri, 9 Feb 2007 20:54:27 +0100 + +xorg-server (2:1.1.99.903-1) experimental; urgency=low + + * New upstream release candidate. + * Forward-port patches: + * 07_xorgconf_manpage_overhaul.diff: refresh + * 12_security_policy_in_etc.diff: refresh + * 21_glx_align_fixes.patch: refresh + * 23_kfreebsd_support.diff: refresh + * 24_hurd_support.diff: refresh + * 34_xorg.conf_man_typos.patch: refresh + * 36_fix_ffs.patch: remove, applied upstream + * Bump build-dependency on libdrm-dev to (>= 2.3.0) because that is the X + server's minimum requirement. + + -- Thierry Reding Sat, 2 Dec 2006 12:44:59 +0100 + +xorg-server (2:1.1.99.902-1) experimental; urgency=low + + * Update to latest upstream release candidate. + * Forward-port patches: + * 02_libvgahw_gcc4_volatile_fix.diff: update + * 04_read_rom_in_chunks.diff: update + * 05_arm_cache_flush.diff: remove, applied upstream + * 06_arm_is_not_x86_and_has_no_vga.diff: remove, applied upstream + * 07_xorgconf_manpage_overhaul.diff: update + * 08_s390_servermd.diff: update + * 09_debian_xserver_rtff.diff: update + * 12_security_policy_in_etc.diff: update + * 13_debian_add_xkbpath_env_variable.diff: update + * 15_symlink_mesa.diff: remove, fixed upstream + * 16_s390_fix.diff: update + * 17_ignoreabi.diff: remove, applied upstream + * 18_execinfo_only_for_backtrace.patch: remove, applied upstream + * 18_execinfo_configured.patch: remove, applied upstream + * 19_configurable_misc_utils.patch: remove, applied upstream + * 20_mesa_6.5.1.diff: remove, applied upstream + * 21_glx_align_fixes.patch: update + * 22_xkb_cycle_3layouts.diff: remove, applied upstream + * 23_kfreebsd_support.diff: update, partially applied upstream + * 24_hurd_support.diff: update, partially applied upstream + * 25_tfp_damage.diff: remove, applied upstream + * 26_aiglx_happy_vt_switch.diff: remove, applied upstream + * 27_aiglx_locking.diff: remove, applied upstream + * 28_mesa_copy_sub_buffer.diff: remove, applied upstream + * 29_mesa_reseed_makefile.diff: remove, fixed upstream + * 30_fix_vmode_switch.diff: remove, fixed upstream + * 31_blocksigio.diff: remove, fixed upstream + * 32_disable_sparc_pci_bridge.diff: update + * 34_xorg.conf_man_typos.patch: update + * 35_randr_byteswap.patch: update + * 36_fix_ffs.patch: update + * 37_Fix-__glXDRIbindTexImage-for-32-bpp-on-big-endian-platforms.diff: + remove, applied upstream + * Upstream no longer ships a changelog, so don't try to install it. + * Add 37_build-mesa-mipmap.patch that adds the missing mipmap.c to libmain's + sources. + * Add 38_GetDrawableAttributes.patch which readds support for the + GetDrawableAttributes extension that's needed for compiz to work properly. + + -- Thierry Reding Fri, 1 Dec 2006 20:32:34 +0100 + +xorg-server (2:1.1.1-21) unstable; urgency=emergency + + * Security update. + * Fix integer overflow in the ProcXCMiscGetXIDList() function in the XC-MISC + extension. Reference: CVE-2007-1003. + + -- Julien Cristau Wed, 04 Apr 2007 00:34:51 +0200 + +xorg-server (2:1.1.1-20) unstable; urgency=low + + * xephyr: Add patch from upstream git to fix memory leak in + ephyrScreenFini(). Thanks, Guillem Jover! + + -- Julien Cristau Tue, 6 Mar 2007 22:20:14 +0100 + +xorg-server (2:1.1.1-19) unstable; urgency=high + + [ Drew Parsons ] + * Removed spurious space in default font line + (/usr/X11R6/lib/X11/fonts/Type1 not "/usr/X11R6/lib/ X11/fonts/Type1") + + [ David Nusinow ] + * Conflict with and replace xserver-common, because that package used to + provide the SecurityPolicy file. This is an RC bugfix because it breaks + upgrades, so it gets a high urgency. Thanks Christian Tsotras and Lionel + Elie Mamane for reporting and it. Closes: #402658 + + -- David Nusinow Wed, 28 Feb 2007 21:48:19 -0500 + +xorg-server (2:1.1.1-18) unstable; urgency=medium + + * Add patch from Fedora to make xephyr work on 64bit architectures + (closes: #405928). + + -- Julien Cristau Fri, 16 Feb 2007 22:20:08 +0100 + +xorg-server (2:1.1.1-17) unstable; urgency=medium + + * Make the int10 module usable on i386 with a 64bit kernel (closes: #409730). + + New patch 42_build_int10_submodules.diff, which allows us to build vm86 + and x86emu as two separate submodules, and make the int10 module itself + fall back to loading x86emu if vm86 calls fail. + + Add workaround for https://bugs.freedesktop.org/show_bug.cgi?id=7299 to + the above patch: move definition of Int10Current from int10/xf86int10.c + to int10/helper_mem.c. + + Drop the part of 39_alpha_build_flags.patch applying to + hw/xfree86/os-support/linux/Makefile.in, and run autoreconf with all + patches applied. + + -- Julien Cristau Wed, 7 Feb 2007 20:37:19 +0100 + +xorg-server (2:1.1.1-16) unstable; urgency=medium + + * New patch 41_xfree86_linux_acpi_fix_tokenizing.diff from upstream git to + fix a crash on acpi events (closes: #409443). + + -- Julien Cristau Sat, 3 Feb 2007 22:56:04 +0100 + +xorg-server (2:1.1.1-15) unstable; urgency=high + + * High-urgency upload for security bugfix. + * New patch 40_xorg-xserver-1.1.0-dbe-render.diff to fix multiple integer + overflows in the dbe and render extensions. + CVE IDs: CVE-2006-6101 CVE-2006-6102 CVE-2006-6103 + * Add myself to Uploaders, and remove Fabio and Branden, with their + permission. They're of course welcome back when they have more time! + + -- Julien Cristau Tue, 9 Jan 2007 15:45:46 +0100 + +xorg-server (2:1.1.1-14) unstable; urgency=high + + * The "let's drop 20 years of build logic and replace it with autoconf in a + single release, trust me, what could go wrong? " release + * High-urgency upload for RC bugfix + * New patch 39_alpha_build_flags.patch: no really, when they said + lnx_ev56.c should be built with -mcpu=ev56, they really meant it. + Closes: #392500. + + -- Steve Langasek Sun, 7 Jan 2007 15:19:08 -0800 + +xorg-server (2:1.1.1-13) unstable; urgency=medium + + [ Julien Cristau ] + * xserver-xorg-core recommends xfonts-base and suggests xfonts-100dpi | + xfonts-75dpi and xfonts-scalable. Also add explanation about fonts to the + long description, stolen from the old xserver-common package (closes: + #400654). + + [ David Nusinow ] + * This is important for upgrades to etch, and has no notable risk, so bump + priority to medium. + + -- David Nusinow Fri, 29 Dec 2006 19:57:51 -0500 + +xorg-server (2:1.1.1-12) unstable; urgency=low + + [ Julien Cristau ] + * Delete hw/xfree86/common/xf86Build.h in debian/rules clean, since it's + wrongly included in the upstream tarball. + + [ David Nusinow ] + * Pull fix for the ignore_abi.diff patch. This one's a major brown bag on my + part. Thanks Michel Dänzer. + * Add 38_wait_for_something_force_timer_reset.diff which forces the server + to reset timers when they've overrun in some cases rather than wait + forever. Patch by Daniel Stone. Thanks Michel Dänzer for pointing the + changes out. Closes: #374026 + + -- David Nusinow Tue, 12 Dec 2006 21:13:20 -0500 + +xorg-server (2:1.1.1-11) unstable; urgency=low + + [ Drew Parsons ] + * Patches 33_Xserver_man_typos.patch and 34_xorg.conf_man_typos.patch + fix minor typos in Xserver and xorg.conf man pages. + Closes: #364556, #308899. + * Add patch 35_randr_byteswap.patch from upstream. Fixes a client/server + byteswapping problem. Closes: #291100. + + [ Julien Cristau ] + * Don't build-depend on libdrm-dev on hurd-i386 (closes: #358015). Thanks, + Samuel Thibault. + * Update hurd support patch (closes: #356300). Thanks, Samuel Thibault. + * Add reportbug script stolen from the monolith, to add the user's config + and log file in every bug report. + * Delete hw/xfree86/common/xf86Build.h from our source tree, so that the + build date is correctly calculated at build time, and not hardcoded to + 07 July 2006. Thanks to Jurij Smakov for noticing. + * Add patch 36_fix_ffs.patch by Jurij Smakov to fix infinite loop in ffs() + if called with an argument of 0 (closes: #395564). + * Add patch 37_Fix-__glXDRIbindTexImage-for-32-bpp-on-big-endian-platforms + from upstream git to fix color issue on big endian platforms + (closes: #392453). Thanks to Michel Dänzer for the patch! + * Fix typo in xvfb-run (closes: #337703). + * Install xdmxconfig and its manpage in xdmx-tools (closes: #393991). + * Add Replaces: xdmx (<= 2:1.1.1-10) to xdmx-tools because of the xmdxconfig + manpage move. + + -- David Nusinow Fri, 24 Nov 2006 15:44:52 -0500 + +xorg-server (2:1.1.1-10) unstable; urgency=low + + [ Denis Barbier ] + * Fix video mode switching. Closes: #391052 + * Fix FTBFS on kfreebsd-i386 and kfreebsd-amd64. Thanks Petr Salinger. + Closes: #363517 + + [ David Nusinow ] + * Add depends on xserver-xorg so that /etc/X11/X gets installed. Thanks + Frans Pop. Closes: #392295 + * Add 31_blocksigio.diff. This patch by Alan Hourihane, and it prevents a + race condition when a driver tries to set the cursor state when the server + is in the middle of switching resolution. Thanks to Frans Pop for + reporting the bug, Michel Dänzer for reading through the backtrace and + diagnosing the problem, and Alan for the final patch. Closes: #390646. + + [ Jurij Smakov ] + * Add 32_disable_sparc_pci_bridge.diff. Disable PCI bridge handling on + sparc, which is broken and causes filesystem corruption (by poking + the PCI bus in the wrong places) on some machines. Closes: #392312. + + [ Drew Parsons ] + * Use __appmansuffix__ not __mansuffix__ in + 03_xnest_manpage_overhaul.diff. Closes: #390599. + * Install upstream ChangeLog. Closes: #365274. + + -- David Nusinow Mon, 16 Oct 2006 21:59:51 -0400 + +xorg-server (2:1.1.1-9) unstable; urgency=low + + [ Jurij Smakov ] + * Add 21_glx_align_fixes.patch to reintroduce the setting of __GLX_ALIGN64 + variable, lost during the modular transition. This setting is essential + for architectures with strong alignment requirements. Patch affects + alpha, sparc, amd64, ia64 and s390, mimicking the behaviour of the + monolithic build. Closes: #388125. + + [ Denis Barbier ] + * Add 22_xkb_cycle_3layouts.diff to fix layout switching when 3 layouts + are present. Thanks Ivan Pascal for the patch. Closes: #345803 + + [ David Nusinow ] + * Add kFreeBSD support patch (23). Thanks to Robert Millan, Petr Salinger, + Daniel Stone, and Michael Banck for input and patch writing. + Closes: #363517 + * Add hurd support patch (24). Thanks Samuel Thibault, Daniel Stone, and + Michael Banck. Closes: #356300 + * Disable the explicit enabling of dri in the configure. The configure + script autodetects whether or not to use this anyway, and enabling it + explicitly breaks the build on hurd. Thanks Samuel Thibault and Michael + Banck. Closes: #358015 + * Add several patches written by Kristian Høgsberg for allowing compiz to + work with AIGLX. These patches were vetted by Theirry Reding with valuable + advice from Michel Dänzer, and feedback from Kristian himself. + - 25_tfp_damage.diff + - 26_aiglx_happy_vt_switch.diff + - 27_aiglx_locking.diff + - 28_mesa_copy_sub_buffer.diff + - 29_mesa_reseed_makefile.diff + - update of 20_mesa_6.5.1.diff + * Remove bizarre wholesale inclusion of another patch in the 23_kbsd patch + + [ Eugene Konev ] + * Use --with-default-font-path instead of --with-fontdir. + * Set RGBPath through --with-rgb-path. + * Drop 11_debian_always_use_default_font_path.diff. + * Drop 14_debian_always_look_in_our_module_path.diff. + * Ship SecurityPolicy in xserver-xorg-core. + + -- David Nusinow Thu, 28 Sep 2006 23:59:35 -0400 + +xorg-server (2:1.1.1-8) unstable; urgency=low + + * Update mesa symlink patch to the latest from HEAD + * Add 20_mesa_6.5.1.diff to allow the server to build with mesa 6.5.1 + * Bump build-dep versions on x11proto-gl to 1.4.8, and mesa to 6.5.1 + + -- David Nusinow Mon, 25 Sep 2006 22:21:37 -0400 + +xorg-server (2:1.1.1-7) unstable; urgency=low + + * Fix s390 build issue. Thanks Bastian Blank for the report and Eugene Konev + for the patch. Closes: #388628. + * Disable build of various utilities that we don't ship anyway. Patch thanks + to Eugene Konev. + + -- David Nusinow Thu, 21 Sep 2006 23:07:16 -0400 + +xorg-server (2:1.1.1-6) unstable; urgency=low + + * Upload 7.1 to unstable. + + [ Drew Parsons ] + * Added SGI FreeB licence to debian/copyright. Closes: #368563. + * Apply upstream patches 18_execinfo_only_for_backtrace.patch, to use + execinfo.h for and only for backtrace. Applied git patch + 5a3488ccac8e5dabd9fc98bc41ef178ead1b2faf directly into configure scripts, + activated with autoreconf. Closes: #363218. + * Only requires build-depends version of x11proto-gl-dev on 1.4.6. + + [ Steve Langasek ] + * Add versioned build-depends on x11proto-fixes-dev (>= 4.0), to + ensure the package is built against the right protocol version. + Closes: #383778. + + -- David Nusinow Mon, 18 Sep 2006 18:30:07 -0400 + +xorg-server (2:1.1.1-5) experimental; urgency=low + + * Fix error in 16_s390_fix.diff caused by my idiot copying. Thanks Yannick + Roehlly and Daniel Stone. + + -- David Nusinow Sun, 27 Aug 2006 23:25:21 +0000 + +xorg-server (2:1.1.1-4) experimental; urgency=low + + [ Drew Parsons ] + * Tighten dependencies between X11R7.1 server and video drivers. + xserver-xorg-core no longer Depends: xserver-xorg-video-all + | xserver-xorg-video but instead Conflicts: xserver-xorg-video. + (closes: #383873) + The dependency on xserver-xorg-video-all | xserver-xorg-video-1.0 is + managed by the xserver-xorg binary package (not included here in + order to avoid circular dependencies). (closes: #362313) + * Likewise remove Depends: xserver-xorg-input-all | xserver-xorg-input + (again, handled by xserver-xorg) to avoid circular dependency with drivers. + + [ David Nusinow ] + * Epoch bump + * Add 17_ignoreabi.diff to allow users to simply set a value in xorg.conf + rather than pass -ignoreABI to the server every time it starts + + -- David Nusinow Wed, 23 Aug 2006 22:03:06 +0000 + +xorg-server (1:1.1.1-3) unstable; urgency=low + + * Add 16_s390_fix.diff to fix FTBFS on s390. Thanks Bastian Blank. + (closes: #362641) + * Bump build-depends version of libgl1-mesa-dev to 6.5.x package we have in + experimental currently + * Bump build-depends version of x11proto-gl-dev to 1.4.7 or greater + + -- David Nusinow Tue, 22 Aug 2006 00:57:31 +0000 + +xorg-server (1:1.1.1-2) experimental; urgency=low + + [ Drew Parsons ] + * Updated mesa-swx11-source build-depends to (>> 6.5.0), required + for xserver 1.1.1. (closes: #383334) + + [ David Nusinow ] + * Enable and ship xephyr + * Hack off the 'x' manpage suffix + * Install Xnest manpage + * Bump policy version to 3.7.2.0. No changes necessary. + + -- David Nusinow Wed, 16 Aug 2006 21:14:44 +0000 + +xorg-server (1:1.1.1-1) experimental; urgency=low + + [ David Nusinow ] + * New upstream release + * Move patch target call so that we don't try and build twice + * Remove obsolete 15_security_allocate_local.diff and + 16_SECURITY_setuid.diff + * Add 15_symlink_mesa.diff + + -- David Nusinow Sun, 6 Aug 2006 16:12:25 +0000 + +xorg-server (2:1.0.2-10) unstable; urgency=low + + * Upload to unstable to fixed messed up last upload which was supposed to go + to experimental. Brown bag o' joy. + + -- David Nusinow Tue, 22 Aug 2006 19:31:08 +0000 + +xorg-server (1:1.0.2-9) UNRELEASED; urgency=high + + [ Denis Barbier ] + * Fix 13_debian_add_xkbpath_env_variable.diff, XKBPATH environment + variable was not always taken into account. + + [ David Nusinow ] + * Remove two Ubuntu packaging holdovers. Have xvfb recommend xbase-clients + rather than xauth, and have xserver-xorg-core recommend xkb-data rather + than xkeyboard-config. Thanks Sterling MacNay. + * Security update. Fix for setuid privledge escalation vulernabilities. + See http://lists.freedesktop.org/archives/xorg/2006-June/016146.html for + the full advisory. + + [ Jurij Smakov ] + * Stop including the non-existent asm/kbio.h header file in + hw/xfree86/os-support/linux/lnx_{io,kbd}.c to avoid the build failure + on sparc. + + -- David Nusinow Sat, 1 Jul 2006 17:20:45 -0400 + +xorg-server (1:1.0.2-8) unstable; urgency=low + + * Move xserverrc back to xbase-clients. Thanks Benjamin Mesing. + * Add 15_security_allocate_local.diff. This fixes Bug fd.o bug #6642. + Fix buffer overflow in Render. (CVE 2006-1526). Patch by Eric Anholt. + + -- David Nusinow Tue, 2 May 2006 21:47:17 -0400 + +xorg-server (1:1.0.2-7) unstable; urgency=low + + * Ship xserverrc again in /etc/X11/xinit. Thanks Bastian Kleineidam and + Vasilis Vasaitis. (closes: #357713) + + -- David Nusinow Wed, 26 Apr 2006 00:01:16 -0400 + +xorg-server (1:1.0.2-6) unstable; urgency=low + + [ David Nusinow ] + * Use -DNO_INLINE on s390. Thanks Bastian Blank and Julien Cristau. + (closes: #362641) + * Re-add xvfb-run and manpage to xvfb package. Thanks Josselin Mouette and + Jamie Wilkinson. (closes: #363494) + * Add 014_debian_always_look_in_our_module_path.diff. This will cause the + server to always look in the default module path even if they've specified + an alternate path in their xorg.conf file via the ModulePath option. A + note to users: you should remove this part of your xorg.conf unless you + need it, as the server will look in the right place for modules if you + don't specify a location. + * Run dh_install with --list-missing + * Add missing manpages all around. Thanks Roland Mas and Jan Hudec. + (closes: #362489, #364199) + * Actually install apps to xdmx-tools. Thanks Xavier Bestel. + (closes: #356813) + + [ Denis Barbier ] + * Add 13_debian_add_xkbpath_env_variable.diff so that the server takes + the XKBPATH environment variable into account. (closes: #363229) + + -- David Nusinow Sat, 22 Apr 2006 17:06:23 -0400 + +xorg-server (1:1.0.2-5) unstable; urgency=low + + * Add 11_debian_always_use_default_font_path.diff from Eugene Konev. This + patch causes the server to add the default font path to whatever the user + has specified. Right now, that's /usr/share/fonts/X11, as defined on + configure in debian/rules. Thanks Eugene, this will definitely go a long + way. + * Document how to get rid of error loading glcore (and other modules) in + NEWS.Debian. Thanks Matej Vela and others. + * Provide the virtual 'xserver' package. Thanks Steve Langasek and Daniel + Stone. (closes: #362750) + * Add 12_security_policy_in_etc.diff from Eugene Konev. This will allow us + to tell the server on configure to look in /etc/X11/xserver for the + SecurityPolicy file. Thanks Joey Hess and Eugene. (closes: #362246) + + -- David Nusinow Mon, 17 Apr 2006 00:34:08 -0400 + +xorg-server (1:1.0.2-4) unstable; urgency=low + + * Document the need to update paths in xserver-xorg-core's NEWS file. + (closes: #362077, #362244, #362431) + * Make xserver-xorg-core Architecture: any. (closes: #362150) + * Build with --with-fontdir=/usr/share/fonts/X11. Remove + --with-default-font-path option to make this work. Thanks Eugene Konev. + + -- David Nusinow Thu, 13 Apr 2006 23:54:06 -0400 + +xorg-server (1:1.0.2-3) unstable; urgency=low + + * Add build-conflicts on xlibs-static-dev. Thanks Zephaniah E. Hull. + + -- David Nusinow Tue, 11 Apr 2006 18:44:51 -0400 + +xorg-server (1:1.0.2-2) unstable; urgency=low + + * Upload to unstable + * Add versioned build-dep on libdmx-dev. Thanks Frank Lichtenheld. + (closes: #361752) + + -- David Nusinow Mon, 10 Apr 2006 19:34:04 -0400 + +xorg-server (1:1.0.2-1) experimental; urgency=low + + [ David Nusinow ] + * New upstream release. Fixes CVE-2006-0745 + + [ Denis Barbier ] + * Set XKB base path to /usr/share/X11/xkb. + + -- David Nusinow Mon, 20 Mar 2006 21:41:04 -0500 + +xorg-server (1:1.0.1-2) experimental; urgency=low + + [ David Nusinow ] + * Add versioned dependency on x11-common + * Remove old cruft in our patches directory + * Port patches from trunk + + 030_libvgahw_gcc4_volatile_fix.diff + + general/026_xc_programs_manpage_overhaul.diff + + arm/303_arm_cache_flush.diff + + arm/315_arm_is_not_x86_and_has_no_vga.diff + + general/099e_xorgconf_manpage_overhaul.diff + + s390/500_s390_support.diff + + debian/910_debian_Xserver_RTFF.diff + * add 04_read_rom_in_chunks.diff. This reads PCI ROM in large chunks rather + than one byte at a time. This patch by Alex Williamson and forwarded to us + by Dann Frazier. Thanks to both of them. (closes: #353168) + * Don't build xserver-xorg-core on s390. This means putting all the other + arches as being explicitly listed. Damn !s390. + * Version the conflict with xserver-xfree86 to allow for the transition + package to be installed + * Remove README.DRI, as it is non-free. Add it to prune list. + * Add 10_dont_look_in_home_for_config.diff to prevent looking in a user's + home directory for xorg.conf. Thanks Daniel Stone for the patch. + + -- David Nusinow Sun, 12 Mar 2006 16:18:13 -0500 + +xorg-server (1:1.0.1-1) experimental; urgency=low + + * First upload to Debian + * Add bison and flex to the build-depends + * Define INSTALL in debian/rules + * Add xserver-xorg-core dependency xserver-xorg-video-all | + xserver-xorg-video. The former is a metapackage that depends on all the + video drivers we ship and the latter is a virtual package that each video + driver provides. This scheme will install the metapackage by default but + will permit any single video driver to satsify the dependency. Do the same + thing for the input drivers. + * switch dpatch build-dependency to quilt + * Deal with mesa packaging rename: build-dep on mesa-swrast-source -> + mesa-swx11-source + * Change xserver-core depends to be on x11-common rather than xorg-common + * Have xserver-xorg-dev install the files in /usr/share/aclocal so we get + xorg-server.m4 + * Manually set permissions on serverabiver installation + * Set the default font path to /usr/share/fonts/X11 instead of + /usr/share/X11/fonts. Thanks Eugene Konev. + + -- David Nusinow Mon, 20 Feb 2006 00:18:45 -0500 + +xorg-server (1:0.99.2+cvs.20051025-3) dapper; urgency=low + + * Version mesa-swrast-source Build-Dep to 6.4.0 or higher, so GLcore is a + little less crash-happy (e.g. when moving your glxgears window). + * Export /usr/share/xserver-xorg/serverabiver to xserver-xorg-dev, which + describes the relationship needed from a driver on xserver-xorg-core. + + -- Daniel Stone Fri, 28 Oct 2005 13:00:26 +1000 + +xorg-server (1:0.99.2+cvs.20051025-2) dapper; urgency=low + + * Add Build-Deps on libxaw7-dev, libxmu-dev, libxt-dev, libxpm-dev, + libx11-dev, libxtst-dev, and libxres-dev for DMX utils. + + -- Daniel Stone Wed, 26 Oct 2005 14:34:40 +1000 + +xorg-server (1:0.99.2+cvs.20051025-1) dapper; urgency=low + + * Update to new upstream version. + * All applicable patches have been committed upstream, bar #989 and #990. + + -- Daniel Stone Thu, 20 Oct 2005 10:26:33 +1000 + +xorg-server (1:0.99.0+cvs.20050901-1) breezy; urgency=low + + * First xorg-server release. + + -- Daniel Stone Wed, 6 Jul 2005 15:48:17 +1000 --- xorg-server-1.4.2.orig/debian/compat +++ xorg-server-1.4.2/debian/compat @@ -0,0 +1 @@ +4 --- xorg-server-1.4.2.orig/debian/xprint.links +++ xorg-server-1.4.2/debian/xprint.links @@ -0,0 +1 @@ +usr/share/doc/xprint-common usr/share/doc/xprint --- xorg-server-1.4.2.orig/debian/xprint-overrides +++ xorg-server-1.4.2/debian/xprint-overrides @@ -0,0 +1,2 @@ +# piss-off +xprint binary: description-starts-with-package-name --- xorg-server-1.4.2.orig/debian/xdmx.install +++ xorg-server-1.4.2/debian/xdmx.install @@ -0,0 +1,2 @@ +usr/bin/Xdmx +usr/share/man/man1/Xdmx.1 --- xorg-server-1.4.2.orig/debian/po/cs.po +++ xorg-server-1.4.2/debian/po/cs.po @@ -0,0 +1,56 @@ +# +# Translators, if you are not familiar with the PO format, gettext +# documentation is worth reading, especially sections dedicated to +# this format, e.g. by running: +# info -n '(gettext)PO Files' +# info -n '(gettext)Header Entry' +# +# Some information specific to po-debconf are available at +# /usr/share/doc/po-debconf/README-trans +# or http://www.debian.org/intl/l10n/po-debconf/README-trans +# +# Developers do not need to manually edit POT or PO files. +# +msgid "" +msgstr "" +"Project-Id-Version: xprint-xprintorg\n" +"Report-Msgid-Bugs-To: debian-x@lists.debian.org\n" +"POT-Creation-Date: 2007-09-18 20:35+0200\n" +"PO-Revision-Date: 2007-09-18 19:23+0200\n" +"Last-Translator: Miroslav Kure \n" +"Language-Team: Czech \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "Default printer resolution:" +msgstr "Výchozí rozliÅ¡ení tiskárny:" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"By default, Xprint assumes a printer resolution of 600 dpi. This should be " +"well suited for the majority of printers." +msgstr "" +"Xprint implicitnÄ› pÅ™edpokládá rozliÅ¡ení tiskárny 600 dpi. To by mÄ›lo " +"vyhovovat vÄ›tÅ¡inÄ› dneÅ¡ních tiskáren." + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"On certain 1200 dpi printers, however, the image might appear squashed in " +"the corner of the page, or it might be blown up too large on 300 dpi " +"printers. If you are experiencing such printing problems, you may want to " +"set the default printer resolution to a more appropriate value. See /usr/" +"share/doc/xprint-common/README.printing-problems.gz for more details." +msgstr "" +"Na nÄ›kterých 1200 dpi tiskárnách může obraz vypadat příliÅ¡ malý, zatímco na " +"300 dpi tiskárnách se může obraz vytisknout příliÅ¡ velký. Pokud zaznamenáte " +"popsané problémy, mÄ›li byste nastavit výchozí rozliÅ¡ení tiskárny na " +"vhodnÄ›jší hodnotu. Podrobnosti naleznete v souboru /usr/share/doc/xprint-" +"common/README.printing-problems.gz." --- xorg-server-1.4.2.orig/debian/po/hu.po +++ xorg-server-1.4.2/debian/po/hu.po @@ -0,0 +1,44 @@ +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: debian-x@lists.debian.org\n" +"POT-Creation-Date: 2007-09-18 20:35+0200\n" +"PO-Revision-Date: 2007-09-18 08:21+0100\n" +"Last-Translator: SZERVÃC Attila \n" +"Language-Team: Hungarian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Poedit-Language: Hungarian\n" +"X-Poedit-Country: HUNGARY\n" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "Default printer resolution:" +msgstr "Alapértelmezett nyomtató felbontás:" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"By default, Xprint assumes a printer resolution of 600 dpi. This should be " +"well suited for the majority of printers." +msgstr "" +"Alapban az Xprint 600dpi-s nyomtató felbontást feltételez. Ez jó a legtöbb " +"nyomtatóhoz." + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"On certain 1200 dpi printers, however, the image might appear squashed in " +"the corner of the page, or it might be blown up too large on 300 dpi " +"printers. If you are experiencing such printing problems, you may want to " +"set the default printer resolution to a more appropriate value. See /usr/" +"share/doc/xprint-common/README.printing-problems.gz for more details." +msgstr "" +"Egyes 1200dpi-s nyomtatókon viszont a kép a sarokba kerülhet vagy kilóghat " +"egyes 300dpi-s eszközökön. Hasonló hibáknál állítsd az alap nyomtató " +"felbontást megfelelÅ‘ értékre. Lásd a /usr/share/doc/xprint-common/README." +"printing-problems.gz fájlt a részletekért." --- xorg-server-1.4.2.orig/debian/po/pt.po +++ xorg-server-1.4.2/debian/po/pt.po @@ -0,0 +1,48 @@ +# Portuguese translation for xorg-server's debconf messages +# Copyright (C) 2007 Miguel Figueiredo +# This file is distributed under the same license as the xorg-server package. +# Miguel Figueiredo , 2007. +# +msgid "" +msgstr "" +"Project-Id-Version: xorg-server\n" +"Report-Msgid-Bugs-To: debian-x@lists.debian.org\n" +"POT-Creation-Date: 2007-09-18 07:46+0200\n" +"PO-Revision-Date: 2007-10-02 21:27+0000\n" +"Last-Translator: Miguel Figueiredo \n" +"Language-Team: Portuguese \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "Default printer resolution:" +msgstr "Resolução de impressão pré-definida:" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"By default, Xprint assumes a printer resolution of 600 dpi. This should be " +"well suited for the majority of printers." +msgstr "" +"Como pré-definição o Xprint assume que a resolução da sua impressora é de " +"600 dpi. Isto deve ser adequado para a maioria das impressoras." + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"On certain 1200 dpi printers, however, the image might appear squashed in " +"the corner of the page, or it might be blown up too large on 300 dpi " +"printers. If you are experiencing such printing problems, you may want to " +"set the default printer resolution to a more appropriate value. See /usr/" +"share/doc/xprint-common/README.printing-problems.gz for more details." +msgstr "" +"No entanto, nalgumas impressoras de 1200 dpi a imagem pode parecer encolhida " +"no canto da página, ou pode aparecer demasiado grande em impressoras de 300 " +"dpi. Se estiver a ter estes problemas de impressão, você pode querer definir " +"a resolução de impressão pré-definida para um valor mais apropriado. Para " +"mais detalhes veja /usr/share/doc/xprint-common/README.printing-problems.gz." --- xorg-server-1.4.2.orig/debian/po/eu.po +++ xorg-server-1.4.2/debian/po/eu.po @@ -0,0 +1,50 @@ +# translation of xorg-server-templates.po to Euskara +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Piarres Beobide , 2007. +msgid "" +msgstr "" +"Project-Id-Version: xorg-server-templates\n" +"Report-Msgid-Bugs-To: debian-x@lists.debian.org\n" +"POT-Creation-Date: 2007-09-18 07:46+0200\n" +"PO-Revision-Date: 2007-09-18 09:59+0200\n" +"Last-Translator: Piarres Beobide \n" +"Language-Team: Euskara \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.11.4\n" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "Default printer resolution:" +msgstr "Lehenetsiko inprimagailu erresoluzioa:" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"By default, Xprint assumes a printer resolution of 600 dpi. This should be " +"well suited for the majority of printers." +msgstr "" +"Lehenespenez, Xprint-ek inprimagailu erresoluzioa 600 dpi-koa dela " +"pentsatuko du. Balio hau egokia izan beharko litzateke inprimagailu " +"gehienentzat." + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"On certain 1200 dpi printers, however, the image might appear squashed in " +"the corner of the page, or it might be blown up too large on 300 dpi " +"printers. If you are experiencing such printing problems, you may want to " +"set the default printer resolution to a more appropriate value. See /usr/" +"share/doc/xprint-common/README.printing-problems.gz for more details." +msgstr "" +"1200 dpi-ko zenbait inprimagailuetan hala ere irudia orriaren ertzean agertu " +"daiteke edo handiegia izan liteke 300 dpi-ko inprimagailuentzat. Horrelako " +"arazoak jasaten badituzu eta inprimagailu erresoluzioa beste balio " +"erabilgarriago batetara aldatu nahi izanez gero irakurri /usr/share/doc/" +"xprint-common/README.printing-problems.gz xehetasun gehiagorako." --- xorg-server-1.4.2.orig/debian/po/nl.po +++ xorg-server-1.4.2/debian/po/nl.po @@ -0,0 +1,58 @@ +# Translation of xprint_1:0.1.0.alpha1-13_templates.po to dutch +# +# Translators, if you are not familiar with the PO format, gettext +# documentation is worth reading, especially sections dedicated to +# this format, e.g. by running: +# info -n '(gettext)PO Files' +# info -n '(gettext)Header Entry' +# Some information specific to po-debconf are available at +# /usr/share/doc/po-debconf/README-trans +# or http://www.debian.org/intl/l10n/po-debconf/README-trans# +# Developers do not need to manually edit POT or PO files. +# +msgid "" +msgstr "" +"Project-Id-Version: xprint_1:0.1.0.alpha1-13_nl\n" +"Report-Msgid-Bugs-To: debian-x@lists.debian.org\n" +"POT-Creation-Date: 2007-09-18 20:35+0200\n" +"PO-Revision-Date: 2008-07-16 18:24\n" +"Last-Translator: Thijs Kinkhorst \n" +"Language-Team: Nederlands \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.10.2\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "Default printer resolution:" +msgstr "Standaard printerresolutie:" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"By default, Xprint assumes a printer resolution of 600 dpi. This should be " +"well suited for the majority of printers." +msgstr "" +"Standaard veronderstelt Xprint een printerresolutie van 600dpi. Dit zou voor " +"het merendeel van de hedendaagse printers goed moeten zijn." + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"On certain 1200 dpi printers, however, the image might appear squashed in " +"the corner of the page, or it might be blown up too large on 300 dpi " +"printers. If you are experiencing such printing problems, you may want to " +"set the default printer resolution to a more appropriate value. See /usr/" +"share/doc/xprint-common/README.printing-problems.gz for more details." +msgstr "" +"Op bepaalde 1200dpi-printers zou het beeld echter samengedrukt kunnen lijken " +"in de hoek van de pagina, terwijl het op 300dpi-printers te groot zou kunnen " +"worden opgeblazen. Als u dergelijke afdrukproblemen ervaart, kunt u de " +"standaard printerresolutie naar een meer passende waarde veranderen. Zie /" +"usr/share/doc/xprint-common/README.printing-problems.gz voor meer " +"gedetailleerde informatie." --- xorg-server-1.4.2.orig/debian/po/de.po +++ xorg-server-1.4.2/debian/po/de.po @@ -0,0 +1,58 @@ +# translation of xorg-server_2:1.3.0.0.dfsg-13_de.po to German +# +# Translators, if you are not familiar with the PO format, gettext +# documentation is worth reading, especially sections dedicated to +# this format, e.g. by running: +# info -n '(gettext)PO Files' +# info -n '(gettext)Header Entry' +# Some information specific to po-debconf are available at +# /usr/share/doc/po-debconf/README-trans +# or http://www.debian.org/intl/l10n/po-debconf/README-trans# +# Developers do not need to manually edit POT or PO files. +# +# Erik Schanze , 2004-2007. +msgid "" +msgstr "" +"Project-Id-Version: xorg-server_2:1.3.0.0.dfsg-13_de\n" +"Report-Msgid-Bugs-To: debian-x@lists.debian.org\n" +"POT-Creation-Date: 2007-09-18 20:35+0200\n" +"PO-Revision-Date: 2007-10-01 21:52+0200\n" +"Last-Translator: Erik Schanze \n" +"Language-Team: German \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.11.4\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "Default printer resolution:" +msgstr "Standard-Druckerauflösung:" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"By default, Xprint assumes a printer resolution of 600 dpi. This should be " +"well suited for the majority of printers." +msgstr "" +"Standardmäßig verwendet Xprint eine Druckerauflösung von 600 dpi. Das " +"funktioniert gut mit den meisten Druckern." + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"On certain 1200 dpi printers, however, the image might appear squashed in " +"the corner of the page, or it might be blown up too large on 300 dpi " +"printers. If you are experiencing such printing problems, you may want to " +"set the default printer resolution to a more appropriate value. See /usr/" +"share/doc/xprint-common/README.printing-problems.gz for more details." +msgstr "" +"Trotzdem erscheint der Ausdruck bei bestimmten 1200-dpi-Druckern in die Ecke " +"der Seite gequetscht oder er wird auf 300-dpi-Druckern zu groß dargestellt. " +"Falls bei Ihnen diese Druckprobleme auftreten, sollten Sie die Standard-" +"Druckerauflösung auf einen besser passenden Wert setzen. Einzelheiten finden " +"Sie in der Datei /usr/share/doc/xprint-common/README.printing-problems.gz." --- xorg-server-1.4.2.orig/debian/po/fi.po +++ xorg-server-1.4.2/debian/po/fi.po @@ -0,0 +1,46 @@ +msgid "" +msgstr "" +"Project-Id-Version: debconf: xorg-server\n" +"Report-Msgid-Bugs-To: debian-x@lists.debian.org\n" +"POT-Creation-Date: 2007-09-18 20:35+0200\n" +"PO-Revision-Date: 2007-09-22 22:59+0200\n" +"Last-Translator: Esko Arajärvi \n" +"Language-Team: Finnish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Poedit-Language: Finnish\n" +"X-Poedit-Country: FINLAND\n" +"X-Poedit-SourceCharset: utf-8\n" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "Default printer resolution:" +msgstr "Tulostimen oletusresoluutio:" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"By default, Xprint assumes a printer resolution of 600 dpi. This should be " +"well suited for the majority of printers." +msgstr "" +"Xprint olettaa tulostimen resoluution olevan 600 dpi. Suurimmalle osalle " +"tulostimista tämä oletus sopii hyvin." + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"On certain 1200 dpi printers, however, the image might appear squashed in " +"the corner of the page, or it might be blown up too large on 300 dpi " +"printers. If you are experiencing such printing problems, you may want to " +"set the default printer resolution to a more appropriate value. See /usr/" +"share/doc/xprint-common/README.printing-problems.gz for more details." +msgstr "" +"Joillain 1200 dpi:n tulostimilla kuva saattaa tulostua hyvin pienenä paperin " +"kulmaan ja joillain 300 dpi:n tulostimilla tulostua liian suurena. " +"Tällaisten ongelmien ilmetessä saatat haluta asettaa oletusresoluutioksi " +"jonkin sopivamman arvon. Lisätietoja löytyy dokumentista /usr/share/doc/" +"xprint-common/README.printing-problems.gz." --- xorg-server-1.4.2.orig/debian/po/da.po +++ xorg-server-1.4.2/debian/po/da.po @@ -0,0 +1,60 @@ +# Danish translation of the Debconf po-template for xprint-xprintorg. +# Morten Bo Johansen , 2004, 2005. +msgid "" +msgstr "" +"Project-Id-Version: xprint-xprintorg_0.1.0.alpha1-8_da.po\n" +"Report-Msgid-Bugs-To: debian-x@lists.debian.org\n" +"POT-Creation-Date: 2007-09-18 20:35+0200\n" +"PO-Revision-Date: 2005-03-17 01:15+0100\n" +"Last-Translator: Morten Bo Johansen \n" +"Language-Team: Danish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=iso-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +#, fuzzy +#| msgid "Default printer resolution" +msgid "Default printer resolution:" +msgstr "Printerens standardopløsning" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +#, fuzzy +#| msgid "" +#| "By default Xprint assumes a printer resolution of 600dpi. This should be " +#| "fine for the majority of printers today." +msgid "" +"By default, Xprint assumes a printer resolution of 600 dpi. This should be " +"well suited for the majority of printers." +msgstr "" +"Xprint bruger en opløsning på 600dpi som standard. Dette skulle være " +"passende for de fleste nyere printere." + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +#, fuzzy +#| msgid "" +#| "On certain 1200dpi printers, however, the image might appear squashed in " +#| "the corner of the page, or it might be blown up too large on 300dpi " +#| "printers. If you are experiencing these kinds of printing problems, you " +#| "may want to set the default printer resolution to a more appropriate " +#| "value. See /usr/share/doc/xprint-common/README.printing-problems.gz for " +#| "more details." +msgid "" +"On certain 1200 dpi printers, however, the image might appear squashed in " +"the corner of the page, or it might be blown up too large on 300 dpi " +"printers. If you are experiencing such printing problems, you may want to " +"set the default printer resolution to a more appropriate value. See /usr/" +"share/doc/xprint-common/README.printing-problems.gz for more details." +msgstr "" +"På visse printere med en opløsning på 1200dpi kan billedet forekomme " +"sammenpresset i hjørnerne, eller det kan virke overforstørret på printere " +"med en opløsning på 300dpi. Hvis du oplever sådanne udskrivningsproblemer, " +"vil det være en god ide at sætte printerens opløsning til en mere passende " +"værdi. Se /usr/share/doc/xprint-common/README.printing-problems.gz for flere " +"detaljer." --- xorg-server-1.4.2.orig/debian/po/bg.po +++ xorg-server-1.4.2/debian/po/bg.po @@ -0,0 +1,50 @@ +# translation of bg.po to Bulgarian +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Damyan Ivanov , 2007. +msgid "" +msgstr "" +"Project-Id-Version: xorg-server\n" +"Report-Msgid-Bugs-To: debian-x@lists.debian.org\n" +"POT-Creation-Date: 2007-09-18 07:46+0200\n" +"PO-Revision-Date: 2007-09-19 22:08+0300\n" +"Last-Translator: Damyan Ivanov \n" +"Language-Team: Bulgarian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.11.4\n" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "Default printer resolution:" +msgstr "Подразбирана разделителна ÑпоÑобноÑÑ‚ на принтера:" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"By default, Xprint assumes a printer resolution of 600 dpi. This should be " +"well suited for the majority of printers." +msgstr "" +"Xprint използва по подразбиране разделителна ÑпоÑобноÑÑ‚ от 600 dpi. Тази " +"ÑтойноÑÑ‚ би Ñ‚Ñ€Ñбвало да е подгодÑща за повечето принтери." + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"On certain 1200 dpi printers, however, the image might appear squashed in " +"the corner of the page, or it might be blown up too large on 300 dpi " +"printers. If you are experiencing such printing problems, you may want to " +"set the default printer resolution to a more appropriate value. See /usr/" +"share/doc/xprint-common/README.printing-problems.gz for more details." +msgstr "" +"При нÑкои принтери Ñ Ñ€Ð°Ð·Ð´ÐµÐ»Ð¸Ñ‚ÐµÐ»Ð½Ð° ÑпоÑобноÑÑ‚ от 1200 dpi изображението може " +"да е Ñвито в ъгъла на Ñтраницата, а при други, използващи 300 dpi - да е " +"твърде разтегнато. Ðко имате подобни проблеми при печатането, може да Ñе " +"наложи да промените подразбираната разделителна ÑпоÑобноÑÑ‚ на принтера Ñ Ð¿Ð¾-" +"подходÑща ÑтойноÑÑ‚. Вижте /usr/share/doc/xprint-commin/README.printing-" +"problems.gz за повече информациÑ." --- xorg-server-1.4.2.orig/debian/po/vi.po +++ xorg-server-1.4.2/debian/po/vi.po @@ -0,0 +1,49 @@ +# Vietnamese translation for XOrg Server. +# Copyright © 2007 Free Software Foundation, Inc. +# Clytie Siddall , 2005-2007. +# +msgid "" +msgstr "" +"Project-Id-Version: xorg-server 2:1.3.0.0.dfsg-13\n" +"Report-Msgid-Bugs-To: debian-x@lists.debian.org\n" +"POT-Creation-Date: 2007-09-18 20:35+0200\n" +"PO-Revision-Date: 2007-09-19 21:50+0930\n" +"Last-Translator: Clytie Siddall \n" +"Language-Team: Vietnamese \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: LocFactoryEditor 1.7b1\n" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "Default printer resolution:" +msgstr "Äá»™ phân giải máy in mặc định:" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"By default, Xprint assumes a printer resolution of 600 dpi. This should be " +"well suited for the majority of printers." +msgstr "" +"Mặc định là trình Xprint giả sá»­ Ä‘á»™ phân giải của máy in là 600 chấm/insÆ¡. " +"Äây nên hữu ích cho phần lá»›n máy in." + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"On certain 1200 dpi printers, however, the image might appear squashed in " +"the corner of the page, or it might be blown up too large on 300 dpi " +"printers. If you are experiencing such printing problems, you may want to " +"set the default printer resolution to a more appropriate value. See /usr/" +"share/doc/xprint-common/README.printing-problems.gz for more details." +msgstr "" +"Tuy nhiên, trên má»™t số máy in 1200 chấm/insÆ¡ nào đó, ảnh có thể hình nhÆ° bị " +"nén vào góc trang, hoặc nó có thể bị phóng to quá nhiá»u trên máy in 300 chấm/" +"insÆ¡. Gặp khó khăn in nhÆ° vậy thì bạn có thể muốn đặt Ä‘á»™ phân giải máy in " +"mặc định thành giá trị thích hợp hÆ¡n. Xem tập tin Äá»c Äi « /usr/share/doc/" +"xprint-common/README.printing-problems.gz » để tìm chi tiết." --- xorg-server-1.4.2.orig/debian/po/th.po +++ xorg-server-1.4.2/debian/po/th.po @@ -0,0 +1,47 @@ +# Thai translation for xorg-server +# Copyright (C) 2007 Software in the Public Interest, Inc. +# This file is distributed under the same license as the xorg-server package. +# Theppitak Karoonboonyanan , 2007. +# +msgid "" +msgstr "" +"Project-Id-Version: xorg-server\n" +"Report-Msgid-Bugs-To: debian-x@lists.debian.org\n" +"POT-Creation-Date: 2007-09-18 07:46+0200\n" +"PO-Revision-Date: 2007-09-18 13:54+0700\n" +"Last-Translator: Theppitak Karoonboonyanan \n" +"Language-Team: Thai \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "Default printer resolution:" +msgstr "ความละเอียดปริยายของเครื่องพิมพ์:" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"By default, Xprint assumes a printer resolution of 600 dpi. This should be " +"well suited for the majority of printers." +msgstr "" +"โดยปà¸à¸•à¸´ Xprint จะใช้ความละเอียด 600 dpi สำหรับเครื่องพิมพ์ ซึ่งน่าจะใช้ได้à¸à¸±à¸šà¹€à¸„รื่องพิมพ์ส่วนใหà¸à¹ˆ" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"On certain 1200 dpi printers, however, the image might appear squashed in " +"the corner of the page, or it might be blown up too large on 300 dpi " +"printers. If you are experiencing such printing problems, you may want to " +"set the default printer resolution to a more appropriate value. See /usr/" +"share/doc/xprint-common/README.printing-problems.gz for more details." +msgstr "" +"à¹à¸•à¹ˆà¸ªà¸³à¸«à¸£à¸±à¸šà¹€à¸„รื่องพิมพ์ 1200 dpi บางรุ่นà¹à¸¥à¹‰à¸§ ค่านี้อาจทำให้ภาพที่พิมพ์ออà¸à¸¡à¸²à¹€à¸¥à¸­à¸°à¸—ี่มุมหน้าà¸à¸£à¸°à¸”าษ " +"หรือถ้าเป็นเครื่องพิมพ์ 300 dpi à¸à¹‡à¸ˆà¸°à¹„ด้ภาพที่ใหà¸à¹ˆà¹€à¸à¸´à¸™à¹„ป ถ้าคุณพบปัà¸à¸«à¸²à¸à¸²à¸£à¸žà¸´à¸¡à¸žà¹Œà¸”ังà¸à¸¥à¹ˆà¸²à¸§ " +"คุณà¸à¹‡à¸­à¸²à¸ˆà¸à¸³à¸«à¸™à¸”ความละเอียดปริยายของเครื่องพิมพ์ให้เป็นค่าที่เหมาะสมได้ " +"à¸à¸£à¸¸à¸“าอ่านรายละเอียดเพิ่มเติมได้จาภ/usr/share/doc/xprint-common/README.printing-" +"problems.gz" --- xorg-server-1.4.2.orig/debian/po/gl.po +++ xorg-server-1.4.2/debian/po/gl.po @@ -0,0 +1,47 @@ +# Galician translation of xorg-server's debconf templates +# This file is distributed under the same license as the xorg-server package. +# Jacobo Tarrio , 2007. +# +msgid "" +msgstr "" +"Project-Id-Version: xorg-server\n" +"Report-Msgid-Bugs-To: debian-x@lists.debian.org\n" +"POT-Creation-Date: 2007-09-18 07:46+0200\n" +"PO-Revision-Date: 2007-09-30 18:53+0100\n" +"Last-Translator: Jacobo Tarrio \n" +"Language-Team: Galician \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "Default printer resolution:" +msgstr "Resolución de impresión por defecto:" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"By default, Xprint assumes a printer resolution of 600 dpi. This should be " +"well suited for the majority of printers." +msgstr "" +"Por defecto, Xprint supón unha resolución de impresión de 600 ppp. Este " +"valor é axeitado para a maioría das impresoras." + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"On certain 1200 dpi printers, however, the image might appear squashed in " +"the corner of the page, or it might be blown up too large on 300 dpi " +"printers. If you are experiencing such printing problems, you may want to " +"set the default printer resolution to a more appropriate value. See /usr/" +"share/doc/xprint-common/README.printing-problems.gz for more details." +msgstr "" +"Nembargantes, nalgunhas impresoras de 1200 ppp a imaxe pode aparecer " +"aplastada nunha esquina da páxina, ou pode aparecer grande de máis en " +"impresoras de 300 ppp. Se ten este tipo de problemas pode cambiar a " +"resolución de impresión a un valor máis axeitado. Consulte /usr/share/doc/" +"xprint-common/README.printing-problems.gz para ter máis detalles." --- xorg-server-1.4.2.orig/debian/po/ta.po +++ xorg-server-1.4.2/debian/po/ta.po @@ -0,0 +1,49 @@ +# translation of xorg-server.po to TAMIL +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Dr.T.Vasudevan , 2007. +msgid "" +msgstr "" +"Project-Id-Version: xorg-server\n" +"Report-Msgid-Bugs-To: debian-x@lists.debian.org\n" +"POT-Creation-Date: 2007-09-18 07:46+0200\n" +"PO-Revision-Date: 2007-09-18 13:59+0530\n" +"Last-Translator: Dr.T.Vasudevan \n" +"Language-Team: TAMIL \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.11.4\n" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "Default printer resolution:" +msgstr "à®®à¯à®©à¯à®©à®¿à®°à¯à®ªà¯à®ªà¯ அசà¯à®šà¯ இயநà¯à®¤à®¿à®° தௌதவà¯à®¤à¯à®¤à®¿à®±à®©à¯:" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"By default, Xprint assumes a printer resolution of 600 dpi. This should be " +"well suited for the majority of printers." +msgstr "" +"à®®à¯à®©à¯à®©à®¿à®°à¯à®ªà¯à®ªà®¾à®• எகà¯à®¸à¯ பà¯à®°à®¿à®©à¯à®Ÿà¯ அசà¯à®šà¯ இயநà¯à®¤à®¿à®° தௌதவà¯à®¤à¯à®¤à®¿à®±à®©à¯ ஆக 600 டிபி஠஠பà¯à®£à¯ˆà®¨à¯à®¤à¯ கொளà¯à®³à¯à®®à¯. " +"பெரà¯à®®à¯à®ªà®¾à®²à®¾à®© à®®à¯à®©à¯à®©à®¿à®°à¯à®ªà¯à®ªà¯ அசà¯à®šà¯ இயநà¯à®¤à®¿à®°à®™à¯à®•à®³à¯à®•à¯à®•à¯ இத௠சரியாகவே இரà¯à®•à¯à®•à¯à®®à¯." + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"On certain 1200 dpi printers, however, the image might appear squashed in " +"the corner of the page, or it might be blown up too large on 300 dpi " +"printers. If you are experiencing such printing problems, you may want to " +"set the default printer resolution to a more appropriate value. See /usr/" +"share/doc/xprint-common/README.printing-problems.gz for more details." +msgstr "" +"சில 1200 dpi அசà¯à®šà¯ இயநà¯à®¤à®¿à®°à®™à¯à®•à®³à®¿à®²à¯ பிமà¯à®ªà®®à¯ பகà¯à®•à®¤à¯à®¤à®¿à®©à¯ மூலைகளில௠நெரà¯à®•à¯à®•à®ªà¯à®ªà®Ÿà¯à®Ÿà¯ காணà¯à®®à¯. " +"அலà¯à®²à®¤à¯ 300 dpi இயநà¯à®¤à®¿à®°à®™à¯à®•à®³à®¿à®²à¯ மிகபà¯à®ªà¯†à®°à®¿à®¤à®¾à®• தெரியà¯à®®à¯. இபà¯à®ªà®Ÿà®¿à®ªà¯à®ªà®Ÿà¯à®Ÿ பிரசà¯à®šà®¿à®©à¯ˆà®•à®³à¯ வநà¯à®¤à®¾à®²à¯ " +"நீஙà¯à®•à®³à¯ சரியான à®®à¯à®©à¯à®©à®¿à®°à¯à®ªà¯à®ªà¯ அசà¯à®šà¯ இயநà¯à®¤à®¿à®° தௌதவà¯à®¤à¯à®¤à®¿à®±à®©à¯ ஠அமைகà¯à®• வேணà¯à®Ÿà¯à®®à¯. மேலà¯à®®à¯ " +"தகவலà¯à®•à®³à¯à®•à¯à®•à¯ /usr/share/doc/xprint-common/README.printing-problems.gz à® " +"பாரà¯à®•à¯à®•à®µà¯à®®à¯." --- xorg-server-1.4.2.orig/debian/po/sv.po +++ xorg-server-1.4.2/debian/po/sv.po @@ -0,0 +1,55 @@ +# Translators, if you are not familiar with the PO format, gettext +# documentation is worth reading, especially sections dedicated to +# this format, e.g. by running: +# info -n '(gettext)PO Files' +# info -n '(gettext)Header Entry' +# Some information specific to po-debconf are available at +# /usr/share/doc/po-debconf/README-trans +# or http://www.debian.org/intl/l10n/po-debconf/README-trans +# Developers do not need to manually edit POT or PO files. +# , fuzzy +# +# +msgid "" +msgstr "" +"Project-Id-Version: xorg-server\n" +"Report-Msgid-Bugs-To: debian-x@lists.debian.org\n" +"POT-Creation-Date: 2007-09-18 07:46+0200\n" +"PO-Revision-Date: 2007-09-18 11:08+0100\n" +"Last-Translator: Daniel Nylander \n" +"Language-Team: Swedish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=iso-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "Default printer resolution:" +msgstr "Standardupplösning för skrivare:" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"By default, Xprint assumes a printer resolution of 600 dpi. This should be " +"well suited for the majority of printers." +msgstr "" +"Som standard antar Xprint att skrivarupplösningen är 600 dpi. Detta borde " +"passa fint för de flesta av dagens skrivare." + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"On certain 1200 dpi printers, however, the image might appear squashed in " +"the corner of the page, or it might be blown up too large on 300 dpi " +"printers. If you are experiencing such printing problems, you may want to " +"set the default printer resolution to a more appropriate value. See /usr/" +"share/doc/xprint-common/README.printing-problems.gz for more details." +msgstr "" +"På vissa skrivare med 1200 dpi kan dock bilden verka hoptryckt i ett hörn av " +"sidan eller att den blir mycket förstorad på skrivare med 300 dpi. Om du " +"upplever sådana problem kan du ställa in standardskrivarens upplösning till " +"ett mer lämpligt värde. Se /usr/share/doc/xprint-common/README.printing-" +"problems.gz för mer information." --- xorg-server-1.4.2.orig/debian/po/ru.po +++ xorg-server-1.4.2/debian/po/ru.po @@ -0,0 +1,60 @@ +# translation of ru.po to Russian +# +# Translators, if you are not familiar with the PO format, gettext +# documentation is worth reading, especially sections dedicated to +# this format, e.g. by running: +# info -n '(gettext)PO Files' +# info -n '(gettext)Header Entry' +# Some information specific to po-debconf are available at +# /usr/share/doc/po-debconf/README-trans +# or http://www.debian.org/intl/l10n/po-debconf/README-trans# +# Developers do not need to manually edit POT or PO files. +# +# Yuri Kozlov , 2006, 2007. +msgid "" +msgstr "" +"Project-Id-Version: 2:1.3.0.0.dfsg-13\n" +"Report-Msgid-Bugs-To: debian-x@lists.debian.org\n" +"POT-Creation-Date: 2007-09-18 20:35+0200\n" +"PO-Revision-Date: 2007-09-24 20:33+0400\n" +"Last-Translator: Yuri Kozlov \n" +"Language-Team: Russian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.11.4\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%" +"10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "Default printer resolution:" +msgstr "Разрешение печати Ð´Ð»Ñ Ð¿Ñ€Ð¸Ð½Ñ‚ÐµÑ€Ð° по умолчанию:" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"By default, Xprint assumes a printer resolution of 600 dpi. This should be " +"well suited for the majority of printers." +msgstr "" +"По умолчанию, Xprint предполагает, что принтер имеет разрешение печати 600 " +"dpi. Это значение приемлемо Ð´Ð»Ñ Ð±Ð¾Ð»ÑŒÑˆÐ¸Ð½Ñтва принтеров." + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"On certain 1200 dpi printers, however, the image might appear squashed in " +"the corner of the page, or it might be blown up too large on 300 dpi " +"printers. If you are experiencing such printing problems, you may want to " +"set the default printer resolution to a more appropriate value. See /usr/" +"share/doc/xprint-common/README.printing-problems.gz for more details." +msgstr "" +"Однако, на принтерах Ñ Ñ€Ð°Ð·Ñ€ÐµÑˆÐµÐ½Ð¸ÐµÐ¼ печати 1200 dpi изображение может " +"оказатьÑÑ Ñжатым в углу Ñтраницы или может Ñтать Ñлишком большим на " +"принтерах Ñ Ñ€Ð°Ð·Ñ€ÐµÑˆÐµÐ½Ð¸ÐµÐ¼ печати 300 dpi. ЕÑли у Ð²Ð°Ñ Ð²Ð¾Ð·Ð½Ð¸ÐºÐ»Ð¸ подобные " +"проблемы Ñ Ð¿ÐµÑ‡Ð°Ñ‚ÑŒÑŽ, уÑтановите более подходÑщее значение Ð´Ð»Ñ Ñ€Ð°Ð·Ñ€ÐµÑˆÐµÐ½Ð¸Ñ " +"печати принтера по умолчанию. Ð”Ð¾Ð¿Ð¾Ð»Ð½Ð¸Ñ‚ÐµÐ»ÑŒÐ½Ð°Ñ Ð¸Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ Ð¿Ñ€ÐµÐ´Ñтавлена в " +"файле /usr/share/doc/xprint-common/README.printing-problems.gz." --- xorg-server-1.4.2.orig/debian/po/sk.po +++ xorg-server-1.4.2/debian/po/sk.po @@ -0,0 +1,43 @@ +msgid "" +msgstr "" +"Project-Id-Version: xorg-server 2:1.3.0.0.dfsg-12\n" +"Report-Msgid-Bugs-To: debian-x@lists.debian.org\n" +"POT-Creation-Date: 2007-09-18 20:35+0200\n" +"PO-Revision-Date: 2007-10-27 10:29+0100\n" +"Last-Translator: Ivan Masár \n" +"Language-Team: Slovak \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "Default printer resolution:" +msgstr "Å tandardné rozlíšenie tlaÄiarne:" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"By default, Xprint assumes a printer resolution of 600 dpi. This should be " +"well suited for the majority of printers." +msgstr "" +"Xprint Å¡tandardne predpokladá rozlíšenie tlaÄiarne 600 dpi. To by malo byÅ¥ v " +"poriadku pre väÄÅ¡inu dneÅ¡ných tlaÄiarní." + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"On certain 1200 dpi printers, however, the image might appear squashed in " +"the corner of the page, or it might be blown up too large on 300 dpi " +"printers. If you are experiencing such printing problems, you may want to " +"set the default printer resolution to a more appropriate value. See /usr/" +"share/doc/xprint-common/README.printing-problems.gz for more details." +msgstr "" +"Na istých tlaÄiarňach s 1200 dpi vÅ¡ak môže obraz vyzeraÅ¥ stlaÄený do rohu " +"stránky alebo na tlaÄiarňach s 300 dpi môže byÅ¥ natiahnutý. Ak máte takýto " +"problém, možno budete chcieÅ¥ zmeniÅ¥ Å¡tandardné rozlíšenie tlaÄiarne na " +"vhodnejÅ¡iu hodnotu. Viac informácií v /usr/share/doc/xprint-common/README." +"printing-problems.gz." --- xorg-server-1.4.2.orig/debian/po/templates.pot +++ xorg-server-1.4.2/debian/po/templates.pot @@ -0,0 +1,42 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: debian-x@lists.debian.org\n" +"POT-Creation-Date: 2007-09-18 20:35+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "Default printer resolution:" +msgstr "" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"By default, Xprint assumes a printer resolution of 600 dpi. This should be " +"well suited for the majority of printers." +msgstr "" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"On certain 1200 dpi printers, however, the image might appear squashed in " +"the corner of the page, or it might be blown up too large on 300 dpi " +"printers. If you are experiencing such printing problems, you may want to " +"set the default printer resolution to a more appropriate value. See /usr/" +"share/doc/xprint-common/README.printing-problems.gz for more details." +msgstr "" --- xorg-server-1.4.2.orig/debian/po/it.po +++ xorg-server-1.4.2/debian/po/it.po @@ -0,0 +1,49 @@ +# Italian (it) translation of debconf templates for xorg-server +# Copyright (C) 2007 Free Software Foundation, Inc. +# This file is distributed under the same license as the xorg-server package. +# Luca Monducci , 2007. +# +msgid "" +msgstr "" +"Project-Id-Version: xorg-server debconf templates\n" +"Report-Msgid-Bugs-To: debian-x@lists.debian.org\n" +"POT-Creation-Date: 2007-09-18 07:46+0200\n" +"PO-Revision-Date: 2007-09-21 21:26+0200\n" +"Last-Translator: Luca Monducci \n" +"Language-Team: Italian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "Default printer resolution:" +msgstr "Risoluzione predefinita della stampante:" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"By default, Xprint assumes a printer resolution of 600 dpi. This should be " +"well suited for the majority of printers." +msgstr "" +"Xprint assume che la risoluzione della stampante sia di 600 dpi. Questo " +"valore dovrebbe essere adatto alla maggior parte delle stampanti." + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"On certain 1200 dpi printers, however, the image might appear squashed in " +"the corner of the page, or it might be blown up too large on 300 dpi " +"printers. If you are experiencing such printing problems, you may want to " +"set the default printer resolution to a more appropriate value. See /usr/" +"share/doc/xprint-common/README.printing-problems.gz for more details." +msgstr "" +"Purtroppo su alcune stampanti a 1200 dpi l'immagine potrebbe apparire come " +"schiacciata in un angolo della pagina oppure potrebbe essere troppo " +"ingrandita su stampanti a 300 dpi. Nel caso si verificassero questi " +"problemi, si può impostare la risoluzione di stampa predefinita a un valore " +"più adatto. Si veda /usr/share/doc/xprint-common/README.printing-problems.gz " +"per maggiori dettagli." --- xorg-server-1.4.2.orig/debian/po/ro.po +++ xorg-server-1.4.2/debian/po/ro.po @@ -0,0 +1,48 @@ +# translation of xorg-server to Romanian +# Copyright (C) 2007 +# This file is distributed under the same license as the xorg-server package. +# +# Igor Stirbu , 2007. +msgid "" +msgstr "" +"Project-Id-Version: ro\n" +"Report-Msgid-Bugs-To: debian-x@lists.debian.org\n" +"POT-Creation-Date: 2007-09-18 07:46+0200\n" +"PO-Revision-Date: 2007-09-20 19:00+0300\n" +"Last-Translator: Igor Stirbu \n" +"Language-Team: Romanian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.11.4\n" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "Default printer resolution:" +msgstr "RezoluÈ›ia implicită a imprimantei:" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"By default, Xprint assumes a printer resolution of 600 dpi. This should be " +"well suited for the majority of printers." +msgstr "RezoluÈ›ia implicită folosită de Xprint este de 600 dpi (dots per inch – puncte per È›ol). Această valoare ar trebui să fie potrivită pentru majoritatea imprimantelor." + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"On certain 1200 dpi printers, however, the image might appear squashed in " +"the corner of the page, or it might be blown up too large on 300 dpi " +"printers. If you are experiencing such printing problems, you may want to " +"set the default printer resolution to a more appropriate value. See /usr/" +"share/doc/xprint-common/README.printing-problems.gz for more details." +msgstr "TotuÈ™i, pe anumite imprimante cu rezoluÈ›ia de 1200 dpi, ar putea să tipărească " +"imaginea înghesuită în colÈ›ul paginii, sau, în cazul celor cu rezoluÈ›ia de 300 dpi, ar putea să fie " +"întinsă peste dimensiunile normale. Dacă întâmpinaÈ›i asemenea probleme, " +"puteÈ›i încerca să schimbaÈ›i valoarea implicită a rezoluÈ›iei imprimantei. A se vedea " +"/usr/share/doc/xprint-common/README.printing-problems.gz " +"pentru mai multe detalii." + --- xorg-server-1.4.2.orig/debian/po/he.po +++ xorg-server-1.4.2/debian/po/he.po @@ -0,0 +1,48 @@ +# translation of templates.po to Hebrew +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Lior Kaplan , 2007. +msgid "" +msgstr "" +"Project-Id-Version: templates\n" +"Report-Msgid-Bugs-To: debian-x@lists.debian.org\n" +"POT-Creation-Date: 2007-09-18 07:46+0200\n" +"PO-Revision-Date: 2007-09-19 18:35+0200\n" +"Last-Translator: Lior Kaplan \n" +"Language-Team: Hebrew \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.11.4\n" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "Default printer resolution:" +msgstr "רזולוציה ברית מחדל של המדפסת:" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"By default, Xprint assumes a printer resolution of 600 dpi. This should be " +"well suited for the majority of printers." +msgstr "" +"כברירת מחדל, Xprint מניחה על רזולוציית המדפסת ×”×™× 600 dpi. ערך ×–×” צריך " +"להת××™× ×”×™×˜×‘ לרוב המדפסות." + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"On certain 1200 dpi printers, however, the image might appear squashed in " +"the corner of the page, or it might be blown up too large on 300 dpi " +"printers. If you are experiencing such printing problems, you may want to " +"set the default printer resolution to a more appropriate value. See /usr/" +"share/doc/xprint-common/README.printing-problems.gz for more details." +msgstr "" +"עבור מספר מדפסות 1200 dpi, התמונה עלולה להופיע מעוכה בפינת הדף, ×ו ×©×”×™× " +"תופיע בהגדלה רבה מידי במדפסות 300 dpi. ×× ×™×©× ×Ÿ ×›×לה בעיות, כד××™ לקבוע ×ת ערך " +"רזולוציית ברירת המחדל לערך מת××™× ×™×•×ª×¨. ×¤×¨×˜×™× × ×•×¡×¤×™× ×™×©× × ×‘×§×•×‘×¥ /usr/share/" +"doc/xprint-common/README.printing-problems.gz" --- xorg-server-1.4.2.orig/debian/po/fr.po +++ xorg-server-1.4.2/debian/po/fr.po @@ -0,0 +1,61 @@ +# translation of fr.po to French +# +# Translators, if you are not familiar with the PO format, gettext +# documentation is worth reading, especially sections dedicated to +# this format, e.g. by running: +# info -n '(gettext)PO Files' +# info -n '(gettext)Header Entry' +# +# Some information specific to po-debconf are available at +# /usr/share/doc/po-debconf/README-trans +# or http://www.debian.org/intl/l10n/po-debconf/README-trans +# +# Developers do not need to manually edit POT or PO files. +# +# Christian Perrier , 2007. +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: debian-x@lists.debian.org\n" +"POT-Creation-Date: 2007-09-18 07:46+0200\n" +"PO-Revision-Date: 2007-09-18 07:47+0200\n" +"Last-Translator: Christian Perrier \n" +"Language-Team: French \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.11.4\n" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "Default printer resolution:" +msgstr "Résolution par défaut de l'imprimante :" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"By default, Xprint assumes a printer resolution of 600 dpi. This should be " +"well suited for the majority of printers." +msgstr "" +"Par défaut, XPrint utilise une résolution d'impression de 600 ppp (points " +"par pouce ou « dpi »). Cette valeur convient pour la majorité des " +"imprimantes actuelles." + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"On certain 1200 dpi printers, however, the image might appear squashed in " +"the corner of the page, or it might be blown up too large on 300 dpi " +"printers. If you are experiencing such printing problems, you may want to " +"set the default printer resolution to a more appropriate value. See /usr/" +"share/doc/xprint-common/README.printing-problems.gz for more details." +msgstr "" +"Cependant, un document préparé en 600 ppp apparaîtra trop gros sur une " +"imprimante dont la résolution est de 300 ppp ou trop petit (un quart de page " +"occupée) sur une imprimante à 1200 ppp. Si vous rencontrez ce type de " +"problèmes, vous devriez choisir une valeur plus adaptée comme résolution " +"d'impression. Veuillez consulter le fichier /usr/share/doc/xprint-common/" +"README.printing-problems.gz pour plus d'informations." --- xorg-server-1.4.2.orig/debian/po/es.po +++ xorg-server-1.4.2/debian/po/es.po @@ -0,0 +1,61 @@ +# +# +# +msgid "" +msgstr "" +"Project-Id-Version: xprint-es\n" +"Report-Msgid-Bugs-To: debian-x@lists.debian.org\n" +"POT-Creation-Date: 2007-09-18 20:35+0200\n" +"PO-Revision-Date: 2006-12-13 23:22+0100\n" +"Last-Translator: Fernando Cerezal López \n" +"Language-Team: Spanish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +#, fuzzy +#| msgid "Default printer resolution" +msgid "Default printer resolution:" +msgstr "Resolución predeterminada de la impresora" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +#, fuzzy +#| msgid "" +#| "By default Xprint assumes a printer resolution of 600dpi. This should be " +#| "fine for the majority of printers today." +msgid "" +"By default, Xprint assumes a printer resolution of 600 dpi. This should be " +"well suited for the majority of printers." +msgstr "" +"Por omisión, Xprint asume una resolución de impresión de 600 ppp. Esto " +"debería estar bien para la mayoría de las impresoras actuales." + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +#, fuzzy +#| msgid "" +#| "On certain 1200dpi printers, however, the image might appear squashed in " +#| "the corner of the page, or it might be blown up too large on 300dpi " +#| "printers. If you are experiencing these kinds of printing problems, you " +#| "may want to set the default printer resolution to a more appropriate " +#| "value. See /usr/share/doc/xprint-common/README.printing-problems.gz for " +#| "more details." +msgid "" +"On certain 1200 dpi printers, however, the image might appear squashed in " +"the corner of the page, or it might be blown up too large on 300 dpi " +"printers. If you are experiencing such printing problems, you may want to " +"set the default printer resolution to a more appropriate value. See /usr/" +"share/doc/xprint-common/README.printing-problems.gz for more details." +msgstr "" +"Sin embargo, en ciertas impresoras de 1200 ppp, la imagen puede parecer " +"aplastada en la esquina de la página, o puede parecer demasiado hinchada en " +"impresoras de 300 ppp. Si experimenta este tipo de problemas de impresión, " +"puede que quiera establecer la resolución predeterminada de la impresora a " +"un valor más apropiado. Véase «/usr/share/doc/xprint-common/README.printing-" +"problems.gz» para obtener más detalles." --- xorg-server-1.4.2.orig/debian/po/pt_BR.po +++ xorg-server-1.4.2/debian/po/pt_BR.po @@ -0,0 +1,85 @@ +# portmap Brazilian Portuguese translation +# Copyright (C) 2007 THE portmap'S COPYRIGHT HOLDER +# This file is distributed under the same license as the portmap package. +# Felipe Augusto van de Wiel (faw) , 2007. +# Eder L. Marques (frolic) , 2007. +# +msgid "" +msgstr "" +"Project-Id-Version: portmap 6.0-2\n" +"Report-Msgid-Bugs-To: debian-x@lists.debian.org\n" +"POT-Creation-Date: 2007-09-18 20:35+0200\n" +"PO-Revision-Date: 2007-10-03 17:17-0300\n" +"Last-Translator: Eder L. Marques (frolic) \n" +"Language-Team: l10n Portuguese \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"pt_BR utf-8\n" +"X-Generator: KBabel 1.11.4\n" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "Default printer resolution:" +msgstr "" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"By default, Xprint assumes a printer resolution of 600 dpi. This should be " +"well suited for the majority of printers." +msgstr "" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"On certain 1200 dpi printers, however, the image might appear squashed in " +"the corner of the page, or it might be blown up too large on 300 dpi " +"printers. If you are experiencing such printing problems, you may want to " +"set the default printer resolution to a more appropriate value. See /usr/" +"share/doc/xprint-common/README.printing-problems.gz for more details." +msgstr "" + +#~ msgid "Should portmap be bound to the loopback address?" +#~ msgstr "O portmap deveria escutar somente no endereço de loopback?" + +#~| msgid "" +#~| "Portmap by default listens to all IP addresses. However, if you are not " +#~| "providing network RPC services to remote clients (you are if you are " +#~| "setting up a NFS or NIS server) you can safely bind it to the loopback " +#~| "IP address (127.0.0.1)" +#~ msgid "" +#~ "By default, portmap listens to all IP addresses. However, if this machine " +#~ "does not provide network RPC services (such as NIS or NFS) to remote " +#~ "clients, you can safely bind it to the loopback IP address (127.0.0.1)." +#~ msgstr "" +#~ "Por padrão, o portmap escuta em todos os endereços IP. Entretanto, se " +#~ "esta máquina não provê serviços de rede RPC (como NIS ou NFS) para " +#~ "clientes remotos, você pode, com segurança, restringí-lo somente ao " +#~ "endereço IP de loopback (127.0.0.1)." + +#~| msgid "" +#~| "This will allow RPC local services (like FAM) to work properly, while " +#~| "preventing remote systems from accessing your RPC services." +#~ msgid "" +#~ "This will allow RPC local services (like FAM) to work properly, while " +#~ "preventing remote systems from accessing the RPC services." +#~ msgstr "" +#~ "Isto permitirá que serviços RPC locais (como o FAM) funcionem " +#~ "corretamente, enquanto previne que sistemas remotos acessem os serviços " +#~ "RPC." + +#~| msgid "" +#~| "You can also change this configuration by editing the OPTIONS line in " +#~| "the /etc/default/portmap file. If you just don't specify the -i option " +#~| "it will bind to all interfaces." +#~ msgid "" +#~ "This configuration can be changed by editing the OPTIONS line in the /etc/" +#~ "default/portmap file and adapting the use of the -i option to your needs." +#~ msgstr "" +#~ "Esta configuração pode ser alterada editando a linha OPTIONS no arquivo /" +#~ "etc/default/portmap e adaptando o uso da opção -i para as suas " +#~ "necessidades." --- xorg-server-1.4.2.orig/debian/po/POTFILES.in +++ xorg-server-1.4.2/debian/po/POTFILES.in @@ -0,0 +1 @@ +[type: gettext/rfc822deb] xprint-common.templates --- xorg-server-1.4.2.orig/debian/po/ja.po +++ xorg-server-1.4.2/debian/po/ja.po @@ -0,0 +1,58 @@ +# +# Translators, if you are not familiar with the PO format, gettext +# documentation is worth reading, especially sections dedicated to +# this format, e.g. by running: +# info -n '(gettext)PO Files' +# info -n '(gettext)Header Entry' +# +# Some information specific to po-debconf are available at +# /usr/share/doc/po-debconf/README-trans +# or http://www.debian.org/intl/l10n/po-debconf/README-trans +# +# Developers do not need to manually edit POT or PO files. +# +# +msgid "" +msgstr "" +"Project-Id-Version: xorg-server 2:1.4.1~git20080118-1\n" +"Report-Msgid-Bugs-To: debian-x@lists.debian.org\n" +"POT-Creation-Date: 2007-09-18 20:35+0200\n" +"PO-Revision-Date: 2008-01-27 19:52+0900\n" +"Last-Translator: Hideki Yamane (Debian-JP) \n" +"Language-Team: Japanese \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "Default printer resolution:" +msgstr "デフォルトã®ãƒ—リンタ解åƒåº¦:" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"By default, Xprint assumes a printer resolution of 600 dpi. This should be " +"well suited for the majority of printers." +msgstr "" +"デフォルトã§ã¯ã€Xprint ã¯ãƒ—リンタã®è§£åƒåº¦ã‚’ 600dpi ã¨ã—ã¦ã„ã¾ã™ã€‚ã»ã¨ã‚“ã©ã®ãƒ—リン" +"ã‚¿ã§ã¯ã€ã»ã¨ã‚“ã©ã“ã®å€¤ã§è‰¯ã„ã§ã—ょã†ã€‚" + +#. Type: string +#. Description +#: ../xprint-common.templates:2001 +msgid "" +"On certain 1200 dpi printers, however, the image might appear squashed in " +"the corner of the page, or it might be blown up too large on 300 dpi " +"printers. If you are experiencing such printing problems, you may want to " +"set the default printer resolution to a more appropriate value. See /usr/" +"share/doc/xprint-common/README.printing-problems.gz for more details." +msgstr "" +"ã—ã‹ã—ã€1200dpi 固定ã®ãƒ—リンタã§ã¯å°åˆ·ã•ã‚ŒãŸç”»åƒã¯ãƒšãƒ¼ã‚¸ã®éš…ã«è©°ã‚ã¦å°åˆ·ã•ã‚Œ" +"ã¦ã—ã¾ã„ã¾ã™ã—ã€300dpi ã®ãƒ—リンタã§ã¯å¤§ãããªã‚Šã™ãŽã¦ã—ã¾ã„ã¾ã™ã€‚ã“ã®æ§˜ãªå°åˆ·" +"時ã®å•é¡Œã«é­é‡ã—ãŸå ´åˆã€ãƒ—リンタã®è§£åƒåº¦ã‚’よりé©åˆ‡ãªå€¤ã«å¤‰æ›´ã—ãŸããªã‚‹ã§ã—ょã†ã€‚" +"詳細ã«ã¤ã„ã¦ã¯ã€/usr/share/doc/xprint-common/README.printing-problems.gz " +"ã‚’å‚ç…§ã—ã¦ãã ã•ã„。" + --- xorg-server-1.4.2.orig/debian/xsfbs/xsfbs.mk +++ xorg-server-1.4.2/debian/xsfbs/xsfbs.mk @@ -0,0 +1,293 @@ +#!/usr/bin/make -f + +# Debian X Strike Force Build System (XSFBS): Make portion + +# Copyright 1996 Stephen Early +# Copyright 1997 Mark Eichin +# Copyright 1998-2005, 2007 Branden Robinson +# Copyright 2005 David Nusinow +# +# Licensed under the GNU General Public License, version 2. See the file +# /usr/share/common-licenses/GPL or . + +# Originally by Stephen Early +# Modified by Mark W. Eichin +# Modified by Adam Heath +# Modified by Branden Robinson +# Modified by Fabio Massimo Di Nitto +# Modified by David Nusinow +# Acknowledgements to Manoj Srivastava. + +# Pass $(DH_OPTIONS) into the environment for debhelper's benefit. +export DH_OPTIONS + +# force quilt to not use ~/.quiltrc and to use debian/patches +QUILT = QUILT_PATCHES=debian/patches quilt --quiltrc /dev/null + +# Set up parameters for the upstream build environment. + +# Determine (source) package name from Debian changelog. +SOURCE_NAME:=$(shell dpkg-parsechangelog -ldebian/changelog \ + | grep '^Source:' | awk '{print $$2}') + +# Determine package version from Debian changelog. +SOURCE_VERSION:=$(shell dpkg-parsechangelog -ldebian/changelog \ + | grep '^Version:' | awk '{print $$2}') + +# Determine upstream version number. +UPSTREAM_VERSION:=$(shell echo $(SOURCE_VERSION) | sed 's/-.*//') + +# Determine the source version without the epoch for make-orig-tar-gz +NO_EPOCH_VER:=$(shell echo $(UPSTREAM_VERSION) | sed 's/^.://') + +# Figure out who's building this package. +BUILDER:=$(shell echo $${DEBEMAIL:-$${EMAIL:-$$(echo $$LOGNAME@$$(cat /etc/mailname 2>/dev/null))}}) + +# Find out if this is an official build; an official build has nothing but +# digits, dots, and/or the codename of a release in the Debian part of the +# version number. Anything else indicates an unofficial build. +OFFICIAL_BUILD:=$(shell VERSION=$(SOURCE_VERSION); if ! expr "$$(echo $${VERSION\#\#*-} | sed 's/\(woody\|sarge\|etch\|lenny\)//g')" : ".*[^0-9.].*" >/dev/null 2>&1; then echo yes; fi) + +# Set up parameters for the Debian build environment. + +# Determine our architecture. +BUILD_ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH) +# Work around some old-time dpkg braindamage. +BUILD_ARCH:=$(subst i486,i386,$(BUILD_ARCH)) +# The DEB_HOST_ARCH variable may be set per the Debian cross-compilation policy. +ifdef DEB_HOST_ARCH + ARCH:=$(DEB_HOST_ARCH) +else + # dpkg-cross sets the ARCH environment variable; if set, use it. + ifdef ARCH + ARCH:=$(ARCH) + else + ARCH:=$(BUILD_ARCH) + endif +endif + +# $(STAMP_DIR) houses stamp files for complex targets. +STAMP_DIR:=stampdir + +# $(DEBTREEDIR) is where all install rules are told (via $(DESTDIR)) to place +# their files. +DEBTREEDIR:=$(CURDIR)/debian/tmp + +# All "important" targets have four lines: +# 1) A target name that is invoked by a package-building tool or the user. +# This consists of a dependency on a "$(STAMP_DIR)/"-prefixed counterpart. +# 2) A line delcaring 1) as a phony target (".PHONY:"). +# 3) A "$(STAMP_DIR)/"-prefixed target which does the actual work, and may +# depend on other targets. +# 4) A line declaring 3) as a member of the $(stampdir_targets) variable; the +# "$(STAMP_DIR)/" prefix is omitted. +# +# This indirection is needed so that the "stamp" files that signify when a rule +# is done can be located in a separate "stampdir". Recall that make has no way +# to know when a goal has been met for a phony target (like "build" or +# "install"). +# +# At the end of each "$(STAMP_DIR)/" target, be sure to run the command ">$@" +# so that the target will not be run again. Removing the file will make Make +# run the target over. + +# All phony targets should be declared as dependencies of .PHONY, even if they +# do not have "($STAMP_DIR)/"-prefixed counterparts. + +# Define a harmless default rule to keep things from going nuts by accident. +.PHONY: default +default: + +# Set up the $(STAMP_DIR) directory. +.PHONY: stampdir +stampdir_targets+=stampdir +stampdir: $(STAMP_DIR)/stampdir +$(STAMP_DIR)/stampdir: + mkdir $(STAMP_DIR) + >$@ + +# Set up the package build directory as quilt expects to find it. +.PHONY: prepare +stampdir_targets+=prepare +prepare: $(STAMP_DIR)/prepare +$(STAMP_DIR)/prepare: $(STAMP_DIR)/log $(STAMP_DIR)/genscripts + >$@ + +.PHONY: log +stampdir_targets+=log +log: $(STAMP_DIR)/log +$(STAMP_DIR)/log: $(STAMP_DIR)/stampdir + mkdir -p $(STAMP_DIR)/log + +# Apply all patches to the upstream source. +.PHONY: patch +stampdir_targets+=patch +patch: $(STAMP_DIR)/patch +$(STAMP_DIR)/patch: $(STAMP_DIR)/prepare + if ! [ `which quilt` ]; then \ + echo "Couldn't find quilt. Please install it or add it to the build-depends for this package."; \ + exit 1; \ + fi; \ + if $(QUILT) next >/dev/null 2>&1; then \ + echo -n "Applying patches..."; \ + if $(QUILT) push -a -v >$(STAMP_DIR)/log/patch 2>&1; then \ + cat $(STAMP_DIR)/log/patch; \ + echo "successful."; \ + else \ + cat $(STAMP_DIR)/log/patch; \ + echo "failed! (check $(STAMP_DIR)/log/patch for details)"; \ + exit 1; \ + fi; \ + else \ + echo "No patches to apply"; \ + fi; \ + >$@ + +# Revert all patches to the upstream source. +.PHONY: unpatch +unpatch: $(STAMP_DIR)/log + rm -f $(STAMP_DIR)/patch + @echo -n "Unapplying patches..."; \ + if $(QUILT) applied >/dev/null 2>/dev/null; then \ + if $(QUILT) pop -a -v >$(STAMP_DIR)/log/unpatch 2>&1; then \ + cat $(STAMP_DIR)/log/unpatch; \ + echo "successful."; \ + else \ + cat $(STAMP_DIR)/log/unpatch; \ + echo "failed! (check $(STAMP_DIR)/log/unpatch for details)"; \ + exit 1; \ + fi; \ + else \ + echo "nothing to do."; \ + fi + +# Clean the generated maintainer scripts. +.PHONY: cleanscripts +cleanscripts: + rm -f $(STAMP_DIR)/genscripts + rm -f debian/*.config \ + debian/*.postinst \ + debian/*.postrm \ + debian/*.preinst \ + debian/*.prerm + +# Clean the package build tree. +.PHONY: xsfclean +xsfclean: cleanscripts unpatch + dh_testdir + rm -rf .pc + rm -rf $(STAMP_DIR) $(SOURCE_DIR) + rm -rf imports + dh_clean debian/shlibs.local \ + debian/po/pothead + +# Generate the debconf templates POT file header. +debian/po/pothead: debian/po/pothead.in + sed -e 's/SOURCE_VERSION/$(SOURCE_VERSION)/' \ + -e 's/DATE/$(shell date "+%F %X%z"/)' <$< >$@ + +# Update POT and PO files. +.PHONY: updatepo +updatepo: debian/po/pothead + debian/scripts/debconf-updatepo --pot-header=pothead --verbose + +# Remove files from the upstream source tree that we don't need, or which have +# licensing problems. It must be run before creating the .orig.tar.gz. +# +# Note: This rule is for Debian package maintainers' convenience, and is not +# needed for conventional build scenarios. +.PHONY: prune-upstream-tree +prune-upstream-tree: + # Ensure we're in the correct directory. + dh_testdir + grep -rvh '^#' debian/prune/ | xargs --no-run-if-empty rm -rf + +# Verify that there are no offsets or fuzz in the patches we apply. +# +# Note: This rule is for Debian package maintainers' convenience, and is not +# needed for conventional build scenarios. +.PHONY: patch-audit +patch-audit: prepare unpatch + @echo -n "Auditing patches..."; \ + >$(STAMP_DIR)/log/patch; \ + FUZZY=; \ + while [ -n "$$($(QUILT) next)" ]; do \ + RESULT=$$($(QUILT) push -v | tee -a $(STAMP_DIR)/log/patch | grep ^Hunk | sed 's/^Hunk.*\(succeeded\|FAILED\).*/\1/');\ + case "$$RESULT" in \ + succeeded) \ + echo "fuzzy patch: $$($(QUILT) top)" \ + | tee -a $(STAMP_DIR)/log/$$($(QUILT) top); \ + FUZZY=yes; \ + ;; \ + FAILED) \ + echo "broken patch: $$($(QUILT) next)" \ + | tee -a $(STAMP_DIR)/log/$$($(QUILT) next); \ + exit 1; \ + ;; \ + esac; \ + done; \ + if [ -n "$$FUZZY" ]; then \ + echo "there were fuzzy patches; please fix."; \ + exit 1; \ + else \ + echo "done."; \ + fi + +# Generate the maintainer scripts. +.PHONY: genscripts +stampdir_targets+=genscripts +genscripts: $(STAMP_DIR)/genscripts +$(STAMP_DIR)/genscripts: $(STAMP_DIR)/stampdir + for FILE in debian/*.config.in \ + debian/*.postinst.in \ + debian/*.postrm.in \ + debian/*.preinst.in \ + debian/*.prerm.in; do \ + if [ -e "$$FILE" ]; then \ + MAINTSCRIPT=$$(echo $$FILE | sed 's/.in$$//'); \ + sed -n '1,/^#INCLUDE_SHELL_LIB#$$/p' <$$FILE \ + | sed -e '/^#INCLUDE_SHELL_LIB#$$/d' >$$MAINTSCRIPT.tmp; \ + cat debian/xsfbs/xsfbs.sh >>$$MAINTSCRIPT.tmp; \ + sed -n '/^#INCLUDE_SHELL_LIB#$$/,$$p' <$$FILE \ + | sed -e '/^#INCLUDE_SHELL_LIB#$$/d' >>$$MAINTSCRIPT.tmp; \ + sed -e 's/@SOURCE_VERSION@/$(SOURCE_VERSION)/' \ + -e 's/@OFFICIAL_BUILD@/$(OFFICIAL_BUILD)/' \ + -e 's/@DEFAULT_DCRESOLUTIONS@/$(DEFAULT_DCRESOLUTIONS)/' \ + <$$MAINTSCRIPT.tmp >$$MAINTSCRIPT; \ + rm $$MAINTSCRIPT.tmp; \ + fi; \ + done + # Validate syntax of generated shell scripts. + #sh debian/scripts/validate-posix-sh debian/*.config \ + # debian/*.postinst \ + # debian/*.postrm \ + # debian/*.preinst \ + # debian/*.prerm + >$@ + +# Generate the shlibs.local file. +debian/shlibs.local: + cat debian/*.shlibs >$@ + +SERVERMINVERS = $(shell cat /usr/share/xserver-xorg/serverminver 2>/dev/null) +VIDEOABI = $(shell cat /usr/share/xserver-xorg/videoabiver 2>/dev/null) +INPUTABI = $(shell cat /usr/share/xserver-xorg/inputabiver 2>/dev/null) +SERVER_DEPENDS = xserver-xorg-core (>= $(SERVERMINVERS)) +VIDDRIVER_PROVIDES = xserver-xorg-video-$(VIDEOABI) +INPDRIVER_PROVIDES = xserver-xorg-input-$(INPUTABI) +ifeq ($(PACKAGE),) +PACKAGE=$(shell awk '/^Package:/ { print $$2; exit }' < debian/control) +endif + +.PHONY: serverabi +serverabi: install +ifeq ($(SERVERMINVERS),) + @echo error: xserver-xorg-dev needs to be installed + @exit 1 +else + echo "xserver:Depends=$(SERVER_DEPENDS)" >> debian/$(PACKAGE).substvars + echo "xviddriver:Provides=$(VIDDRIVER_PROVIDES)" >> debian/$(PACKAGE).substvars + echo "xinpdriver:Provides=$(INPDRIVER_PROVIDES)" >> debian/$(PACKAGE).substvars +endif + +# vim:set noet ai sts=8 sw=8 tw=0: --- xorg-server-1.4.2.orig/debian/xsfbs/xsfbs.sh +++ xorg-server-1.4.2/debian/xsfbs/xsfbs.sh @@ -0,0 +1,931 @@ +# $Id$ + +# This is the X Strike Force shell library for X Window System package +# maintainer scripts. It serves to define shell functions commonly used by +# such packages, and performs some error checking necessary for proper operation +# of those functions. By itself, it does not "do" much; the maintainer scripts +# invoke the functions defined here to accomplish package installation and +# removal tasks. + +# If you are reading this within a Debian package maintainer script (e.g., +# /var/lib/dpkg)info/PACKAGE.{config,preinst,postinst,prerm,postrm}), you can +# skip past this library by scanning forward in this file to the string +# "GOBSTOPPER". + +SOURCE_VERSION=@SOURCE_VERSION@ +OFFICIAL_BUILD=@OFFICIAL_BUILD@ + +# Use special abnormal exit codes so that problems with this library are more +# easily tracked down. +SHELL_LIB_INTERNAL_ERROR=86 +SHELL_LIB_THROWN_ERROR=74 +SHELL_LIB_USAGE_ERROR=99 + +# old -> new variable names +if [ -z "$DEBUG_XORG_PACKAGE" ] && [ -n "$DEBUG_XFREE86_PACKAGE" ]; then + DEBUG_XORG_PACKAGE="$DEBUG_XFREE86_PACKAGE" +fi +if [ -z "$DEBUG_XORG_DEBCONF" ] && [ -n "$DEBUG_XFREE86_DEBCONF" ]; then + DEBUG_XORG_DEBCONF="$DEBUG_XFREE86_DEBCONF" +fi + +# initial sanity checks +if [ -z "$THIS_PACKAGE" ]; then + cat >&2 < on the World Wide Web for +instructions, read the file /usr/share/doc/debian/bug-reporting.txt from the +"doc-debian" package, or install the "reportbug" package and use the command of +the same name to file a report against version $SOURCE_VERSION of this package. +EOF + exit $SHELL_LIB_USAGE_ERROR +fi + +if [ -z "$THIS_SCRIPT" ]; then + cat >&2 < on the World Wide Web for +instructions, read the file /usr/share/doc/debian/bug-reporting.txt from the +"doc-debian" package, or install the "reportbug" package and use the command of +the same name to file a report against version $SOURCE_VERSION of the +"$THIS_PACKAGE" package. +EOF + exit $SHELL_LIB_USAGE_ERROR +fi + +ARCHITECTURE="$(dpkg --print-installation-architecture)" + +if [ "$1" = "reconfigure" ] || [ -n "$DEBCONF_RECONFIGURE" ]; then + RECONFIGURE="true" +else + RECONFIGURE= +fi + +if ([ "$1" = "install" ] || [ "$1" = "configure" ]) && [ -z "$2" ]; then + FIRSTINST="yes" +fi + +if [ -z "$RECONFIGURE" ] && [ -z "$FIRSTINST" ]; then + UPGRADE="yes" +fi + +trap "message;\ + message \"Received signal. Aborting $THIS_PACKAGE package $THIS_SCRIPT script.\";\ + message;\ + exit 1" HUP INT QUIT TERM + +reject_nondigits () { + # syntax: reject_nondigits [ operand ... ] + # + # scan operands (typically shell variables whose values cannot be trusted) for + # characters other than decimal digits and barf if any are found + while [ -n "$1" ]; do + # does the operand contain anything but digits? + if ! expr "$1" : "[[:digit:]]\+$" > /dev/null 2>&1; then + # can't use die(), because it wraps message() which wraps this function + echo "$THIS_PACKAGE $THIS_SCRIPT error: reject_nondigits() encountered" \ + "possibly malicious garbage \"$1\"" >&2 + exit $SHELL_LIB_THROWN_ERROR + fi + shift + done +} + +reject_whitespace () { + # syntax: reject_whitespace [ operand ] + # + # scan operand (typically a shell variable whose value cannot be trusted) for + # whitespace characters and barf if any are found + if [ -n "$1" ]; then + # does the operand contain any whitespace? + if expr "$1" : "[[:space:]]" > /dev/null 2>&1; then + # can't use die(), because I want to avoid forward references + echo "$THIS_PACKAGE $THIS_SCRIPT error: reject_whitespace() encountered" \ + "possibly malicious garbage \"$1\"" >&2 + exit $SHELL_LIB_THROWN_ERROR + fi + fi +} + +reject_unlikely_path_chars () { + # syntax: reject_unlikely_path_chars [ operand ... ] + # + # scan operands (typically shell variables whose values cannot be trusted) for + # characters unlikely to be seen in a path and which the shell might + # interpret and barf if any are found + while [ -n "$1" ]; do + # does the operand contain any funny characters? + if expr "$1" : '.*[!$&()*;<>?|].*' > /dev/null 2>&1; then + # can't use die(), because I want to avoid forward references + echo "$THIS_PACKAGE $THIS_SCRIPT error: reject_unlikely_path_chars()" \ + "encountered possibly malicious garbage \"$1\"" >&2 + exit $SHELL_LIB_THROWN_ERROR + fi + shift + done +} + +# Query the terminal to establish a default number of columns to use for +# displaying messages to the user. This is used only as a fallback in the +# event the COLUMNS variable is not set. ($COLUMNS can react to SIGWINCH while +# the script is running, and this cannot, only being calculated once.) +DEFCOLUMNS=$(stty size 2> /dev/null | awk '{print $2}') || true +if ! expr "$DEFCOLUMNS" : "[[:digit:]]\+$" > /dev/null 2>&1; then + DEFCOLUMNS=80 +fi + +message () { + # pretty-print messages of arbitrary length + reject_nondigits "$COLUMNS" + echo "$*" | fmt -t -w ${COLUMNS:-$DEFCOLUMNS} >&2 +} + +observe () { + # syntax: observe message ... + # + # issue observational message suitable for logging someday when support for + # it exists in dpkg + if [ -n "$DEBUG_XORG_PACKAGE" ]; then + message "$THIS_PACKAGE $THIS_SCRIPT note: $*" + fi +} + +warn () { + # syntax: warn message ... + # + # issue warning message suitable for logging someday when support for + # it exists in dpkg; also send to standard error + message "$THIS_PACKAGE $THIS_SCRIPT warning: $*" +} + +die () { + # syntax: die message ... + # + # exit script with error message + message "$THIS_PACKAGE $THIS_SCRIPT error: $*" + exit $SHELL_LIB_THROWN_ERROR +} + +internal_error () { + # exit script with error; essentially a "THIS SHOULD NEVER HAPPEN" message + message "internal error: $*" + if [ -n "$OFFICIAL_BUILD" ]; then + message "Please report a bug in the $THIS_SCRIPT script of the" \ + "$THIS_PACKAGE package, version $SOURCE_VERSION to the Debian Bug" \ + "Tracking System. Include all messages above that mention the" \ + "$THIS_PACKAGE package. Visit " \ + " on the World Wide Web for" \ + "instructions, read the file" \ + "/usr/share/doc/debian/bug-reporting.txt from the doc-debian" \ + "package, or install the reportbug package and use the command of" \ + "the same name to file a report." + fi + exit $SHELL_LIB_INTERNAL_ERROR +} + +usage_error () { + message "usage error: $*" + message "Please report a bug in the $THIS_SCRIPT script of the" \ + "$THIS_PACKAGE package, version $SOURCE_VERSION to the Debian Bug" \ + "Tracking System. Include all messages above that mention the" \ + "$THIS_PACKAGE package. Visit " \ + " on the World Wide Web for" \ + "instructions, read the file" \ + "/usr/share/doc/debian/bug-reporting.txt from the doc-debian" \ + "package, or install the reportbug package and use the command of" \ + "the same name to file a report." + exit $SHELL_LIB_USAGE_ERROR +} + + +maplink () { + # returns what symlink should point to; i.e., what the "sane" answer is + # Keep this in sync with the debian/*.links files. + # This is only needed for symlinks to directories. + # + # XXX: Most of these look wrong in the X11R7 world and need to be fixed. + # If we've stopped using this function, fixing it might enable us to re-enable + # it again and catch more errors. + case "$1" in + /etc/X11/xkb/compiled) echo /var/lib/xkb ;; + /etc/X11/xkb/xkbcomp) echo /usr/X11R6/bin/xkbcomp ;; + /usr/X11R6/lib/X11/app-defaults) echo /etc/X11/app-defaults ;; + /usr/X11R6/lib/X11/fs) echo /etc/X11/fs ;; + /usr/X11R6/lib/X11/lbxproxy) echo /etc/X11/lbxproxy ;; + /usr/X11R6/lib/X11/proxymngr) echo /etc/X11/proxymngr ;; + /usr/X11R6/lib/X11/rstart) echo /etc/X11/rstart ;; + /usr/X11R6/lib/X11/twm) echo /etc/X11/twm ;; + /usr/X11R6/lib/X11/xdm) echo /etc/X11/xdm ;; + /usr/X11R6/lib/X11/xinit) echo /etc/X11/xinit ;; + /usr/X11R6/lib/X11/xkb) echo /etc/X11/xkb ;; + /usr/X11R6/lib/X11/xserver) echo /etc/X11/xserver ;; + /usr/X11R6/lib/X11/xsm) echo /etc/X11/xsm ;; + /usr/bin/X11) echo ../X11R6/bin ;; + /usr/bin/rstartd) echo ../X11R6/bin/rstartd ;; + /usr/include/X11) echo ../X11R6/include/X11 ;; + /usr/lib/X11) echo ../X11R6/lib/X11 ;; + *) internal_error "maplink() called with unknown path \"$1\"" ;; + esac +} + +analyze_path () { + # given a supplied set of pathnames, break each one up by directory and do an + # ls -dl on each component, cumulatively; i.e. + # analyze_path /usr/X11R6/bin -> ls -dl /usr /usr/X11R6 /usr/X11R6/bin + # Thanks to Randolph Chung for this clever hack. + + local f g + + while [ -n "$1" ]; do + reject_whitespace "$1" + g= + message "Analyzing $1:" + for f in $(echo "$1" | tr / \ ); do + if [ -e /$g$f ]; then + ls -dl /$g$f /$g$f.dpkg-* 2> /dev/null || true + g=$g$f/ + else + message "/$g$f: nonexistent; directory contents of /$g:" + ls -l /$g + break + fi + done + shift + done +} + +find_culprits () { + local f p dpkg_info_dir possible_culprits smoking_guns bad_packages package \ + msg + + reject_whitespace "$1" + message "Searching for overlapping packages..." + dpkg_info_dir=/var/lib/dpkg/info + if [ -d $dpkg_info_dir ]; then + if [ "$(echo $dpkg_info_dir/*.list)" != "$dpkg_info_dir/*.list" ]; then + possible_culprits=$(ls -1 $dpkg_info_dir/*.list | egrep -v \ + "(xbase-clients|x11-common|xfs|xlibs)") + if [ -n "$possible_culprits" ]; then + smoking_guns=$(grep -l "$1" $possible_culprits || true) + if [ -n "$smoking_guns" ]; then + bad_packages=$(printf "\\n") + for f in $smoking_guns; do + # too bad you can't nest parameter expansion voodoo + p=${f%*.list} # strip off the trailing ".list" + package=${p##*/} # strip off the directories + bad_packages=$(printf "%s\n%s" "$bad_packages" "$package") + done + msg=$(cat < /dev/null 2>&1; then + message "The readlink command was not found. Please install version" \ + "1.13.1 or later of the debianutils package." + readlink () { + # returns what symlink in $1 actually points to + perl -e '$l = shift; exit 1 unless -l $l; $r = readlink $l; exit 1 unless $r; print "$r\n"' "$1" + } +fi + +check_symlink () { + # syntax: check_symlink symlink + # + # See if specified symlink points where it is supposed to. Return 0 if it + # does, and 1 if it does not. + # + # Primarily used by check_symlinks_and_warn() and check_symlinks_and_bomb(). + + local symlink + + # validate arguments + if [ $# -ne 1 ]; then + usage_error "check_symlink() called with wrong number of arguments;" \ + "expected 1, got $#" + exit $SHELL_LIB_USAGE_ERROR + fi + + symlink="$1" + + if [ "$(maplink "$symlink")" = "$(readlink "$symlink")" ]; then + return 0 + else + return 1 + fi +} + +check_symlinks_and_warn () { + # syntax: check_symlinks_and_warn symlink ... + # + # For each argument, check for symlink sanity, and warn if it isn't sane. + # + # Call this function from a preinst script in the event $1 is "upgrade" or + # "install". + + local errmsg symlink + + # validate arguments + if [ $# -lt 1 ]; then + usage_error "check_symlinks_and_warn() called with wrong number of" \ + "arguments; expected at least 1, got $#" + exit $SHELL_LIB_USAGE_ERROR + fi + + while [ -n "$1" ]; do + symlink="$1" + if [ -L "$symlink" ]; then + if ! check_symlink "$symlink"; then + observe "$symlink symbolic link points to wrong location" \ + "$(readlink "$symlink"); removing" + rm "$symlink" + fi + elif [ -e "$symlink" ]; then + errmsg="$symlink exists and is not a symbolic link; this package cannot" + errmsg="$errmsg be installed until this" + if [ -f "$symlink" ]; then + errmsg="$errmsg file" + elif [ -d "$symlink" ]; then + errmsg="$errmsg directory" + else + errmsg="$errmsg thing" + fi + errmsg="$errmsg is removed" + die "$errmsg" + fi + shift + done +} + +check_symlinks_and_bomb () { + # syntax: check_symlinks_and_bomb symlink ... + # + # For each argument, check for symlink sanity, and bomb if it isn't sane. + # + # Call this function from a postinst script. + + local problem symlink + + # validate arguments + if [ $# -lt 1 ]; then + usage_error "check_symlinks_and_bomb() called with wrong number of" + "arguments; expected at least 1, got $#" + exit $SHELL_LIB_USAGE_ERROR + fi + + while [ -n "$1" ]; do + problem= + symlink="$1" + if [ -L "$symlink" ]; then + if ! check_symlink "$symlink"; then + problem=yes + warn "$symlink symbolic link points to wrong location" \ + "$(readlink "$symlink")" + fi + elif [ -e "$symlink" ]; then + problem=yes + warn "$symlink is not a symbolic link" + else + problem=yes + warn "$symlink symbolic link does not exist" + fi + if [ -n "$problem" ]; then + analyze_path "$symlink" "$(readlink "$symlink")" + find_culprits "$symlink" + die "bad symbolic links on system" + fi + shift + done +} + +font_update () { + # run $UPDATECMDS in $FONTDIRS + + local dir cmd shortcmd x_font_dir_prefix + + x_font_dir_prefix="/usr/share/fonts/X11" + + if [ -z "$UPDATECMDS" ]; then + usage_error "font_update() called but \$UPDATECMDS not set" + fi + if [ -z "$FONTDIRS" ]; then + usage_error "font_update() called but \$FONTDIRS not set" + fi + + reject_unlikely_path_chars "$UPDATECMDS" + reject_unlikely_path_chars "$FONTDIRS" + + for dir in $FONTDIRS; do + if [ -d "$x_font_dir_prefix/$dir" ]; then + for cmd in $UPDATECMDS; do + if which "$cmd" > /dev/null 2>&1; then + shortcmd=${cmd##*/} + observe "running $shortcmd in $dir font directory" + cmd_opts= + if [ "$shortcmd" = "update-fonts-alias" ]; then + cmd_opts=--x11r7-layout + fi + if [ "$shortcmd" = "update-fonts-dir" ]; then + cmd_opts=--x11r7-layout + fi + if [ "$shortcmd" = "update-fonts-scale" ]; then + cmd_opts=--x11r7-layout + fi + $cmd $cmd_opts $dir || warn "$cmd $cmd_opts $dir" \ + "failed; font directory data may not" \ + "be up to date" + else + warn "$cmd not found; not updating corresponding $dir font" \ + "directory data" + fi + done + else + warn "$dir is not a directory; not updating font directory data" + fi + done +} + +remove_conffile_prepare () { + # syntax: remove_conffile_prepare filename official_md5sum ... + # + # Check a conffile "filename" against a list of canonical MD5 checksums. + # If the file's current MD5 checksum matches one of the "official_md5sum" + # operands provided, then prepare the conffile for removal from the system. + # We defer actual deletion until the package is configured so that we can + # roll this operation back if package installation fails. + # + # Call this function from a preinst script in the event $1 is "upgrade" or + # "install" and verify $2 to ensure the package is being upgraded from a + # version (or installed over a version removed-but-not-purged) prior to the + # one in which the conffile was obsoleted. + + local conffile current_checksum + + # validate arguments + if [ $# -lt 2 ]; then + usage_error "remove_conffile_prepare() called with wrong number of" \ + "arguments; expected at least 2, got $#" + exit $SHELL_LIB_USAGE_ERROR + fi + + conffile="$1" + shift + + # does the conffile even exist? + if [ -e "$conffile" ]; then + # calculate its checksum + current_checksum=$(md5sum < "$conffile" | sed 's/[[:space:]].*//') + # compare it to each supplied checksum + while [ -n "$1" ]; do + if [ "$current_checksum" = "$1" ]; then + # we found a match; move the confffile and stop looking + observe "preparing obsolete conffile $conffile for removal" + mv "$conffile" "$conffile.$THIS_PACKAGE-tmp" + break + fi + shift + done + fi +} + +remove_conffile_lookup () { + # syntax: remove_conffile_lookup package filename + # + # Lookup the md5sum of a conffile in dpkg's database, and prepare for removal + # if it matches the actual file's md5sum. + # + # Call this function when you would call remove_conffile_prepare but only + # want to check against dpkg's status database instead of known checksums. + + local package conffile old_md5sum + + # validate arguments + if [ $# -ne 2 ]; then + usage_error "remove_conffile_lookup() called with wrong number of" \ + "arguments; expected 1, got $#" + exit $SHELL_LIB_USAGE_ERROR + fi + + package="$1" + conffile="$2" + + if ! [ -e "$conffile" ]; then + return + fi + old_md5sum="$(dpkg-query -W -f='${Conffiles}' "$package" | \ + awk '{ if (match($0, "^ '"$conffile"' ")) print $2}')" + if [ -n "$old_md5sum" ]; then + remove_conffile_prepare "$conffile" "$old_md5sum" + fi +} + +remove_conffile_commit () { + # syntax: remove_conffile_commit filename + # + # Complete the removal of a conffile "filename" that has become obsolete. + # + # Call this function from a postinst script after having used + # remove_conffile_prepare() in the preinst. + + local conffile + + # validate arguments + if [ $# -ne 1 ]; then + usage_error "remove_conffile_commit() called with wrong number of" \ + "arguments; expected 1, got $#" + exit $SHELL_LIB_USAGE_ERROR + fi + + conffile="$1" + + # if the temporary file created by remove_conffile_prepare() exists, remove it + if [ -e "$conffile.$THIS_PACKAGE-tmp" ]; then + observe "committing removal of obsolete conffile $conffile" + rm "$conffile.$THIS_PACKAGE-tmp" + fi +} + +remove_conffile_rollback () { + # syntax: remove_conffile_rollback filename + # + # Roll back the removal of a conffile "filename". + # + # Call this function from a postrm script in the event $1 is "abort-upgrade" + # or "abort-install" is after having used remove_conffile_prepare() in the + # preinst. + + local conffile + + # validate arguments + if [ $# -ne 1 ]; then + usage_error "remove_conffile_rollback() called with wrong number of" \ + "arguments; expected 1, got $#" + exit $SHELL_LIB_USAGE_ERROR + fi + + conffile="$1" + + # if the temporary file created by remove_conffile_prepare() exists, move it + # back + if [ -e "$conffile.$THIS_PACKAGE-tmp" ]; then + observe "rolling back removal of obsolete conffile $conffile" + mv "$conffile.$THIS_PACKAGE-tmp" "$conffile" + fi +} + +replace_conffile_with_symlink_prepare () { + # syntax: replace_conffile_with_symlink_prepare oldfilename newfilename \ + # official_md5sum ... + # + # Check a conffile "oldfilename" against a list of canonical MD5 checksums. + # If the file's current MD5 checksum matches one of the "official_md5sum" + # operands provided, then prepare the conffile for removal from the system. + # We defer actual deletion until the package is configured so that we can + # roll this operation back if package installation fails. Otherwise copy it + # to newfilename and let dpkg handle it through conffiles mechanism. + # + # Call this function from a preinst script in the event $1 is "upgrade" or + # "install" and verify $2 to ensure the package is being upgraded from a + # version (or installed over a version removed-but-not-purged) prior to the + # one in which the conffile was obsoleted. + + local conffile current_checksum + + # validate arguments + if [ $# -lt 3 ]; then + usage_error "replace_conffile_with_symlink_prepare() called with wrong" \ + " number of arguments; expected at least 3, got $#" + exit $SHELL_LIB_USAGE_ERROR + fi + + oldconffile="$1" + shift + newconffile="$1" + shift + + remove_conffile_prepare "$_oldconffile" "$@" + # If $oldconffile still exists, then md5sums didn't match. + # Copy it to new one. + if [ -f "$oldconffile" ]; then + cp "$oldconffile" "$newconffile" + fi + +} + +replace_conffile_with_symlink_commit () { + # syntax: replace_conffile_with_symlink_commit oldfilename + # + # Complete the removal of a conffile "oldfilename" that has been + # replaced by a symlink. + # + # Call this function from a postinst script after having used + # replace_conffile_with_symlink_prepare() in the preinst. + + local conffile + + # validate arguments + if [ $# -ne 1 ]; then + usage_error "replace_conffile_with_symlink_commit() called with wrong" \ + "number of arguments; expected 1, got $#" + exit $SHELL_LIB_USAGE_ERROR + fi + + conffile="$1" + + remove_conffile_commit "$conffile" +} + +replace_conffile_with_symlink_rollback () { + # syntax: replace_conffile_with_symlink_rollback oldfilename newfilename + # + # Roll back the replacing of a conffile "oldfilename" with symlink to + # "newfilename". + # + # Call this function from a postrm script in the event $1 is "abort-upgrade" + # or "abort-install" and verify $2 to ensure the package failed to upgrade + # from a version (or install over a version removed-but-not-purged) prior + # to the one in which the conffile was obsoleted. + # You should have used replace_conffile_with_symlink_prepare() in the + # preinst. + + local conffile + + # validate arguments + if [ $# -ne 2 ]; then + usage_error "replace_conffile_with_symlink_rollback() called with wrong" \ + "number of arguments; expected 2, got $#" + exit $SHELL_LIB_USAGE_ERROR + fi + + oldconffile="$1" + newconffile="$2" + + remove_conffile_rollback "$_oldconffile" + if [ -f "$newconffile" ]; then + rm "$newconffile" + fi +} + +run () { + # syntax: run command [ argument ... ] + # + # Run specified command with optional arguments and report its exit status. + # Useful for commands whose exit status may be nonzero, but still acceptable, + # or commands whose failure is not fatal to us. + # + # NOTE: Do *not* use this function with db_get or db_metaget commands; in + # those cases the return value of the debconf command *must* be checked + # before the string returned by debconf is used for anything. + + local retval + + # validate arguments + if [ $# -lt 1 ]; then + usage_error "run() called with wrong number of arguments; expected at" \ + "least 1, got $#" + exit $SHELL_LIB_USAGE_ERROR + fi + + "$@" || retval=$? + + if [ ${retval:-0} -ne 0 ]; then + observe "command \"$*\" exited with status $retval" + fi +} + +register_x_lib_dir_with_ld_so () { + # syntax: register_x_lib_dir_with_ld_so + # + # Configure the dynamic loader ld.so to search /usr/X11R6/lib for shared + # libraries. + # + # Call this function from the postinst script of a package that places a + # shared library in /usr/X11R6/lib, before invoking ldconfig. + + local dir ldsoconf + + dir="/usr/X11R6/lib" + ldsoconf="/etc/ld.so.conf" + + # is the line not already present? + if ! fgrep -qsx "$dir" "$ldsoconf"; then + observe "adding $dir directory to $ldsoconf" + echo "$dir" >> "$ldsoconf" + fi +} + +deregister_x_lib_dir_with_ld_so () { + # syntax: deregister_x_lib_dir_with_ld_so + # + # Configure dynamic loader ld.so to not search /usr/X11R6/lib for shared + # libraries, if and only if no shared libaries remain there. + # + # Call this function from the postrm script of a package that places a shared + # library in /usr/X11R6/lib, in the event "$1" is "remove", and before + # invoking ldconfig. + + local dir ldsoconf fgrep_status cmp_status + + dir="/usr/X11R6/lib" + ldsoconf="/etc/ld.so.conf" + + # is the line present? + if fgrep -qsx "$dir" "$ldsoconf"; then + # are there any shared objects in the directory? + if [ "$(echo "$dir"/lib*.so.*.*)" = "$dir/lib*.so.*.*" ]; then + # glob expansion produced nothing, so no shared libraries are present + observe "removing $dir directory from $ldsoconf" + # rewrite the file (very carefully) + set +e + fgrep -svx "$dir" "$ldsoconf" > "$ldsoconf.dpkg-tmp" + fgrep_status=$? + set -e + case $fgrep_status in + 0|1) ;; # we don't actually care if any lines matched or not + *) die "error reading \"$ldsoconf\"; fgrep exited with status" \ + "$fgrep_status" ;; + esac + set +e + cmp -s "$ldsoconf.dpkg-tmp" "$ldsoconf" + cmp_status=$? + set -e + case $cmp_status in + 0) rm "$ldsoconf.dpkg-tmp" ;; # files are identical + 1) mv "$ldsoconf.dpkg-tmp" "$ldsoconf" ;; # files differ + *) die "error comparing \"$ldsoconf.dpkg-tmp\" to \"$ldsoconf\";" \ + "cmp exited with status $cmp_status" ;; + esac + fi + fi +} + +make_symlink_sane () { + # syntax: make_symlink_sane symlink target + # + # Ensure that the symbolic link symlink exists, and points to target. + # + # If symlink does not exist, create it and point it at target. + # + # If symlink exists but is not a symbolic link, back it up. + # + # If symlink exists, is a symbolic link, but points to the wrong location, fix + # it. + # + # If symlink exists, is a symbolic link, and already points to target, do + # nothing. + # + # This function wouldn't be needed if ln had an -I, --idempotent option. + + # Validate arguments. + if [ $# -ne 2 ]; then + usage_error "make_symlink_sane() called with wrong number of arguments;" \ + "expected 2, got $#" + exit $SHELL_LIB_USAGE_ERROR + fi + + # We could just use the positional parameters as-is, but that makes things + # harder to follow. + local symlink target + + symlink="$1" + target="$2" + + if [ -L "$symlink" ] && [ "$(readlink "$symlink")" = "$target" ]; then + observe "link from $symlink to $target already exists" + else + observe "creating symbolic link from $symlink to $target" + mkdir -p "${target%/*}" "${symlink%/*}" + ln -s -b -S ".dpkg-old" "$target" "$symlink" + fi +} + +migrate_dir_to_symlink () { + # syntax: migrate_dir_to_symlink old_location new_location + # + # Per Debian Policy section 6.5.4, "A directory will never be replaced by a + # symbolic link to a directory or vice versa; instead, the existing state + # (symlink or not) will be left alone and dpkg will follow the symlink if + # there is one." + # + # We have to do it ourselves. + # + # This function moves the contents of old_location, a directory, into + # new_location, a directory, then makes old_location a symbolic link to + # new_location. + # + # old_location need not exist, but if it does, it must be a directory (or a + # symlink to a directory). If it is not, it is backed up. If new_location + # exists already and is not a directory, it is backed up. + # + # This function should be called from a package's preinst so that other + # packages unpacked after this one --- but before this package's postinst runs + # --- are unpacked into new_location even if their payloads contain + # old_location filespecs. + + # Validate arguments. + if [ $# -ne 2 ]; then + usage_error "migrate_dir_to_symlink() called with wrong number of" + "arguments; expected 2, got $#" + exit $SHELL_LIB_USAGE_ERROR + fi + + # We could just use the positional parameters as-is, but that makes things + # harder to follow. + local new old + + old="$1" + new="$2" + + # Is old location a symlink? + if [ -L "$old" ]; then + # Does it already point to new location? + if [ "$(readlink "$old")" = "$new" ]; then + # Nothing to do; migration has already been done. + observe "migration of $old to $new already done" + return 0 + else + # Back it up. + warn "backing up symbolic link $old as $old.dpkg-old" + mv -b "$old" "$old.dpkg-old" + fi + fi + + # Does old location exist, but is not a directory? + if [ -e "$old" ] && ! [ -d "$old" ]; then + # Back it up. + warn "backing up non-directory $old as $old.dpkg-old" + mv -b "$old" "$old.dpkg-old" + fi + + observe "migrating $old to $new" + + # Is new location a symlink? + if [ -L "$new" ]; then + # Does it point the wrong way, i.e., back to where we're migrating from? + if [ "$(readlink "$new")" = "$old" ]; then + # Get rid of it. + observe "removing symbolic link $new which points to $old" + rm "$new" + else + # Back it up. + warn "backing up symbolic link $new as $new.dpkg-old" + mv -b "$new" "$new.dpkg-old" + fi + fi + + # Does new location exist, but is not a directory? + if [ -e "$new" ] && ! [ -d "$new" ]; then + warn "backing up non-directory $new as $new.dpkg-old" + mv -b "$new" "$new.dpkg-old" + fi + + # Create new directory if it does not yet exist. + if ! [ -e "$new" ]; then + observe "creating $new" + mkdir -p "$new" + fi + + # Copy files in old location to new location. Back up any filenames that + # already exist in the new location with the extension ".dpkg-old". + observe "copying files from $old to $new" + if ! (cd "$old" && cp -a -b -S ".dpkg-old" . "$new"); then + die "error(s) encountered while copying files from $old to $new" + fi + + # Remove files at old location. + observe "removing $old" + rm -r "$old" + + # Create symlink from old location to new location. + make_symlink_sane "$old" "$new" +} + +# vim:set ai et sw=2 ts=2 tw=80: + +# GOBSTOPPER: The X Strike Force shell library ends here. --- xorg-server-1.4.2.orig/debian/prune/non-free +++ xorg-server-1.4.2/debian/prune/non-free @@ -0,0 +1 @@ +hw/xfree86/doc/README.DRI --- xorg-server-1.4.2.orig/debian/patches/14_default_screen_section.diff +++ xorg-server-1.4.2/debian/patches/14_default_screen_section.diff @@ -0,0 +1,57 @@ +--- xorg-server.orig/hw/xfree86/common/xf86Config.c ++++ xorg-server/hw/xfree86/common/xf86Config.c +@@ -1800,11 +1800,6 @@ + if (!servlayoutp) + return FALSE; + +- if (conf_screen == NULL) { +- xf86ConfigError("No Screen sections present\n"); +- return FALSE; +- } +- + /* + * which screen section is the active one? + * +@@ -1892,6 +1887,12 @@ + XF86ConfAdaptorLinkPtr conf_adaptor; + Bool defaultMonitor = FALSE; + ++ if (!conf_screen) { ++ conf_screen = xnfcalloc(1, sizeof(XF86ConfScreenRec)); ++ 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); + /* +--- xorg-server.orig/hw/xfree86/parser/Screen.c ++++ xorg-server/hw/xfree86/parser/Screen.c +@@ -498,12 +498,6 @@ + XF86ConfDevicePtr device; + XF86ConfAdaptorLinkPtr adaptor; + +- if (!screen) +- { +- xf86validationError ("At least one Screen section is required."); +- return (FALSE); +- } +- + while (screen) + { + if (screen->scrn_obso_driver && !screen->scrn_identifier) +@@ -512,13 +506,7 @@ + monitor = xf86findMonitor (screen->scrn_monitor_str, p->conf_monitor_lst); + if (screen->scrn_monitor_str) + { +- if (!monitor) +- { +- xf86validationError (UNDEFINED_MONITOR_MSG, +- screen->scrn_monitor_str, screen->scrn_identifier); +- return (FALSE); +- } +- else ++ if (monitor) + { + screen->scrn_monitor = monitor; + if (!xf86validateMonitor(p, screen)) --- xorg-server-1.4.2.orig/debian/patches/04_auto_load_driver_no_conf.diff +++ xorg-server-1.4.2/debian/patches/04_auto_load_driver_no_conf.diff @@ -0,0 +1,28 @@ +Index: xorg-server/hw/xfree86/common/xf86AutoConfig.c +=================================================================== +--- xorg-server.orig/hw/xfree86/common/xf86AutoConfig.c ++++ xorg-server/hw/xfree86/common/xf86AutoConfig.c +@@ -225,22 +225,7 @@ + char *driver = NULL; + ConfigStatus ret; + +- /* Find the primary device, and get some information about it. */ +- if (xf86PciVideoInfo) { +- for (pciptr = xf86PciVideoInfo; (info = *pciptr); pciptr++) { +- if (xf86IsPrimaryPci(info)) { +- break; +- } +- } +- if (!info) { +- ErrorF("Primary device is not PCI\n"); +- } +- } else { +- ErrorF("xf86PciVideoInfo is not set\n"); +- } +- +- if (info) +- driver = videoPtrToDriverName(info); ++ driver = chooseVideoDriver(); + + AppendToConfig(BUILTIN_MODULE_SECTION); + AppendToConfig(BUILTIN_MONITOR_SECTION); --- xorg-server-1.4.2.orig/debian/patches/47_fbdevhw_magic_numbers.diff +++ xorg-server-1.4.2/debian/patches/47_fbdevhw_magic_numbers.diff @@ -0,0 +1,17 @@ +* Fri May 11 2007 Adam Jackson 1.3.0.0-5 +- xserver-1.3.0-fbdevhw-magic-numbers.patch: If the fbdev driver claims to + have a zero pixel clock, believe it. Fixes Xen paravirt. (#238451) + +Might fix #422430 + +--- xorg-server-1.3.0.0/./hw/xfree86/fbdevhw/fbdevhw.c.jx 2007-03-26 23:32:36.000000000 -0400 ++++ xorg-server-1.3.0.0/./hw/xfree86/fbdevhw/fbdevhw.c 2007-05-11 15:10:05.000000000 -0400 +@@ -258,7 +258,7 @@ + static void + fbdev2xfree_timing(struct fb_var_screeninfo *var, DisplayModePtr mode) + { +- mode->Clock = var->pixclock ? 1000000000/var->pixclock : 28000000; ++ 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; --- xorg-server-1.4.2.orig/debian/patches/11_dont_crash_on_bad_dri_mode.diff +++ xorg-server-1.4.2/debian/patches/11_dont_crash_on_bad_dri_mode.diff @@ -0,0 +1,66 @@ +Index: xorg-server/hw/xfree86/parser/Configint.h +=================================================================== +--- xorg-server.orig/hw/xfree86/parser/Configint.h 2008-03-02 17:09:50.000000000 -0500 ++++ xorg-server/hw/xfree86/parser/Configint.h 2008-03-02 18:33:14.000000000 -0500 +@@ -71,11 +71,14 @@ + #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; + +@@ -215,6 +218,8 @@ + "\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." + + /* Warning messages */ + #define OBSOLETE_MSG \ +Index: xorg-server/hw/xfree86/parser/DRI.c +=================================================================== +--- xorg-server.orig/hw/xfree86/parser/DRI.c 2008-03-02 17:09:50.000000000 -0500 ++++ xorg-server/hw/xfree86/parser/DRI.c 2008-03-02 18:33:14.000000000 -0500 +@@ -117,6 +117,8 @@ + case MODE: + if (xf86getSubToken (&(ptr->dri_comment)) != NUMBER) + Error (NUMBER_MSG, "Mode"); ++ if (val.numType != PARSE_OCTAL) ++ Error (MUST_BE_OCTAL_MSG, val.num); + ptr->dri_mode = val.num; + break; + case BUFFERS: +Index: xorg-server/hw/xfree86/parser/scan.c +=================================================================== +--- xorg-server.orig/hw/xfree86/parser/scan.c 2008-03-02 18:33:23.000000000 -0500 ++++ xorg-server/hw/xfree86/parser/scan.c 2008-03-02 18:33:29.000000000 -0500 +@@ -379,11 +379,20 @@ + if (c == '0') + if ((configBuf[configPos] == 'x') || + (configBuf[configPos] == 'X')) ++ { + base = 16; ++ val.numType = PARSE_HEX; ++ } + else ++ { + base = 8; ++ val.numType = PARSE_OCTAL; ++ } + else ++ { + base = 10; ++ val.numType = PARSE_DECIMAL; ++ } + + configRBuf[0] = c; + i = 1; --- xorg-server-1.4.2.orig/debian/patches/91_ttf2pt1 +++ xorg-server-1.4.2/debian/patches/91_ttf2pt1 @@ -0,0 +1,22165 @@ +diff -ruN xserver-old/hw/xprint/extras/ttf2pt1/bdf.c xserver/hw/xprint/extras/ttf2pt1/bdf.c +--- xserver-old/hw/xprint/extras/ttf2pt1/bdf.c 1970-01-01 10:00:00.000000000 +1000 ++++ xserver/hw/xprint/extras/ttf2pt1/bdf.c 2006-06-27 13:10:26.000000000 +1000 +@@ -0,0 +1,660 @@ ++/* ++ * The font parser for the BDF files ++ * ++ * Copyright (c) 2001 by the TTF2PT1 project ++ * Copyright (c) 2001 by Sergey Babkin ++ * ++ * see COPYRIGHT for the full copyright notice ++ */ ++ ++#include ++#include ++#include ++#include ++#include "pt1.h" ++#include "global.h" ++ ++/* prototypes of call entries */ ++static void openfont(char *fname, char *arg); ++static void closefont( void); ++static int getnglyphs ( void); ++static int glnames( GLYPH *glyph_list); ++static void readglyphs( GLYPH *glyph_list); ++static int glenc( GLYPH *glyph_list, int *encoding, int *unimap); ++static void fnmetrics( struct font_metrics *fm); ++static void glpath( int glyphno, GLYPH *glyph_list); ++static void kerning( GLYPH *glyph_list); ++ ++/* globals */ ++ ++/* front-end descriptor */ ++struct frontsw bdf_sw = { ++ /*name*/ "bdf", ++ /*descr*/ "BDF bitmapped fonts", ++ /*suffix*/ { "bdf" }, ++ /*open*/ openfont, ++ /*close*/ closefont, ++ /*nglyphs*/ getnglyphs, ++ /*glnames*/ glnames, ++ /*glmetrics*/ readglyphs, ++ /*glenc*/ glenc, ++ /*fnmetrics*/ fnmetrics, ++ /*glpath*/ glpath, ++ /*kerning*/ kerning, ++}; ++ ++/* statics */ ++ ++#define MAXLINE 10240 /* maximal line length in the input file */ ++ ++static int lineno; /* line number */ ++ ++#define GETLEN(s) s, (sizeof(s)-1) ++#define LENCMP(str, txt) strncmp(str, txt, sizeof(txt)-1) ++ ++static FILE *bdf_file; ++static int nglyphs; ++static struct font_metrics fmet; ++ ++/* many BDF fonts are of small pixel size, so we better try ++ * to scale them by an integer to keep the dimensions in ++ * whole pixels. However if the size is too big and a non- ++ * integer scaling is needed, we use the standard ttf2pt1's ++ * scaling abilities. ++ */ ++static int pixel_size; ++static int scale; ++static int scale_external; ++ ++static char *slant; ++static char xlfdname[201]; ++static char *spacing; ++static char *charset_reg; ++static char *charset_enc; ++static char *fnwidth; ++static int is_unicode = 0; ++ ++/* tempoary storage for returning data to ttf2pt1 later on request */ ++static int maxenc = 0; ++static int *fontenc; ++static GENTRY **glpaths; ++ ++static int got_glyphs = 0; ++static GLYPH *glyphs; ++static int curgl; ++ ++static int readfile(FILE *f, int (*strfunc)(int len, char *str)); ++ ++/* ++ * Read the file and parse each string with strfunc(), ++ * until strfunc() returns !=0 or the end of file happens. ++ * Returns -1 on EOF or strfunc() returning <0, else 0 ++ */ ++ ++static int ++readfile( ++ FILE *f, ++ int (*strfunc)(int len, char *str) ++) ++{ ++ static char str[MAXLINE]; /* input line, maybe should be dynamic ? */ ++ char *s; ++ int len, c, res; ++ ++ len=0; ++ while(( c=getc(f) )!=EOF) { ++ if(c=='\n') { ++ str[len]=0; ++ ++ res = strfunc(len, str); ++ lineno++; ++ if(res<0) ++ return -1; ++ else if(res!=0) ++ return 0; ++ ++ len=0; ++ } else if(len%d)\n", lineno, MAXLINE-1); ++ exit(1); ++ } ++ } ++ return -1; /* EOF */ ++} ++ ++/* ++ * Parse the header of the font file. ++ * Stop after the line CHARS is encountered. Ignore the unknown lines. ++ */ ++ ++struct line { ++ char *name; /* property name with trailing space */ ++ int namelen; /* length of the name string */ ++ enum { ++ ALLOW_REPEAT = 0x01, /* this property may be repeated in multiple lines */ ++ IS_SEEN = 0x02, /* this property has been seen already */ ++ MUST_SEE = 0x04, /* this property must be seen */ ++ IS_LAST = 0x08 /* this is the last property to be read */ ++ } flags; ++ char *fmt; /* format string for the arguments, NULL means a string arg */ ++ int nvals; /* number of values to be read by sscanf */ ++ void *vp[4]; /* pointers to values to be read */ ++}; ++ ++static struct line header[] = { ++ { GETLEN("FONT "), 0, " %200s", 1, {&xlfdname} }, ++ { GETLEN("SIZE "), MUST_SEE, " %d", 1, {&pixel_size} }, ++ { GETLEN("FONTBOUNDINGBOX "), MUST_SEE, " %hd %hd %hd %hd", 4, ++ {&fmet.bbox[2], &fmet.bbox[3], &fmet.bbox[0], &fmet.bbox[1]} }, ++ { GETLEN("FAMILY_NAME "), MUST_SEE, NULL, 1, {&fmet.name_family} }, ++ { GETLEN("WEIGHT_NAME "), MUST_SEE, NULL, 1, {&fmet.name_style} }, ++ { GETLEN("COPYRIGHT "), 0, NULL, 1, {&fmet.name_copyright} }, ++ { GETLEN("SLANT "), MUST_SEE, NULL, 1, {&slant} }, ++ { GETLEN("SPACING "), 0, NULL, 1, {&spacing} }, ++ { GETLEN("SETWIDTH_NAME "), 0, NULL, 1, {&fnwidth} }, ++ { GETLEN("CHARSET_REGISTRY "), 0, NULL, 1, {&charset_reg} }, ++ { GETLEN("CHARSET_ENCODING "), 0, NULL, 1, {&charset_enc} }, ++ { GETLEN("FONT_ASCENT "), 0, " %hd", 1, {&fmet.ascender} }, ++ { GETLEN("FONT_DESCENT "), 0, " %hd", 1, {&fmet.descender} }, ++ ++ /* these 2 must go in this order for post-processing */ ++ { GETLEN("UNDERLINE_THICKNESS "), 0, " %hd", 1, {&fmet.underline_thickness} }, ++ { GETLEN("UNDERLINE_POSITION "), 0, " %hd", 1, {&fmet.underline_position} }, ++ ++ { GETLEN("CHARS "), MUST_SEE|IS_LAST, " %d", 1, {&nglyphs} }, ++ { NULL, 0, 0 } /* end mark: name==NULL */ ++}; ++ ++static int ++handle_header( ++ int len, ++ char *str ++) ++{ ++ struct line *cl; ++ char *s, *p; ++ int c; ++ ++#if 0 ++ fprintf(stderr, "line: %s\n", str); ++#endif ++ for(cl = header; cl->name != 0; cl++) { ++ if(strncmp(str, cl->name, cl->namelen)) ++ continue; ++#if 0 ++ fprintf(stderr, "match: %s\n", cl->name); ++#endif ++ if(cl->flags & IS_SEEN) { ++ if(cl->flags & ALLOW_REPEAT) ++ continue; ++ ++ fprintf(stderr, "**** input line %d redefines the property %s\n", lineno, cl->name); ++ exit(1); ++ } ++ cl->flags |= IS_SEEN; ++ if(cl->fmt == 0) { ++ s = malloc(len - cl->namelen + 1); ++ if(s == 0) { ++ fprintf (stderr, "****malloc failed %s line %d\n", __FILE__, __LINE__); ++ exit(255); ++ } ++ *((char **)(cl->vp[0])) = s; ++ ++ /* skip until a quote */ ++ for(p = str+cl->namelen; (c = *p)!=0; p++) { ++ if(c == '"') { ++ p++; ++ break; ++ } ++ } ++ for(; (c = *p)!=0; p++) { ++ if(c == '"') { ++ c = *++p; ++ if(c == '"') ++ *s++ = c; ++ else ++ break; ++ } else ++ *s++ = c; ++ } ++ *s = 0; /* end of line */ ++ } else { ++ c = sscanf(str+cl->namelen, cl->fmt, cl->vp[0], cl->vp[1], cl->vp[2], cl->vp[3]); ++ if(c != cl->nvals) { ++ fprintf(stderr, "**** property %s at input line %d must have %d arguments\n", ++ cl->name, lineno, cl->nvals); ++ exit(1); ++ } ++ } ++ if(cl->flags & IS_LAST) ++ return 1; ++ else ++ return 0; ++ } ++ return 0; ++} ++ ++/* ++ * Parse the description of the glyphs ++ */ ++ ++static int ++handle_glyphs( ++ int len, ++ char *str ++) ++{ ++ static int inbmap=0; ++ static char *bmap; ++ static int xsz, ysz, xoff, yoff; ++ static int curln; ++ int i, c; ++ char *p, *plim, *psz; ++ ++ if(!LENCMP(str, "ENDFONT")) { ++ if(curgl < nglyphs) { ++ fprintf(stderr, "**** unexpected end of font file after %d glyphs\n", curgl); ++ exit(1); ++ } else ++ return 1; ++ } ++ if(curgl >= nglyphs) { ++ fprintf(stderr, "**** file contains more glyphs than advertised (%d)\n", nglyphs); ++ exit(1); ++ } ++ if(!LENCMP(str, "STARTCHAR")) { ++ /* sizeof will count \0 instead of ' ' */ ++ for(i=sizeof("STARTCHAR"); str[i] == ' '; i++) ++ {} ++ ++ glyphs[curgl].name = strdup(str + i); ++ if(glyphs[curgl].name == 0) { ++ fprintf (stderr, "****malloc failed %s line %d\n", __FILE__, __LINE__); ++ exit(255); ++ } ++ } else if(!LENCMP(str, "ENCODING")) { ++ if(sscanf(str, "ENCODING %d", &fontenc[curgl])!=1) { ++ fprintf(stderr,"**** weird ENCODING statement at line %d\n", lineno); ++ exit(1); ++ } ++ if(fontenc[curgl] == -1) /* compatibility format */ ++ sscanf(str, "ENCODING -1 %d", &fontenc[curgl]); ++ if(fontenc[curgl] > maxenc) ++ maxenc = fontenc[curgl]; ++ } else if(!LENCMP(str, "DWIDTH")) { ++ if(sscanf(str, "DWIDTH %d %d", &xsz, &ysz)!=2) { ++ fprintf(stderr,"**** weird DWIDTH statement at line %d\n", lineno); ++ exit(1); ++ } ++ glyphs[curgl].width = xsz*scale; ++ } else if(!LENCMP(str, "BBX")) { ++ if(sscanf(str, "BBX %d %d %d %d", &xsz, &ysz, &xoff, &yoff)!=4) { ++ fprintf(stderr,"**** weird BBX statement at line %d\n", lineno); ++ exit(1); ++ } ++ bmap=malloc(xsz*ysz); ++ if(bmap==0) { ++ fprintf (stderr, "****malloc failed %s line %d\n", __FILE__, __LINE__); ++ exit(255); ++ } ++ glyphs[curgl].lsb = -xoff*scale; ++ glyphs[curgl].xMin = -xoff*scale; ++ glyphs[curgl].xMax = (xsz-xoff)*scale; ++ glyphs[curgl].yMin = -yoff*scale; ++ glyphs[curgl].yMax = (ysz-xoff)*scale; ++ } else if(!LENCMP(str, "BITMAP")) { ++ inbmap=1; ++ curln=ysz-1; /* the lowest line has index 0 */ ++ } else if(!LENCMP(str, "ENDCHAR")) { ++ inbmap=0; ++ if(bmap) { ++ glyphs[curgl].lastentry = 0; ++ glyphs[curgl].path = 0; ++ glyphs[curgl].entries = 0; ++ bmp_outline(&glyphs[curgl], scale, bmap, xsz, ysz, xoff, yoff); ++ free(bmap); ++ /* remember in a static table or it will be erased */ ++ glpaths[curgl] = glyphs[curgl].entries; ++ glyphs[curgl].entries = 0; ++ ++ if(glpaths[curgl]) ++ glyphs[curgl].ttf_pathlen = 1; ++ else ++ glyphs[curgl].ttf_pathlen = 0; ++ } ++ curgl++; ++ } else if(inbmap) { ++ if(curln<0) { ++ fprintf(stderr,"**** bitmap is longer than %d lines at line %d\n", ysz, lineno); ++ exit(1); ++ } ++ ++ i=0; ++ p=&bmap[curln*xsz]; psz=p+xsz; ++ while(ilsb = 0; ++ g->width = fmet.bbox[2]; ++ g->xMin = 0; ++ g->yMin = 0; ++ } ++ g = &glyphs[0]; ++ g->name = ".notdef"; ++ g->xMax = fmet.bbox[2]*4/5; ++ g->yMax = fmet.bbox[3]*4/5; ++ g->entries = g->path = g->lastentry = 0; ++ /* make it look as a black square */ ++ fg_rmoveto(g, 0.0, 0.0); ++ fg_rlineto(g, 0.0, (double)g->yMax); ++ fg_rlineto(g, (double)g->xMax, (double)g->yMax); ++ fg_rlineto(g, (double)g->xMax, 0.0); ++ fg_rlineto(g, 0.0, 0.0); ++ g_closepath(g); ++ glpaths[0] = g->entries; ++ g->entries = 0; ++ g->ttf_pathlen = 4; ++ ++ g = &glyphs[1]; ++ g->name = ".null"; ++ g->xMax = g->yMax = 0; ++ g->ttf_pathlen = 0; ++ ++ if(readfile(bdf_file, handle_glyphs) < 0) { ++ fprintf(stderr, "**** file does not contain the ENDFONT line\n"); ++ exit(1); ++ } ++ got_glyphs = 1; ++} ++ ++/* ++ * Open font and prepare to return information to the main driver. ++ * May print error and warning messages. ++ * Exit on error. ++ */ ++ ++static void ++openfont( ++ char *fname, ++ char *arg /* unused now */ ++) ++{ ++ struct line *cl; ++ int i, l; ++ ++ if ((bdf_file = fopen(fname, "r")) == NULL) { ++ fprintf(stderr, "**** Cannot open file '%s'\n", fname); ++ exit(1); ++ } else { ++ WARNING_2 fprintf(stderr, "Processing file %s\n", fname); ++ } ++ ++ lineno = 1; ++ ++ for(cl = header; cl->name != 0; cl++) ++ cl->flags &= ~IS_SEEN; ++ if(readfile(bdf_file, handle_header) < 0) { ++ fprintf(stderr, "**** file does not contain the CHARS definition\n"); ++ exit(1); ++ } ++ for(cl = header; cl->name != 0; cl++) { ++ if( (cl->flags & MUST_SEE) && !(cl->flags & IS_SEEN) ) { ++ fprintf(stderr, "**** mandatory property %sis not found in the input line\n", ++ cl->name); /* cl->name has a space at the end */ ++ exit(1); ++ } ++ ++ /* set a few defaults */ ++ if( !(cl->flags & IS_SEEN) ) { ++ if(cl->vp[0] == &fmet.underline_thickness) { ++ fmet.underline_thickness = 1; ++ } else if(cl->vp[0] == &fmet.underline_position) { ++ fmet.underline_position = fmet.bbox[1] + fmet.underline_thickness ++ - (pixel_size - fmet.bbox[3]); ++ } else if(cl->vp[0] == &fmet.ascender) { ++ fmet.ascender = fmet.bbox[2] + fmet.bbox[0]; ++ } else if(cl->vp[0] == &fmet.descender) { ++ fmet.descender = fmet.bbox[0]; ++ } ++ } ++ } ++ ++ nglyphs += 2; /* add empty glyph and .notdef */ ++ ++ /* postprocessing to compensate for the differences in the metric formats */ ++ fmet.bbox[2] += fmet.bbox[0]; ++ fmet.bbox[3] += fmet.bbox[1]; ++ ++ scale = 1000/pixel_size; /* XXX ? */ ++ if(scale*pixel_size < 950) { ++ scale = 1; ++ scale_external = 1; ++ fmet.units_per_em = pixel_size; ++ } else { ++ scale_external = 0; ++ fmet.units_per_em = scale*pixel_size; ++ ++ fmet.underline_position *= scale; ++ fmet.underline_thickness *= scale; ++ fmet.ascender *= scale; ++ fmet.descender *= scale; ++ for(i=0; i<4; i++) ++ fmet.bbox[i] *= scale; ++ } ++ ++ fmet.italic_angle = 0.0; ++ if(spacing == 0 /* possibly an old font */ ++ || toupper(spacing[0]) != 'P') /* or anything non-proportional */ ++ fmet.is_fixed_pitch = 1; ++ else ++ fmet.is_fixed_pitch = 0; ++ ++ if(fmet.name_copyright==NULL) ++ fmet.name_copyright = ""; ++ ++ /* create the full name */ ++ l = strlen(fmet.name_family) ++ + (fmet.name_style? strlen(fmet.name_style) : 0) ++ + (fnwidth? strlen(fnwidth) : 0) ++ + strlen("Oblique") + 1; ++ ++ if(( fmet.name_full = malloc(l) )==NULL) { ++ fprintf (stderr, "****malloc failed %s line %d\n", __FILE__, __LINE__); ++ exit(255); ++ } ++ strcpy(fmet.name_full, fmet.name_family); ++ if(fnwidth && strcmp(fnwidth, "Normal")) { ++ strcat(fmet.name_full, fnwidth); ++ } ++ if(fmet.name_style && strcmp(fmet.name_style, "Medium")) { ++ strcat(fmet.name_full, fmet.name_style); ++ } ++ switch(toupper(slant[0])) { ++ case 'O': ++ strcat(fmet.name_full, "Oblique"); ++ break; ++ case 'I': ++ strcat(fmet.name_full, "Italic"); ++ break; ++ } ++ ++ fmet.name_ps = fmet.name_full; ++ fmet.name_version = "1.0"; ++ ++ if(charset_reg && charset_enc ++ && !strcmp(charset_reg, "iso10646") && !strcmp(charset_enc, "1")) ++ is_unicode = 1; ++ ++ if(( fontenc = calloc(nglyphs, sizeof *fontenc) )==NULL) { ++ fprintf (stderr, "****malloc failed %s line %d\n", __FILE__, __LINE__); ++ exit(255); ++ } ++ for(i=0; i=0 && e 255) ++ return 2; ++ else ++ return 0; ++} ++ ++/* ++ * Get the font metrics ++ */ ++static void ++fnmetrics( ++ struct font_metrics *fm ++) ++{ ++ *fm = fmet; ++} ++ ++/* ++ * Get the path of contrours for a glyph. ++ */ ++ ++static void ++glpath( ++ int glyphno, ++ GLYPH *glyf_list ++) ++{ ++ readglyphs(glyf_list); ++ glyf_list[glyphno].entries = glpaths[glyphno]; ++ glpaths[glyphno] = 0; ++} ++ ++/* ++ * Get the kerning data. ++ */ ++ ++static void ++kerning( ++ GLYPH *glyph_list ++) ++{ ++ return; /* no kerning in BDF */ ++} +diff -ruN xserver-old/hw/xprint/extras/ttf2pt1/bitmap.c xserver/hw/xprint/extras/ttf2pt1/bitmap.c +--- xserver-old/hw/xprint/extras/ttf2pt1/bitmap.c 1970-01-01 10:00:00.000000000 +1000 ++++ xserver/hw/xprint/extras/ttf2pt1/bitmap.c 2006-06-27 13:10:26.000000000 +1000 +@@ -0,0 +1,2633 @@ ++/* ++ * Handling of the bitmapped glyphs ++ * ++ * Copyright (c) 2001 by the TTF2PT1 project ++ * Copyright (c) 2001 by Sergey Babkin ++ * ++ * see COPYRIGHT for the full copyright notice ++ */ ++ ++#include ++#include ++#include ++#include "pt1.h" ++#include "global.h" ++ ++/* possible values of limits */ ++#define L_NONE 0 /* nothing here */ ++#define L_ON 1 /* black is on up/right */ ++#define L_OFF 2 /* black is on down/left */ ++ ++static int warnedhints = 0; ++ ++ ++#ifdef USE_AUTOTRACE ++#include ++ ++/* ++ * Produce an autotraced outline from a bitmap. ++ * scale - factor to scale the sizes ++ * bmap - array of dots by lines, xsz * ysz ++ * xoff, yoff - offset of the bitmap's lower left corner ++ * from the logical position (0,0) ++ */ ++ ++static void ++autotraced_bmp_outline( ++ GLYPH *g, ++ int scale, ++ char *bmap, ++ int xsz, ++ int ysz, ++ int xoff, ++ int yoff ++) ++{ ++ at_bitmap_type atb; ++ at_splines_type *atsp; ++ at_fitting_opts_type *atoptsp; ++ at_spline_list_type *slp; ++ at_spline_type *sp; ++ int i, j, k; ++ double lastx, lasty; ++ double fscale; ++ char *xbmap; ++ ++ fscale = (double)scale; ++ ++ /* provide a white margin around the bitmap */ ++ xbmap = malloc((ysz+2)*(xsz+2)); ++ if(xbmap == 0) { ++ fprintf (stderr, "****malloc failed %s line %d\n", __FILE__, __LINE__); ++ exit(255); ++ } ++ memset(xbmap, 0, xsz+2); /* top margin */ ++ for(i=0, j=xsz+2; ilength; i++) { ++ slp = &atsp->data[i]; ++#if 0 ++ fprintf(stderr, "%s: contour %d: %d entries clockwise=%d color=%02X%02X%02X\n", ++ g->name, i, slp->length, slp->clockwise, slp->color.r, slp->color.g, slp->color.b); ++#endif ++ if(slp->length == 0) ++ continue; ++#if 0 ++ if(slp->color.r + slp->color.g + slp->color.b == 0) ++ continue; ++#endif ++ fg_rmoveto(g, fscale*(slp->data[0].v[0].x+xoff), fscale*(slp->data[0].v[0].y+yoff)); ++ for(j=0; jlength; j++) { ++#if 0 ++ fprintf(stderr, " "); ++ for(k=0; k<4; k++) ++ fprintf(stderr, "(%g %g) ", ++ fscale*(slp->data[j].v[k].x+xoff), ++ fscale*(ysz-slp->data[j].v[k].y+yoff) ++ ); ++ fprintf(stderr, "\n"); ++#endif ++ fg_rrcurveto(g, ++ fscale*(slp->data[j].v[1].x+xoff), fscale*(slp->data[j].v[1].y+yoff), ++ fscale*(slp->data[j].v[2].x+xoff), fscale*(slp->data[j].v[2].y+yoff), ++ fscale*(slp->data[j].v[3].x+xoff), fscale*(slp->data[j].v[3].y+yoff) ); ++ } ++ g_closepath(g); ++ } ++ ++ at_splines_free(atsp); ++ at_fitting_opts_free(atoptsp); ++ free(xbmap); ++} ++ ++#endif /*USE_AUTOTRACE*/ ++ ++/* an extension of gentry for description of the fragments */ ++typedef struct gex_frag GEX_FRAG; ++struct gex_frag { ++ /* indexes to len, the exact values and order are important */ ++#define GEXFI_NONE -1 ++#define GEXFI_CONVEX 0 ++#define GEXFI_CONCAVE 1 ++#define GEXFI_LINE 2 /* a line with steps varying by +-1 pixel */ ++#define GEXFI_EXACTLINE 3 /* a line with exactly the same steps */ ++#define GEXFI_SERIF 4 /* small serifs at the ends of stemsi - must be last */ ++#define GEXFI_COUNT 5 /* maximal index + 1 */ ++ unsigned short len[GEXFI_COUNT]; /* length of various fragment types starting here */ ++ unsigned short lenback[GEXFI_COUNT]; /* length back to the start of curve */ ++ ++ signed char ixstart; /* index of the frag type that starts here */ ++ signed char ixcont; /* index of the frag type that continues here */ ++ ++ short flags; ++#define GEXFF_HLINE 0x0001 /* the exact line is longer in "horizontal" dimension */ ++#define GEXFF_EXTR 0x0002 /* this gentry is an extremum in some direction */ ++#define GEXFF_CIRC 0x0004 /* the joint at this gentry is for a circular curve */ ++#define GEXFF_DRAWCURVE 0x0008 /* vect[] describes a curve to draw */ ++#define GEXFF_DRAWLINE 0x0010 /* vect[] describes a line to draw */ ++#define GEXFF_SPLIT 0x0020 /* is a result of splitting a line */ ++#define GEXFF_SYMNEXT 0x0040 /* this subfrag is symmetric with next one */ ++#define GEXFF_DONE 0x0080 /* this subfrag has been vectorized */ ++#define GEXFF_LONG 0x0100 /* this gentry is longer than 1 pixel */ ++ ++ unsigned short aidx; /* index of gentry in the array representing the contour */ ++ ++ unsigned short vectlen; /* number of gentries represented by vect[] */ ++ ++ /* coordinates for vectored replacement of this fragment */ ++ /* (already scaled because it's needed for curve approximation) */ ++ double vect[4 /*ref.points*/][2 /*X,Y*/]; ++ ++ double bbox[2 /*X,Y*/]; /* absolute sizes of bounding box of a subfragment */ ++ ++ /* used when splitting the curved frags into subfrags */ ++ GENTRY *prevsub; /* to gentries describing neighboring subfrags */ ++ GENTRY *nextsub; ++ GENTRY *ordersub; /* single-linked list describing the order of calculation */ ++ ++ int sublen; /* length of this subfrag */ ++ /* the symmetry across the subfrags */ ++ int symaxis; /* the symmetry axis, with next subfrag */ ++ int symxlen; /* min length of adjacent symmetric frags */ ++ /* the symmetry within this subfrag (the axis is always diagonal) */ ++ GENTRY *symge; /* symge->i{x,y}3 is the symmetry point of symge==0 if none */ ++ ++}; ++#define X_FRAG(ge) ((GEX_FRAG *)((ge)->ext)) ++ ++/* various interesting tables related to GEX_FRAG */ ++static char *gxf_name[GEXFI_COUNT] = {"Convex", "Concave", "Line", "ExLine", "Serif"}; ++static int gxf_cvk[2] = {-1, 1}; /* coefficients of concaveness */ ++ ++/* ++ * Dump the contents of X_EXT()->len and ->lenback for a contour ++ */ ++static void ++gex_dump_contour( ++ GENTRY *ge, ++ int clen ++) ++{ ++ int i, j; ++ ++ for(j = 0; j < GEXFI_COUNT; j++) { ++ fprintf(stderr, "%-8s", gxf_name[j]); ++ for(i = 0; i < clen; i++, ge = ge->frwd) ++ fprintf(stderr, " %2d", X_FRAG(ge)->len[j]); ++ fprintf(stderr, " %p\n (back) ", ge); ++ for(i = 0; i < clen; i++, ge = ge->frwd) ++ fprintf(stderr, " %2d", X_FRAG(ge)->lenback[j]); ++ fprintf(stderr, "\n"); ++ } ++} ++ ++/* ++ * Calculate values of X_EXT()->lenback[] for all entries in ++ * a contour. The contour is identified by: ++ * ge - any gentry of the contour ++ * clen - contour length ++ */ ++ ++static void ++gex_calc_lenback( ++ GENTRY *ge, ++ int clen ++) ++{ ++ int i, j; ++ int end; ++ GEX_FRAG *f; ++ int len[GEXFI_COUNT]; /* length of the most recent fragment */ ++ int count[GEXFI_COUNT]; /* steps since beginning of the fragment */ ++ ++ for(j = 0; j < GEXFI_COUNT; j++) ++ len[j] = count[j] = 0; ++ ++ end = clen; ++ for(i = 0; i < end; i++, ge = ge->frwd) { ++ f = X_FRAG(ge); ++ for(j = 0; j < GEXFI_COUNT; j++) { ++ if(len[j] != count[j]) { ++ f->lenback[j] = count[j]++; ++ } else ++ f->lenback[j] = 0; ++ if(f->len[j] != 0) { ++ len[j] = f->len[j]; ++ count[j] = 1; /* start with the next gentry */ ++ /* if the fragment will wrap over the start, process to its end */ ++ if(i < clen && i + len[j] > end) ++ end = i + len[j]; ++ } ++ } ++ } ++ gex_dump_contour(ge, clen); ++} ++ ++/* Limit a curve to not exceed the given coordinates ++ * at its given side ++ */ ++ ++static void ++limcurve( ++ double curve[4][2 /*X,Y*/], ++ double lim[2 /*X,Y*/], ++ int where /* 0 - start, 3 - end */ ++) ++{ ++ int other = 3-where; /* the other end */ ++ int sgn[2 /*X,Y*/]; /* sign for comparison */ ++ double t, from, to, nt, t2, nt2, tt[4]; ++ double val[2 /*X,Y*/]; ++ int i; ++ ++ for(i=0; i<2; i++) ++ sgn[i] = fsign(curve[other][i] - curve[where][i]); ++ ++#if 0 ++ fprintf(stderr, " limit (%g,%g)-(%g,%g) at %d by (%g,%g), sgn(%d,%d)\n", ++ curve[0][0], curve[0][1], curve[3][0], curve[3][1], ++ where, lim[0], lim[1], sgn[0], sgn[1]); ++#endif ++ /* a common special case */ ++ if( sgn[0]*(curve[where][0] - lim[0]) >= 0. ++ && sgn[1]*(curve[where][1] - lim[1]) >= 0. ) ++ return; /* nothing to do */ ++ ++ if(other==0) { ++ from = 0.; ++ to = 1.; ++ } else { ++ from = 1.; ++ to = 0.; ++ } ++#if 0 ++ fprintf(stderr, "t="); ++#endif ++ while( fabs(from-to) > 0.00001 ) { ++ t = 0.5 * (from+to); ++ t2 = t*t; ++ nt = 1.-t; ++ nt2 = nt*nt; ++ tt[0] = nt2*nt; ++ tt[1] = 3*nt2*t; ++ tt[2] = 3*nt*t2; ++ tt[3] = t*t2; ++ for(i=0; i<2; i++) ++ val[i] = curve[0][i]*tt[0] + curve[1][i]*tt[1] ++ + curve[2][i]*tt[2] + curve[3][i]*tt[3]; ++#if 0 ++ fprintf(stderr, "%g(%g,%g) ", t, val[0], val[1]); ++#endif ++ if(fabs(val[0] - lim[0]) < 0.1 ++ || fabs(val[1] - lim[1]) < 0.1) ++ break; ++ ++ if(sgn[0] * (val[0] - lim[0]) < 0. ++ || sgn[1] * (val[1] - lim[1]) < 0.) ++ to = t; ++ else ++ from = t; ++ } ++ /* now t is the point of splitting */ ++#define SPLIT(pt1, pt2) ( (pt1) + t*((pt2)-(pt1)) ) /* order is important! */ ++ for(i=0; i<2; i++) { ++ double v11, v12, v13, v21, v22, v31; /* intermediate points */ ++ ++ v11 = SPLIT(curve[0][i], curve[1][i]); ++ v12 = SPLIT(curve[1][i], curve[2][i]); ++ v13 = SPLIT(curve[2][i], curve[3][i]); ++ v21 = SPLIT(v11, v12); ++ v22 = SPLIT(v12, v13); ++ v31 = SPLIT(v21, v22); ++ if(other==0) { ++ curve[1][i] = v11; ++ curve[2][i] = v21; ++ curve[3][i] = fabs(v31 - lim[i]) < 0.1 ? lim[i] : v31; ++ } else { ++ curve[0][i] = fabs(v31 - lim[i]) < 0.1 ? lim[i] : v31; ++ curve[1][i] = v22; ++ curve[2][i] = v13; ++ } ++ } ++#undef SPLIT ++#if 0 ++ fprintf(stderr, "\n"); ++#endif ++} ++ ++/* ++ * Vectorize a subfragment of a curve fragment. All the data has been already ++ * collected by this time ++ */ ++ ++static void ++dosubfrag( ++ GLYPH *g, ++ int fti, /* fragment type index */ ++ GENTRY *firstge, /* first gentry of fragment */ ++ GENTRY *ge, /* first gentry of subfragment */ ++ double fscale ++) ++{ ++ GENTRY *gel, *gei; /* last gentry of this subfrag */ ++ GEX_FRAG *f, *ff, *lf, *pf, *xf; ++ /* maximal amount of space that can be used at the beginning and the end */ ++ double fixfront[2], fixend[2]; /* fixed points - used to show direction */ ++ double mvfront[2], mvend[2]; /* movable points */ ++ double limfront[2], limend[2]; /* limit of movement for movabel points */ ++ double sympt; ++ int outfront, outend; /* the beginning/end is going outwards */ ++ int symfront, symend; /* a ready symmetric fragment is present at front/end */ ++ int drnd[2 /*X,Y*/]; /* size of the round part */ ++ int i, j, a1, a2, ndots; ++ double avg2, max2; /* squared distances */ ++ struct dot_dist *dots, *usedots; ++ ++ ff = X_FRAG(firstge); ++ f = X_FRAG(ge); ++ gel = f->nextsub; ++ lf = X_FRAG(gel); ++ if(f->prevsub != 0) ++ pf = X_FRAG(f->prevsub); ++ else ++ pf = 0; ++ ++ for(i=0; i<2; i++) ++ drnd[i] = gel->bkwd->ipoints[i][2] - ge->ipoints[i][2]; ++ ++ if(f->prevsub==0 && f->ixcont == GEXFI_NONE) { ++ /* nothing to join with : may use the whole length */ ++ for(i = 0; i < 2; i++) ++ limfront[i] = ge->bkwd->ipoints[i][2]; ++ } else { ++ /* limit to a half */ ++ for(i = 0; i < 2; i++) ++ limfront[i] = 0.5 * (ge->ipoints[i][2] + ge->bkwd->ipoints[i][2]); ++ } ++ if( (ge->ix3 == ge->bkwd->ix3) /* vert */ ++ ^ (isign(ge->bkwd->ix3 - ge->frwd->ix3)==isign(ge->bkwd->iy3 - ge->frwd->iy3)) ++ ^ (fti == GEXFI_CONCAVE) /* counter-clockwise */ ) { ++ /* the beginning is not a flat 90-degree end */ ++ outfront = 1; ++ for(i = 0; i < 2; i++) ++ fixfront[i] = ge->frwd->ipoints[i][2]; ++ } else { ++ outfront = 0; ++ for(i = 0; i < 2; i++) ++ fixfront[i] = ge->ipoints[i][2]; ++ } ++ ++ if(lf->nextsub==0 && lf->ixstart == GEXFI_NONE) { ++ /* nothing to join with : may use the whole length */ ++ for(i = 0; i < 2; i++) ++ limend[i] = gel->ipoints[i][2]; ++ } else { ++ /* limit to a half */ ++ for(i = 0; i < 2; i++) ++ limend[i] = 0.5 * (gel->ipoints[i][2] + gel->bkwd->ipoints[i][2]); ++ } ++ gei = gel->bkwd->bkwd; ++ if( (gel->ix3 == gel->bkwd->ix3) /* vert */ ++ ^ (isign(gel->ix3 - gei->ix3)==isign(gel->iy3 - gei->iy3)) ++ ^ (fti == GEXFI_CONVEX) /* clockwise */ ) { ++ /* the end is not a flat 90-degree end */ ++ outend = 1; ++ for(i = 0; i < 2; i++) ++ fixend[i] = gel->bkwd->bkwd->ipoints[i][2]; ++ } else { ++ outend = 0; ++ for(i = 0; i < 2; i++) ++ fixend[i] = gel->bkwd->ipoints[i][2]; ++ } ++ ++ for(i = 0; i < 2; i++) { ++ fixfront[i] *= fscale; ++ limfront[i] *= fscale; ++ fixend[i] *= fscale; ++ limend[i] *= fscale; ++ } ++ ++ fprintf(stderr, " %d out(%d[%d %d %d],%d[%d %d %d]) drnd(%d, %d)\n", ++ fti, ++ outfront, ++ (ge->ix3 == ge->bkwd->ix3), ++ (isign(ge->bkwd->ix3 - ge->frwd->ix3)==isign(ge->bkwd->iy3 - ge->frwd->iy3)), ++ (fti == GEXFI_CONCAVE), ++ outend, ++ (gel->ix3 == gel->bkwd->ix3), ++ (isign(gel->ix3 - gei->ix3)==isign(gel->iy3 - gei->iy3)), ++ (fti == GEXFI_CONVEX), ++ drnd[0], drnd[1]); ++ ++ /* prepare to calculate the distances */ ++ ndots = f->sublen - 1; ++ dots = malloc(sizeof(*dots) * ndots); ++ if(dots == 0) { ++ fprintf (stderr, "****malloc failed %s line %d\n", __FILE__, __LINE__); ++ exit(255); ++ } ++ for(i = 0, gei = ge; i < ndots; i++, gei = gei->frwd) { ++ for(a1 = 0; a1 < 2; a1++) ++ dots[i].p[a1] = fscale * gei->ipoints[a1][2]; ++ } ++ ++ /* see if we can mirror a ready symmetric curve */ ++ ++ /* check symmetry with the fragment before this */ ++ symfront = (pf != 0 && (pf->flags & GEXFF_SYMNEXT) && (pf->flags & GEXFF_DONE) ++ && ( outend && f->sublen <= pf->sublen ++ || ( pf->sublen == f->sublen ++ && (lf->sublen == 0 ++ || ( abs(limfront[0]-limend[0]) >= abs(pf->vect[0][0]-pf->vect[3][0]) ++ && abs(limfront[1]-limend[1]) >= abs(pf->vect[0][1]-pf->vect[3][1]) )) ++ ) ++ ) ++ ); ++ /* check symmetry with the fragment after this */ ++ symend = ( (f->flags & GEXFF_SYMNEXT) && (lf->flags & GEXFF_DONE) ++ && ( outfront && f->sublen <= lf->sublen ++ || ( lf->sublen == f->sublen ++ && (pf == 0 ++ || ( abs(limfront[0]-limend[0]) >= abs(lf->vect[0][0]-lf->vect[3][0]) ++ && abs(limfront[1]-limend[1]) >= abs(lf->vect[0][1]-lf->vect[3][1]) )) ++ ) ++ ) ++ ); ++ if(symfront || symend) { ++ /* mirror the symmetric neighbour subfrag */ ++ if(symfront) { ++ a1 = (ge->ix3 != ge->bkwd->ix3); /* the symmetry axis */ ++ a2 = !a1; /* the other axis (goes along the extremum gentry) */ ++ ++ /* the symmetry point on a2 */ ++ sympt = fscale * 0.5 * (ge->ipoints[a2][2] + ge->bkwd->ipoints[a2][2]); ++ xf = pf; /* the symmetric fragment */ ++ } else { ++ a1 = (gel->ix3 != gel->bkwd->ix3); /* the symmetry axis */ ++ a2 = !a1; /* the other axis (goes along the extremum gentry) */ ++ ++ /* the symmetry point on a2 */ ++ sympt = fscale * 0.5 * (gel->ipoints[a2][2] + gel->bkwd->ipoints[a2][2]); ++ xf = lf; /* the symmetric fragment */ ++ } ++ fprintf(stderr, " sym with %p f=%d(%p) e=%d(%p) a1=%c a2=%c sympt=%g\n", ++ xf, symfront, pf, symend, lf, ++ a1 ? 'Y': 'X', a2 ? 'Y': 'X', sympt ++ ); ++ for(i=0; i<4; i++) { ++ f->vect[3-i][a1] = xf->vect[i][a1]; ++ f->vect[3-i][a2] = sympt - (xf->vect[i][a2]-sympt); ++ } ++ if(symfront) { ++ if(outend || lf->sublen==0) ++ limcurve(f->vect, limend, 3); ++ } else { ++ if(outfront || pf == 0) ++ limcurve(f->vect, limfront, 0); ++ } ++ avg2 = fdotcurvdist2(f->vect, dots, ndots, &max2); ++ fprintf(stderr, " avg=%g max=%g fscale=%g\n", sqrt(avg2), sqrt(max2), fscale); ++ if(max2 <= fscale*fscale) { ++ f->flags |= (GEXFF_DONE | GEXFF_DRAWCURVE); ++ f->vectlen = f->sublen; ++ free(dots); ++ return; ++ } ++ } ++ ++ if( !outfront && !outend && f->symge != 0) { ++ /* a special case: try a circle segment as an approximation */ ++ double lenfront, lenend, len, maxlen; ++ ++ /* coefficient for a Bezier approximation of a circle */ ++#define CIRCLE_FRAC 0.55 ++ ++ a1 = (ge->ix3 == ge->bkwd->ix3); /* get the axis along the front */ ++ a2 = !a1; /* axis along the end */ ++ ++ lenfront = fixfront[a1] - limfront[a1]; ++ lenend = fixend[a2] - limend[a2]; ++ if(fabs(lenfront) < fabs(lenend)) ++ len = fabs(lenfront); ++ else ++ len = fabs(lenend); ++ ++ /* make it go close to the round shape */ ++ switch(f->sublen) { ++ case 2: ++ maxlen = fscale; ++ break; ++ case 4: ++ case 6: ++ maxlen = fscale * 2.; ++ break; ++ default: ++ maxlen = fscale * abs(ge->frwd->frwd->ipoints[a1][2] ++ - ge->ipoints[a1][2]); ++ break; ++ } ++ if(len > maxlen) ++ len = maxlen; ++ ++ mvfront[a1] = fixfront[a1] - fsign(lenfront) * len; ++ mvfront[a2] = limfront[a2]; ++ mvend[a2] = fixend[a2] - fsign(lenend) * len; ++ mvend[a1] = limend[a1]; ++ ++ for(i=0; i<2; i++) { ++ f->vect[0][i] = mvfront[i]; ++ f->vect[3][i] = mvend[i]; ++ } ++ f->vect[1][a1] = mvfront[a1] + CIRCLE_FRAC*(mvend[a1]-mvfront[a1]); ++ f->vect[1][a2] = mvfront[a2]; ++ f->vect[2][a1] = mvend[a1]; ++ f->vect[2][a2] = mvend[a2] + CIRCLE_FRAC*(mvfront[a2]-mvend[a2]); ++ ++ avg2 = fdotcurvdist2(f->vect, dots, ndots, &max2); ++ fprintf(stderr, " avg=%g max=%g fscale=%g\n", sqrt(avg2), sqrt(max2), fscale); ++ if(max2 <= fscale*fscale) { ++ f->flags |= (GEXFF_DONE | GEXFF_DRAWCURVE); ++ f->vectlen = f->sublen; ++ free(dots); ++ return; ++ } ++#undef CIRCLE_FRAC ++ } ++ for(i=0; i<2; i++) { ++ f->vect[0][i] = limfront[i]; ++ f->vect[1][i] = fixfront[i]; ++ f->vect[2][i] = fixend[i]; ++ f->vect[3][i] = limend[i]; ++ } ++ usedots = dots; ++ if(outfront) { ++ usedots++; ndots--; ++ } ++ if(outend) ++ ndots--; ++ if( fcrossrayscv(f->vect, NULL, NULL) == 0) { ++ fprintf(stderr, "**** Internal error: rays must cross but don't at %p-%p\n", ++ ge, gel); ++ fprintf(stderr, " (%g, %g) (%g, %g) (%g, %g) (%g, %g)\n", ++ limfront[0], limfront[1], ++ fixfront[0], fixfront[1], ++ fixend[0], fixend[1], ++ limend[0], limend[1] ++ ); ++ dumppaths(g, NULL, NULL); ++ exit(1); ++ } else { ++ if(ndots != 0) ++ fapproxcurve(f->vect, usedots, ndots); ++ f->flags |= (GEXFF_DONE | GEXFF_DRAWCURVE); ++ f->vectlen = f->sublen; ++ } ++ free(dots); ++} ++ ++/* ++ * Subtract a list of gentries (covered by a fragment of higher ++ * priority) from the set of fragments of a given ++ * type. ++ * ++ * An example is subtraction of the long exact line fragments ++ * from the curve fragments which get overridden. ++ */ ++ ++static void ++frag_subtract( ++ GLYPH *g, ++ GENTRY **age, /* array of gentries for this contour */ ++ int clen, /* length of the contour */ ++ GENTRY *ge, /* first gentry to be subtracted */ ++ int slen, /* number of gentries in the list to be subtracted */ ++ int d /* type of fragments from which to subtract, as in GEXFI_... */ ++) ++{ ++ GENTRY *pge; ++ GEX_FRAG *f, *pf; ++ int len, i, j; ++ ++ f = X_FRAG(ge); ++ len = slen; ++ ++ /* check if we overlap the end of some fragment */ ++ if(f->lenback[d]) { ++ /* chop off the end of conflicting fragment */ ++ len = f->lenback[d]; ++ pge = age[(f->aidx + clen - len)%clen]; ++ pf = X_FRAG(pge); ++ if(pf->len[d] == clen+1 && pf->flags & GEXFF_CIRC) { ++ /* the conflicting fragment is self-connected */ ++ ++ pf->len[d] = 0; ++ /* calculate the new value for lenback */ ++ len = clen+1 - slen; ++ for(pge = ge; len > 0; pge = pge->bkwd, len--) ++ X_FRAG(pge)->lenback[d] = len; ++ /* now pge points to the last entry of the line, ++ * which is also the new first entry of the curve ++ */ ++ X_FRAG(pge)->len[d] = clen+2 - slen; ++ /* clean lenback of gentries covered by the line */ ++ for(pge = ge->frwd, j = slen-1; j > 0; pge = pge->frwd, j--) ++ X_FRAG(pge)->lenback[d] = 0; ++ fprintf(stderr, " cut %s circular frag to %p-%p\n", ++ gxf_name[d], pge, ge); ++ gex_dump_contour(ge, clen); ++ } else { ++ /* when we chop off a piece of fragment, we leave the remaining ++ * piece(s) overlapping with the beginning and possibly the end ++ * of the line fragment under consideration ++ */ ++ fprintf(stderr, " cut %s frag at %p from len=%d to len=%d (end %p)\n", ++ gxf_name[d], pge, pf->len[d], len+1, ge); ++ j = pf->len[d] - len - 1; /* how many gentries are chopped off */ ++ pf->len[d] = len + 1; ++ i = slen - 1; ++ for(pge = ge->frwd; j > 0 && i > 0; j--, i--, pge = pge->frwd) ++ X_FRAG(pge)->lenback[d] = 0; ++ gex_dump_contour(ge, clen); ++ ++ if(j != 0) { ++ /* the conflicting fragment is split in two by this line ++ * fragment, fix up its tail ++ */ ++ ++ fprintf(stderr, " end of %s frag len=%d %p-", ++ gxf_name[d], j+1, pge->bkwd); ++ X_FRAG(pge->bkwd)->len[d] = j+1; /* the overlapping */ ++ for(i = 1; j > 0; j--, i++, pge = pge->frwd) ++ X_FRAG(pge)->lenback[d] = i; ++ fprintf(stderr, "%p\n", pge->bkwd); ++ gex_dump_contour(ge, clen); ++ } ++ } ++ } ++ /* check if we overlap the beginning of some fragments */ ++ i = slen-1; /* getntries remaining to consider */ ++ j = 0; /* gentries remaining in the overlapping fragment */ ++ for(pge = ge; i > 0; i--, pge = pge->frwd) { ++ if(j > 0) { ++ X_FRAG(pge)->lenback[d] = 0; ++ j--; ++ } ++ /* the beginning of one fragment may be the end of another ++ * fragment, in this case if j-- above results in 0, that will ++ * cause it to check the same gentry for the beginning ++ */ ++ if(j == 0) { ++ pf = X_FRAG(pge); ++ j = pf->len[d]; ++ if(j != 0) { ++ fprintf(stderr, " removed %s frag at %p len=%d\n", ++ gxf_name[d], pge, j); ++ gex_dump_contour(ge, clen); ++ pf->len[d] = 0; ++ j--; ++ } ++ } ++ } ++ /* pge points at the last gentry of the line fragment */ ++ if(j > 1) { /* we have the tail of a fragment left */ ++ fprintf(stderr, " end of %s frag len=%d %p-", ++ gxf_name[d], j, pge); ++ X_FRAG(pge)->len[d] = j; /* the overlapping */ ++ for(i = 0; j > 0; j--, i++, pge = pge->frwd) ++ X_FRAG(pge)->lenback[d] = i; ++ fprintf(stderr, "%p\n", pge->bkwd); ++ gex_dump_contour(ge, clen); ++ } else if(j == 1) { ++ X_FRAG(pge)->lenback[d] = 0; ++ } ++} ++ ++/* ++ * Produce an outline from a bitmap. ++ * scale - factor to scale the sizes ++ * bmap - array of dots by lines, xsz * ysz ++ * xoff, yoff - offset of the bitmap's lower left corner ++ * from the logical position (0,0) ++ */ ++ ++void ++bmp_outline( ++ GLYPH *g, ++ int scale, ++ char *bmap, ++ int xsz, ++ int ysz, ++ int xoff, ++ int yoff ++) ++{ ++ char *hlm, *vlm; /* arrays of the limits of outlines */ ++ char *amp; /* map of ambiguous points */ ++ int x, y; ++ char *ip, *op; ++ double fscale; ++ ++ if(xsz==0 || ysz==0) ++ return; ++ ++#ifdef USE_AUTOTRACE ++ if(use_autotrace) { ++ autotraced_bmp_outline(g, scale, bmap, xsz, ysz, xoff, yoff); ++ return; ++ } ++#endif /*USE_AUTOTRACE*/ ++ ++ fscale = (double)scale; ++ g->flags &= ~GF_FLOAT; /* build it as int first */ ++ ++ if(!warnedhints) { ++ warnedhints = 1; ++ if(hints && subhints) { ++ WARNING_2 fprintf(stderr, ++ "Use of hint substitution on bitmap fonts is not recommended\n"); ++ } ++ } ++ ++#if 0 ++ printbmap(bmap, xsz, ysz, xoff, yoff); ++#endif ++ ++ /* now find the outlines */ ++ hlm=calloc( xsz, ysz+1 ); /* horizontal limits */ ++ vlm=calloc( xsz+1, ysz ); /* vertical limits */ ++ amp=calloc( xsz, ysz ); /* ambiguous points */ ++ ++ if(hlm==0 || vlm==0 || amp==0) { ++ fprintf (stderr, "****malloc failed %s line %d\n", __FILE__, __LINE__); ++ exit(255); ++ } ++ ++ /* ++ * hlm and vlm represent a grid of horisontal and ++ * vertical lines. Each pixel is surrounded by the grid ++ * from all the sides. The values of [hv]lm mark the ++ * parts of grid where the pixel value switches from white ++ * to black and back. ++ */ ++ ++ /* find the horizontal limits */ ++ ip=bmap; op=hlm; ++ /* 1st row */ ++ for(x=0; x0; y--) ++ for(x=xsz-1; x>0; x--) { ++ if(bmap[y*xsz+x]) { ++ if( !bmap[y*xsz+x-1] && !bmap[y*xsz-xsz+x] && bmap[y*xsz-xsz+x-1] ) ++ amp[y*xsz+x]=1; ++ } else { ++ if( bmap[y*xsz+x-1] && bmap[y*xsz-xsz+x] && !bmap[y*xsz-xsz+x-1] ) ++ amp[y*xsz+x]=1; ++ } ++ } ++ ++#if 0 ++ printlimits(hlm, vlm, amp, xsz, ysz); ++#endif ++ ++ /* generate the vectored (stepping) outline */ ++ ++ while(1) { ++ int found = 0; ++ int outer; /* flag: this is an outer contour */ ++ int hor, newhor; /* flag: the current contour direction is horizontal */ ++ int dir; /* previous direction of the coordinate, 1 - L_ON, 0 - L_OFF */ ++ int startx, starty; /* start of a contour */ ++ int firstx, firsty; /* start of the current line */ ++ int newx, newy; /* new coordinates to try */ ++ char *lm, val; ++ int maxx, maxy, xor; ++ ++ for(y=ysz; !found && y>0; y--) ++ for(x=0; x L_NONE) ++ goto foundcontour; ++ break; /* have no contours left */ ++ ++ foundcontour: ++ ig_rmoveto(g, x+xoff, y+yoff); /* intermediate as int */ ++ ++ startx = firstx = x; ++ starty = firsty = y; ++ ++ if(hlm[y*xsz+x] == L_OFF) { ++ outer = 1; dir = 0; ++ hlm[y*xsz+x] = -hlm[y*xsz+x]; /* mark as seen */ ++ hor = 1; x++; ++ } else { ++ outer = 0; dir = 0; ++ hor = 0; y--; ++ vlm[y*(xsz+1)+x] = -vlm[y*(xsz+1)+x]; /* mark as seen */ ++ } ++ ++ while(x!=startx || y!=starty) { ++#if 0 ++ printf("trace (%d, %d) outer=%d hor=%d dir=%d\n", x, y, outer, hor, dir); ++#endif ++ ++ /* initialization common for try1 and try2 */ ++ if(hor) { ++ lm = vlm; maxx = xsz+1; maxy = ysz; newhor = 0; ++ } else { ++ lm = hlm; maxx = xsz; maxy = ysz+1; newhor = 1; ++ } ++ xor = (outer ^ hor ^ dir); ++ ++ try1: ++ /* first we try to change axis, to keep the ++ * contour as long as possible ++ */ ++ ++ newx = x; newy = y; ++ if(!hor && (!outer ^ dir)) ++ newx--; ++ if(hor && (!outer ^ dir)) ++ newy--; ++ ++ if(newx < 0 || newx >= maxx || newy < 0 || newy >= maxy) ++ goto try2; ++ ++ if(!xor) ++ val = L_ON; ++ else ++ val = L_OFF; ++#if 0 ++ printf("try 1, want %d have %d at %c(%d, %d)\n", val, lm[newy*maxx + newx], ++ (newhor ? 'h':'v'), newx, newy); ++#endif ++ if( lm[newy*maxx + newx] == val ) ++ goto gotit; ++ ++ try2: ++ /* try to change the axis anyway */ ++ ++ newx = x; newy = y; ++ if(!hor && (outer ^ dir)) ++ newx--; ++ if(hor && (outer ^ dir)) ++ newy--; ++ ++ if(newx < 0 || newx >= maxx || newy < 0 || newy >= maxy) ++ goto try3; ++ ++ if(xor) ++ val = L_ON; ++ else ++ val = L_OFF; ++#if 0 ++ printf("try 2, want %d have %d at %c(%d, %d)\n", val, lm[newy*maxx + newx], ++ (newhor ? 'h':'v'), newx, newy); ++#endif ++ if( lm[newy*maxx + newx] == val ) ++ goto gotit; ++ ++ try3: ++ /* try to continue in the old direction */ ++ ++ if(hor) { ++ lm = hlm; maxx = xsz; maxy = ysz+1; ++ } else { ++ lm = vlm; maxx = xsz+1; maxy = ysz; ++ } ++ newhor = hor; ++ newx = x; newy = y; ++ if(hor && dir) ++ newx--; ++ if(!hor && !dir) ++ newy--; ++ ++ if(newx < 0 || newx >= maxx || newy < 0 || newy >= maxy) ++ goto badtry; ++ ++ if(dir) ++ val = L_ON; ++ else ++ val = L_OFF; ++#if 0 ++ printf("try 3, want %d have %d at %c(%d, %d)\n", val, lm[newy*maxx + newx], ++ (newhor ? 'h':'v'), newx, newy); ++#endif ++ if( lm[newy*maxx + newx] == val ) ++ goto gotit; ++ ++ badtry: ++ fprintf(stderr, "**** Internal error in the contour detection code at (%d, %d)\n", x, y); ++ fprintf(stderr, "glyph='%s' outer=%d hor=%d dir=%d\n", g->name, outer, hor, dir); ++ fflush(stdout); ++ exit(1); ++ ++ gotit: ++ if(hor != newhor) { /* changed direction, end the previous line */ ++ ig_rlineto(g, x+xoff, y+yoff); /* intermediate as int */ ++ firstx = x; firsty = y; ++ } ++ lm[newy*maxx + newx] = -lm[newy*maxx + newx]; ++ hor = newhor; ++ dir = (val == L_ON); ++ if(newhor) ++ x -= (dir<<1)-1; ++ else ++ y += (dir<<1)-1; ++ } ++#if 0 ++ printf("trace (%d, %d) outer=%d hor=%d dir=%d\n", x, y, outer, hor, dir); ++#endif ++ ig_rlineto(g, x+xoff, y+yoff); /* intermediate as int */ ++ g_closepath(g); ++ } ++ ++ ++ /* try to vectorize the curves and sloped lines in the bitmap */ ++ if(vectorize) { ++ GENTRY *ge, *pge, *cge, *loopge; ++ int i; ++ int skip; ++ ++ dumppaths(g, NULL, NULL); ++ ++ /* allocate the extensions */ ++ for(cge=g->entries; cge!=0; cge=cge->next) { ++ cge->ext = calloc(1, sizeof(GEX_FRAG) ); ++ if(cge->ext == 0) { ++ fprintf (stderr, "****malloc failed %s line %d\n", __FILE__, __LINE__); ++ exit(255); ++ } ++ } ++ ++ for(cge=g->entries; cge!=0; cge=cge->next) { ++ if(cge->type != GE_MOVE) ++ continue; ++ ++ /* we've found the beginning of a contour */ ++ { ++ int d, vert, count, stepmore, delaystop; ++ int vdir, hdir, fullvdir, fullhdir, len; ++ int dx, dy, lastdx, lastdy; ++ int k1, k2, reversal, smooth, good; ++ int line[2 /*H,V*/], maxlen[2 /*H,V*/], minlen[2 /*H,V*/]; ++ GENTRY **age; /* array of gentries in a contour */ ++ int clen; /* contour length, size of ths array */ ++ int i, j; ++ GEX_FRAG *f; ++ ++ /* we know that all the contours start at the top-left corner, ++ * so at most it might be before/after the last element of ++ * the last/first fragment ++ */ ++ ++ ge = cge->next; ++ pge = ge->bkwd; ++ if(ge->ix3 == pge->ix3) { /* a vertical line */ ++ /* we want to start always from a horizontal line because ++ * then we always start from top and that is quaranteed to be a ++ * fragment boundary, so move the start point of the contour ++ */ ++ pge->prev->next = pge->next; ++ pge->next->prev = pge->prev; ++ cge->next = pge; ++ pge->prev = cge; ++ pge->next = ge; ++ ge->prev = pge; ++ ge = pge; pge = ge->bkwd; ++ cge->ix3 = pge->ix3; cge->iy3 = pge->iy3; ++ } ++ ++ /* fill the array of gentries */ ++ clen = 1; ++ for(ge = cge->next->frwd; ge != cge->next; ge = ge->frwd) ++ clen++; ++ age = (GENTRY **)malloc(sizeof(*age) * clen); ++ ge = cge->next; ++ count = 0; ++ do { ++ age[count] = ge; ++ X_FRAG(ge)->aidx = count++; ++ ++ /* and by the way find the extremums */ ++ for(i=0; i<2; i++) { ++ if( isign(ge->frwd->ipoints[i][2] - ge->ipoints[i][2]) ++ * isign(ge->bkwd->bkwd->ipoints[i][2] - ge->bkwd->ipoints[i][2]) == 1) { ++ X_FRAG(ge)->flags |= GEXFF_EXTR; ++ fprintf(stderr, " %s extremum at %p\n", (i?"vert":"hor"), ge); ++ } ++ if(abs(ge->ipoints[i][2] - ge->bkwd->ipoints[i][2]) > 1) ++ X_FRAG(ge)->flags |= GEXFF_LONG; ++ } ++ ++ ge = ge->frwd; ++ } while(ge != cge->next); ++ ++ /* Find the serif fragments, looking as either of: ++ * -+ | ++ * | | ++ * +-+ +-+ ++ * | | ++ * +--... +--... ++ * with the thickness of serifs being 1 pixel. We make no ++ * difference between serifs on vertical and horizontal stems. ++ */ ++ ++ ge = cge->next; ++ do { ++ GENTRY *nge; ++ int pdx, pdy, ndx, ndy; ++ ++ /* two gentries of length 1 mean a potential serif */ ++ pge = ge->bkwd; ++ nge = ge->frwd; ++ ++ dx = nge->ix3 - pge->ix3; ++ dy = nge->iy3 - pge->iy3; ++ ++ if(abs(dx) != 1 || abs(dy) != 1) /* 2 small ones */ ++ continue; ++ ++ if( ++ (!(X_FRAG(ge)->flags & GEXFF_EXTR) ++ || !(X_FRAG(ge->bkwd)->flags & GEXFF_EXTR)) ++ && (!(X_FRAG(ge->frwd)->flags & GEXFF_EXTR) ++ || !(X_FRAG(ge->frwd->frwd)->flags & GEXFF_EXTR)) ++ ) ++ continue; /* either side must be a couple of extremums */ ++ ++ pdx = pge->ix3 - pge->bkwd->ix3; ++ pdy = pge->iy3 - pge->bkwd->iy3; ++ ndx = nge->frwd->ix3 - nge->ix3; ++ ndy = nge->frwd->iy3 - nge->iy3; ++ ++ if(pdx*dx + pdy*dy > 0 && ndx*dx + ndy*dy > 0) ++ continue; /* definitely not a serif but a round corner */ ++ ++ if(abs(pdx) + abs(pdy) == 1 || abs(ndx) + abs(ndy) == 1) ++ continue; ++ ++ /* we've found a serif including this and next gentry */ ++ X_FRAG(ge)->len[GEXFI_SERIF] = 2; ++ ++ } while( (ge = ge->frwd) != cge->next ); ++ ++ ++ /* Find the convex and concave fragments, defined as: ++ * convex (clockwise): dy/dx <= dy0/dx0, ++ * or a reversal: dy/dx == - dy0/dx0 && abs(dxthis) == 1 && dy/dx > 0 ++ * concave (counter-clockwise): dy/dx >= dy0/dx0, ++ * or a reversal: dy/dx == - dy0/dx0 && abs(dxthis) == 1 && dy/dx < 0 ++ * ++ * Where dx and dy are measured between the end of this gentry ++ * and the start of the previous one (dx0 and dy0 are the same ++ * thing calculated for the previous gentry and its previous one), ++ * dxthis is between the end and begginning of this gentry. ++ * ++ * A reversal is a situation when the curve changes its direction ++ * along the x axis, so it passes through a momentary vertical ++ * direction. ++ */ ++ for(d = GEXFI_CONVEX; d<= GEXFI_CONCAVE; d++) { ++ ge = cge->next; ++ pge = ge->bkwd; /* the beginning of the fragment */ ++ count = 1; ++ lastdx = pge->ix3 - pge->bkwd->bkwd->ix3; ++ lastdy = pge->iy3 - pge->bkwd->bkwd->iy3; ++ ++#define CHKCURVCONN(ge, msg) do { \ ++ dx = (ge)->ix3 - (ge)->bkwd->bkwd->ix3; \ ++ dy = (ge)->iy3 - (ge)->bkwd->bkwd->iy3; \ ++ if(0 && msg) { \ ++ fprintf(stderr, " %p: dx=%d dy=%d dx0=%d dy0=%d ", \ ++ (ge), dx, dy, lastdx, lastdy); \ ++ } \ ++ k1 = X_FRAG(ge)->flags; \ ++ k2 = X_FRAG((ge)->bkwd)->flags; \ ++ if(0 && msg) { \ ++ fprintf(stderr, "fl=%c%c%c%c ", \ ++ (k1 & GEXFF_EXTR) ? 'X' : '-', \ ++ (k1 & GEXFF_LONG) ? 'L' : '-', \ ++ (k2 & GEXFF_EXTR) ? 'X' : '-', \ ++ (k2 & GEXFF_LONG) ? 'L' : '-' \ ++ ); \ ++ } \ ++ if( (k1 & GEXFF_EXTR) && (k2 & GEXFF_LONG) \ ++ || (k2 & GEXFF_EXTR) && (k1 & GEXFF_LONG) ) { \ ++ smooth = 0; \ ++ good = reversal = -1; /* for debugging */ \ ++ } else { \ ++ k1 = dy * lastdx; \ ++ k2 = lastdy * dx; \ ++ smooth = (abs(dx)==1 || abs(dy)==1); \ ++ good = (k1 - k2)*gxf_cvk[d] >= 0; \ ++ if(smooth && !good) { \ ++ reversal = (k1 == -k2 && abs((ge)->ix3 - (ge)->bkwd->ix3)==1 \ ++ && dy*dx*gxf_cvk[d] < 0); \ ++ } else \ ++ reversal = 0; \ ++ } \ ++ if(0 && msg) { \ ++ fprintf(stderr, "k1=%d k2=%d pge=%p count=%d %s good=%d rev=%d\n", \ ++ k1, k2, pge, count, gxf_name[d], good, reversal); \ ++ } \ ++ } while(0) ++ ++ do { ++ CHKCURVCONN(ge, 1); ++ ++ if(smooth && (good || reversal) ) ++ count++; ++ else { ++ /* can't continue */ ++#if 0 ++ if(count >= 4) { /* worth remembering */ ++ fprintf(stderr, " %s frag %p-%p count=%d\n", gxf_name[d], pge, ge->bkwd, count); ++ } ++#endif ++ X_FRAG(pge)->len[d] = count; ++ if(smooth) { ++ pge = ge->bkwd; ++ count = 2; ++ } else { ++ pge = ge; ++ count = 1; ++ } ++ } ++ lastdx = dx; lastdy = dy; ++ ge = ge->frwd; ++ } while(ge != cge->next); ++ ++ /* see if we can connect the last fragment to the first */ ++ CHKCURVCONN(ge, 1); ++ ++ if(smooth && (good || reversal) ) { ++ /* -1 to avoid ge->bkwd being counted twice */ ++ if( X_FRAG(ge->bkwd)->len[d] >= 2 ) ++ count += X_FRAG(ge->bkwd)->len[d] - 1; ++ else if(count == clen+1) { ++ /* we are joining a circular (closed) curve, check whether it ++ * can be joined at any point or whether it has a discontinuity ++ * at the point where we join it now ++ */ ++ lastdx = dx; lastdy = dy; ++ CHKCURVCONN(ge->frwd, 0); ++ ++ if(smooth && (good || reversal) ) { ++ /* yes, the curve is truly a circular one and can be ++ * joined at any point ++ */ ++ ++#if 0 ++ fprintf(stderr, " found a circular joint point at %p\n", pge); ++#endif ++ /* make sure that in a circular fragment we start from an extremum */ ++ while( ! (X_FRAG(pge)->flags & GEXFF_EXTR) ) ++ pge = pge->frwd; ++ X_FRAG(pge)->flags |= GEXFF_CIRC; ++ } ++ } ++#if 0 ++ fprintf(stderr, " %s joined %p to %p count=%d bk_count=%d\n", gxf_name[d], pge, ge->bkwd, ++ count, X_FRAG(ge->bkwd)->len[d] ); ++#endif ++ X_FRAG(ge->bkwd)->len[d] = 0; ++ } ++ X_FRAG(pge)->len[d] = count; ++#if 0 ++ if(count >= 4) { /* worth remembering */ ++ fprintf(stderr, " %s last frag %p-%p count=%d\n", gxf_name[d], pge, ge->bkwd, count); ++ } ++#endif ++#undef CHKCURVCONN ++ ++ /* do postprocessing */ ++ ge = cge->next; ++ do { ++ f = X_FRAG(ge); ++ len = f->len[d]; ++#if 0 ++ fprintf(stderr, " %p %s len=%d clen=%d\n", ge, gxf_name[d], len, clen); ++#endif ++ if(len < 3) /* get rid of the fragments that are too short */ ++ f->len[d] = 0; ++ else if(len == 3) { ++ /* _ ++ * drop the |_| - shaped fragments, leave alone the _| - shaped ++ * (and even those only if not too short in pixels), ++ * those left alone are further filtered later ++ */ ++ k1 = (ge->ix3 == ge->bkwd->ix3); /* axis of the start */ ++ if(isign(ge->ipoints[k1][2] - ge->bkwd->ipoints[k1][2]) ++ != isign(ge->frwd->ipoints[k1][2] - ge->frwd->frwd->ipoints[k1][2]) ++ && abs(ge->frwd->frwd->ipoints[k1][2] - ge->bkwd->ipoints[k1][2]) > 2) { ++#if 0 ++ fprintf(stderr, " %s frag %p count=%d good shape\n", ++ gxf_name[d], ge, count); ++#endif ++ } else ++ f->len[d] = 0; ++ } else if(len == clen+1) ++ break; /* a closed fragment, nothing else interesting */ ++ else { /* only for open fragments */ ++ GENTRY *gem, *gex, *gei, *ges; ++ ++ ges = ge; /* the start entry */ ++ gem = age[(f->aidx + f->len[d])%clen]; /* entry past the end of the fragment */ ++ ++ gei = ge->frwd; ++ if( (ge->ix3 == ge->bkwd->ix3) /* vert */ ++ ^ (isign(ge->bkwd->ix3 - gei->ix3)==isign(ge->bkwd->iy3 - gei->iy3)) ++ ^ !(d == GEXFI_CONVEX) /* counter-clockwise */ ) { ++ ++#if 0 ++ fprintf(stderr, " %p: %s potential spurious start\n", ge, gxf_name[d]); ++#endif ++ /* the beginning may be a spurious entry */ ++ ++ gex = 0; /* the extremum closest to the beginning - to be found */ ++ for(gei = ge->frwd; gei != gem; gei = gei->frwd) { ++ if(X_FRAG(gei)->flags & GEXFF_EXTR) { ++ gex = gei; ++ break; ++ } ++ } ++ if(gex == 0) ++ gex = gem->bkwd; ++ ++ /* A special case: ignore the spurious ends on small curves that ++ * either enclose an 1-pixel-wide extremum or are 1-pixel deep. ++ * Any 5-or-less-pixel-long curve with extremum 2 steps away ++ * qualifies for that. ++ */ ++ ++ if(len <= 5 && gex == ge->frwd->frwd) { ++ good = 0; ++#if 0 ++ fprintf(stderr, " E"); ++#endif ++ } else { ++ good = 1; /* assume that ge is not spurious */ ++ ++ /* gei goes backwards, gex goes forwards from the extremum */ ++ gei = gex; ++ /* i is the symmetry axis, j is the other axis (X=0 Y=1) */ ++ i = (gex->ix3 != gex->bkwd->ix3); ++ j = !i; ++ for( ; gei!=ge && gex!=gem; gei=gei->bkwd, gex=gex->frwd) { ++ if( gei->bkwd->ipoints[i][2] != gex->ipoints[i][2] ++ || gei->bkwd->ipoints[j][2] - gei->ipoints[j][2] ++ != gex->bkwd->ipoints[j][2] - gex->ipoints[j][2] ++ ) { ++ good = 0; /* no symmetry - must be spurious */ ++#if 0 ++ fprintf(stderr, " M(%p,%p)(%d %d,%d)(%d %d,%d)", ++ gei, gex, ++ i, gei->bkwd->ipoints[i][2], gex->ipoints[i][2], ++ j, gei->bkwd->ipoints[j][2] - gei->ipoints[j][2], ++ gex->bkwd->ipoints[j][2] - gex->ipoints[j][2] ); ++#endif ++ break; ++ } ++ } ++ if(gex == gem) { /* oops, the other side is too short */ ++ good = 0; ++#if 0 ++ fprintf(stderr, " X"); ++#endif ++ } ++ if(good && gei == ge) { ++ if( isign(gei->bkwd->ipoints[j][2] - gei->ipoints[j][2]) ++ != isign(gex->bkwd->ipoints[j][2] - gex->ipoints[j][2]) ) { ++ good = 0; /* oops, goes into another direction */ ++#if 0 ++ fprintf(stderr, " D"); ++#endif ++ } ++ } ++ } ++ if(!good) { /* it is spurious, drop it */ ++#if 0 ++ fprintf(stderr, " %p: %s spurious start\n", ge, gxf_name[d]); ++#endif ++ f->len[d] = 0; ++ ges = ge->frwd; ++ len--; ++ X_FRAG(ges)->len[d] = len; ++ } ++ } ++ ++ gei = gem->bkwd->bkwd->bkwd; ++ if( (gem->ix3 != gem->bkwd->ix3) /* gem->bkwd is vert */ ++ ^ (isign(gem->bkwd->ix3 - gei->ix3)==isign(gem->bkwd->iy3 - gei->iy3)) ++ ^ (d == GEXFI_CONVEX) /* clockwise */ ) { ++ ++#if 0 ++ fprintf(stderr, " %p: %s potential spurious end\n", gem->bkwd, gxf_name[d]); ++#endif ++ /* the end may be a spurious entry */ ++ ++ gex = 0; /* the extremum closest to the end - to be found */ ++ for(gei = gem->bkwd->bkwd; gei != ges->bkwd; gei = gei->bkwd) { ++ if(X_FRAG(gei)->flags & GEXFF_EXTR) { ++ gex = gei; ++ break; ++ } ++ } ++ if(gex == 0) ++ gex = ges; ++ ++ good = 1; /* assume that gem->bkwd is not spurious */ ++ /* gei goes backwards, gex goes forwards from the extremum */ ++ gei = gex; ++ /* i is the symmetry axis, j is the other axis (X=0 Y=1) */ ++ i = (gex->ix3 != gex->bkwd->ix3); ++ j = !i; ++ for( ; gei!=ges->bkwd && gex!=gem->bkwd; gei=gei->bkwd, gex=gex->frwd) { ++ if( gei->bkwd->ipoints[i][2] != gex->ipoints[i][2] ++ || gei->bkwd->ipoints[j][2] - gei->ipoints[j][2] ++ != gex->bkwd->ipoints[j][2] - gex->ipoints[j][2] ++ ) { ++ good = 0; /* no symmetry - must be spurious */ ++#if 0 ++ fprintf(stderr, " M(%p,%p)(%d %d,%d)(%d %d,%d)", ++ gei, gex, ++ i, gei->bkwd->ipoints[i][2], gex->ipoints[i][2], ++ j, gei->bkwd->ipoints[j][2] - gei->ipoints[j][2], ++ gex->bkwd->ipoints[j][2] - gex->ipoints[j][2] ); ++#endif ++ break; ++ } ++ } ++ if(gei == ges->bkwd) { /* oops, the other side is too short */ ++ good = 0; ++#if 0 ++ fprintf(stderr, " X"); ++#endif ++ } ++ if(good && gex == gem->bkwd) { ++ if( isign(gei->bkwd->ipoints[j][2] - gei->ipoints[j][2]) ++ != isign(gex->bkwd->ipoints[j][2] - gex->ipoints[j][2]) ) { ++ good = 0; /* oops, goes into another direction */ ++#if 0 ++ fprintf(stderr, " D"); ++#endif ++ } ++ } ++ if(!good) { /* it is spurious, drop it */ ++#if 0 ++ fprintf(stderr, " %p: %s spurious end\n", gem->bkwd, gxf_name[d]); ++#endif ++ X_FRAG(ges)->len[d] = --len; ++ } ++ } ++ if(len < 4) { ++ X_FRAG(ges)->len[d] = 0; ++#if 0 ++ fprintf(stderr, " %p: %s frag discarded, too small now\n", ge, gxf_name[d]); ++#endif ++ } ++ if(ges != ge) { ++ if(ges == cge->next) ++ break; /* went around the loop */ ++ else { ++ ge = ges->frwd; /* don't look at this fragment twice */ ++ continue; ++ } ++ } ++ } ++ ++ ge = ge->frwd; ++ } while(ge != cge->next); ++ } ++ ++ /* Find the straight line fragments. ++ * Even though the lines are sloped, they are called ++ * "vertical" or "horizontal" according to their longer ++ * dimension. All the steps in the shother dimension must ++ * be 1 pixel long, all the steps in the longer dimension ++ * must be within the difference of 1 pixel. ++ */ ++ for(d = GEXFI_LINE; d<= GEXFI_EXACTLINE; d++) { ++ ge = cge->next; ++ pge = ge->bkwd; /* the beginning of the fragment */ ++ count = 1; ++ delaystop = 0; ++ do { ++ int h; ++ ++ stepmore = 0; ++ hdir = isign(ge->ix3 - ge->bkwd->ix3); ++ vdir = isign(ge->iy3 - ge->bkwd->iy3); ++ vert = (hdir == 0); ++ if(count==1) { ++ /* at this point pge==ge->bkwd */ ++ /* account for the previous gentry, which was !vert */ ++ if(!vert) { /* prev was vertical */ ++ maxlen[0] = minlen[0] = 0; ++ maxlen[1] = minlen[1] = abs(pge->iy3 - pge->bkwd->iy3); ++ line[0] = (maxlen[1] == 1); ++ line[1] = 1; ++ fullhdir = hdir; ++ fullvdir = isign(pge->iy3 - pge->bkwd->iy3); ++ } else { ++ maxlen[0] = minlen[0] = abs(pge->ix3 - pge->bkwd->ix3); ++ maxlen[1] = minlen[1] = 0; ++ line[0] = 1; ++ line[1] = (maxlen[0] == 1); ++ fullhdir = isign(pge->ix3 - pge->bkwd->ix3); ++ fullvdir = vdir; ++ } ++ } ++ h = line[0]; /* remember the prevalent direction */ ++#if 0 ++ fprintf(stderr, " %p: v=%d(%d) h=%d(%d) vl(%d,%d,%d) hl=(%d,%d,%d) %s count=%d ", ++ ge, vdir, fullvdir, hdir, fullhdir, ++ line[1], minlen[1], maxlen[1], ++ line[0], minlen[0], maxlen[0], ++ gxf_name[d], count); ++#endif ++ if(vert) { ++ if(vdir != fullvdir) ++ line[0] = line[1] = 0; ++ len = abs(ge->iy3 - ge->bkwd->iy3); ++ } else { ++ if(hdir != fullhdir) ++ line[0] = line[1] = 0; ++ len = abs(ge->ix3 - ge->bkwd->ix3); ++ } ++#if 0 ++ fprintf(stderr, "len=%d\n", len); ++#endif ++ if(len != 1) /* this is not a continuation in the short dimension */ ++ line[!vert] = 0; ++ ++ /* can it be a continuation in the long dimension ? */ ++ if( line[vert] ) { ++ if(maxlen[vert]==0) ++ maxlen[vert] = minlen[vert] = len; ++ else if(maxlen[vert]==minlen[vert]) { ++ if(d == GEXFI_EXACTLINE) { ++ if(len != maxlen[vert]) ++ line[vert] = 0; /* it can't */ ++ } else if(len < maxlen[vert]) { ++ if(len < minlen[vert]-1) ++ line[vert] = 0; /* it can't */ ++ else ++ minlen[vert] = len; ++ } else { ++ if(len > maxlen[vert]+1) ++ line[vert] = 0; /* it can't */ ++ else ++ maxlen[vert] = len; ++ } ++ } else if(len < minlen[vert] || len > maxlen[vert]) ++ line[vert] = 0; /* it can't */ ++ } ++ ++ if(line[0] == 0 && line[1] == 0) { ++#if 0 ++ if(count >= 3) ++ fprintf(stderr, " %s frag %p-%p count=%d\n", gxf_name[d], pge, ge->bkwd, count); ++#endif ++ X_FRAG(pge)->len[d] = count; ++ if(d == GEXFI_EXACTLINE && h) { ++ X_FRAG(pge)->flags |= GEXFF_HLINE; ++ } ++ if(count == 1) ++ pge = ge; ++ else { ++ stepmore = 1; /* may reconsider the 1st gentry */ ++ pge = ge = ge->bkwd; ++ count = 1; ++ } ++ } else ++ count++; ++ ++ ge = ge->frwd; ++ if(ge == cge->next && !stepmore) ++ delaystop = 1; /* consider the first gentry again */ ++ } while(stepmore || ge != cge->next ^ delaystop); ++ /* see if there is an unfinished line left */ ++ if(count != 1) { ++#if 0 ++ if(count >= 3) ++ fprintf(stderr, " %s frag %p-%p count=%d\n", gxf_name[d], pge, ge->bkwd, count); ++#endif ++ X_FRAG(ge->bkwd->bkwd)->len[d] = 0; ++ X_FRAG(pge)->len[d] = count; ++ } ++ } ++ ++ /* do postprocessing of the lines */ ++#if 0 ++ fprintf(stderr, "Line postprocessing\n"); ++ gex_dump_contour(cge->next, clen); ++#endif ++ ++ /* the non-exact line frags are related to exact line frags sort ++ * of like to individual gentries: two kinds of exact frags ++ * must be interleaved, with one kind having the size of 3 ++ * and the other kind having the size varying within +-2. ++ */ ++ ++ ge = cge->next; ++ do { ++ GEX_FRAG *pf, *lastf1, *lastf2; ++ int len1, len2, fraglen; ++ ++ f = X_FRAG(ge); ++ ++ fraglen = f->len[GEXFI_LINE]; ++ if(fraglen >= 4) { ++ ++ vert = 0; /* vert is a pseudo-directon */ ++ line[0] = line[1] = 1; ++ maxlen[0] = minlen[0] = maxlen[1] = minlen[1] = 0; ++ lastf2 = lastf1 = f; ++ len2 = len1 = 0; ++ for(pge = ge, i = 1; i < fraglen; i++, pge=pge->frwd) { ++ pf = X_FRAG(pge); ++ len = pf->len[GEXFI_EXACTLINE]; ++#if 0 ++ fprintf(stderr, " pge=%p i=%d of %d ge=%p exLen=%d\n", pge, i, ++ f->len[GEXFI_LINE], ge, len); ++#endif ++ len1++; len2++; ++ if(len==0) { ++ continue; ++ } ++ vert = !vert; /* alternate the pseudo-direction */ ++ if(len > 3) ++ line[!vert] = 0; ++ if(maxlen[vert] == 0) ++ maxlen[vert] = minlen[vert] = len; ++ else if(maxlen[vert]-2 >= len && minlen[vert]+2 <= len) { ++ if(len > maxlen[vert]) ++ maxlen[vert] = len; ++ else if(len < minlen[vert]) ++ minlen[vert] = len; ++ } else ++ line[vert] = 0; ++ if(line[0] == 0 && line[1] == 0) { ++#if 0 ++ fprintf(stderr, " Line breaks at %p %c(%d, %d) %c(%d, %d) len=%d fl=%d l2=%d l1=%d\n", ++ pge, (!vert)?'*':' ', minlen[0], maxlen[0], ++ vert?'*':' ', minlen[1], maxlen[1], len, fraglen, len2, len1); ++#endif ++ if(lastf2 != lastf1) { ++ lastf2->len[GEXFI_LINE] = len2-len1; ++ } ++ lastf1->len[GEXFI_LINE] = len1+1; ++ pf->len[GEXFI_LINE] = fraglen+1 - i; ++#if 0 ++ gex_dump_contour(pge, clen); ++#endif ++ ++ /* continue with the line */ ++ vert = 0; /* vert is a pseudo-directon */ ++ line[0] = line[1] = 1; ++ maxlen[0] = minlen[0] = maxlen[1] = minlen[1] = 0; ++ lastf2 = lastf1 = f; ++ len2 = len1 = 0; ++ } else { ++ lastf1 = pf; ++ len1 = 0; ++ } ++ } ++ } ++ ++ ge = ge->frwd; ++ } while(ge != cge->next); ++#if 0 ++ fprintf(stderr, "Line postprocessing part 2\n"); ++ gex_dump_contour(cge->next, clen); ++#endif ++ ++ ge = cge->next; ++ do { ++ f = X_FRAG(ge); ++ ++ if(f->len[GEXFI_LINE] >= 4) { ++ len = f->len[GEXFI_EXACTLINE]; ++ /* if a non-exact line covers precisely two exact lines, ++ * split it ++ */ ++ if(len > 0 && f->len[GEXFI_LINE] >= len+1) { ++ GEX_FRAG *pf; ++ pge = age[(f->aidx + len - 1)%clen]; /* last gentry of exact line */ ++ pf = X_FRAG(pge); ++ if(f->len[GEXFI_LINE] + 1 == len + pf->len[GEXFI_EXACTLINE]) { ++ f->len[GEXFI_LINE] = len; ++ f->flags |= GEXFF_SPLIT; ++ pf->len[GEXFI_LINE] = pf->len[GEXFI_EXACTLINE]; ++ pf->flags |= GEXFF_SPLIT; ++ } ++ } ++ } ++ ++ ge = ge->frwd; ++ } while(ge != cge->next); ++#if 0 ++ fprintf(stderr, "Line postprocessing part 2a\n"); ++ gex_dump_contour(cge->next, clen); ++#endif ++ ge = cge->next; ++ do { ++ f = X_FRAG(ge); ++ ++ /* too small lines are of no interest */ ++ if( (f->flags & GEXFF_SPLIT)==0 && f->len[GEXFI_LINE] < 4) ++ f->len[GEXFI_LINE] = 0; ++ ++ len = f->len[GEXFI_EXACTLINE]; ++ /* too small exact lines are of no interest */ ++ if(len < 3) /* exact lines may be shorter */ ++ f->len[GEXFI_EXACTLINE] = 0; ++ /* get rid of inexact additions to the end of the exact lines */ ++ else if(f->len[GEXFI_LINE] == len+1) ++ f->len[GEXFI_LINE] = len; ++ /* same at the beginning */ ++ else { ++ int diff = X_FRAG(ge->bkwd)->len[GEXFI_LINE] - len; ++ ++ if(diff == 1 || diff == 2) { ++ X_FRAG(ge->bkwd)->len[GEXFI_LINE] = 0; ++ f->len[GEXFI_LINE] = len; ++ } ++ } ++ ++ ge = ge->frwd; ++ } while(ge != cge->next); ++#if 0 ++ fprintf(stderr, "Line postprocessing is completed\n"); ++ gex_dump_contour(cge->next, clen); ++#endif ++ ++ gex_calc_lenback(cge->next, clen); /* prepare data */ ++ ++ /* resolve conflicts between lines and curves */ ++ ++ /* ++ * the short (3-gentry) curve frags must have one of the ends ++ * coinciding with another curve frag of the same type ++ */ ++ ++ for(d = GEXFI_CONVEX; d<= GEXFI_CONCAVE; d++) { ++ ge = cge->next; ++ do { ++ f = X_FRAG(ge); ++ ++ if(f->len[d] == 3) { ++ pge = age[(f->aidx + 2)%clen]; /* last gentry of this frag */ ++ if(f->lenback[d] == 0 && X_FRAG(pge)->len[d] == 0) { ++ fprintf(stderr, " discarded small %s at %p-%p\n", gxf_name[d], ge, pge); ++ f->len[d] = 0; ++ X_FRAG(ge->frwd)->lenback[d] = 0; ++ X_FRAG(ge->frwd->frwd)->lenback[d] = 0; ++ } ++ } ++ ge = ge->frwd; ++ } while(ge != cge->next); ++ } ++ ++ /* the serifs take priority over everything else */ ++ ge = cge->next; ++ do { ++ f = X_FRAG(ge); ++ ++ len = f->len[GEXFI_SERIF]; ++ if(len == 0) ++ continue; ++ ++ if(len != 2) { /* this is used in the code below */ ++ fprintf(stderr, "Internal error at %s line %d: serif frags len is %d\n", ++ __FILE__, __LINE__, len); ++ exit(1); ++ } ++ ++ for(d = 0; d < GEXFI_SERIF; d++) { ++ /* serifs may not have common ends with the other fragments, ++ * this is expressed as extending them by 1 gentry on each side ++ */ ++ frag_subtract(g, age, clen, ge->bkwd, len+2, d); ++ } ++ } while( (ge = ge->frwd) != cge->next); ++ ++ /* ++ * longer exact lines take priority over curves; shorter lines ++ * and inexact lines are resolved with convex/concave conflicts ++ */ ++ ge = cge->next; ++ do { ++ f = X_FRAG(ge); ++ ++ len = f->len[GEXFI_EXACTLINE]; ++ ++ if(len < 6) { /* line is short */ ++ ge = ge->frwd; ++ continue; ++ } ++ ++ fprintf(stderr, " line at %p len=%d\n", ge, f->len[GEXFI_EXACTLINE]); ++ for(d = GEXFI_CONVEX; d<= GEXFI_CONCAVE; d++) { ++ frag_subtract(g, age, clen, ge, len, d); ++ } ++ ++ ge = ge->frwd; ++ } while(ge != cge->next); ++ ++ /* ++ * The exact lines take priority over curves that coincide ++ * with them or extend by only one gentry on either side ++ * (but not both sides). By this time it applies only to the ++ * small exact lines. ++ * ++ * An interesting general case is when a curve matches more ++ * than one exact line going diamond-like. ++ */ ++ ++ ge = cge->next; ++ do { ++ int done, len2; ++ int sharpness; ++ GEX_FRAG *pf; ++ ++ f = X_FRAG(ge); ++ ++ /* "sharpness" shows how a group of exact line frags is connected: if the gentries ++ * of some of them overlap, the curve matching requirement is loosened: it may ++ * extend up to 1 gentry beyond each end of the group of exact line frags ++ * (sharpness=2); otherwise it may extend to only one end (sharpness=1) ++ */ ++ sharpness = 1; ++ ++ len = f->len[GEXFI_EXACTLINE]; ++ if(len >= 4) { ++ while(len < clen) { ++ done = 0; ++ pf = X_FRAG(ge->bkwd); ++ for(d = GEXFI_CONVEX; d<= GEXFI_CONCAVE; d++) { ++ if(f->len[d] == len || f->len[d] == len+1) { ++ ++ fprintf(stderr, " removed %s frag at %p len=%d linelen=%d\n", ++ gxf_name[d], ge, f->len[d], len); ++ pge = ge->frwd; ++ for(i = f->len[d]; i > 1; i--, pge = pge->frwd) ++ X_FRAG(pge)->lenback[d] = 0; ++ f->len[d] = 0; ++ gex_dump_contour(ge, clen); ++ done = 1; ++ } else if(pf->len[d] == len+1 || pf->len[d] == len+sharpness) { ++ fprintf(stderr, " removed %s frag at %p len=%d next linelen=%d\n", ++ gxf_name[d], ge->bkwd, pf->len[d], len); ++ pge = ge; ++ for(i = pf->len[d]; i > 1; i--, pge = pge->frwd) ++ X_FRAG(pge)->lenback[d] = 0; ++ pf->len[d] = 0; ++ gex_dump_contour(ge, clen); ++ done = 1; ++ } ++ } ++ if(done) ++ break; ++ ++ /* is there any chance to match a sequence of exect lines ? */ ++ if(f->len[GEXFI_CONVEX] < len && f->len[GEXFI_CONCAVE] < len ++ && pf->len[GEXFI_CONVEX] < len && pf->len[GEXFI_CONCAVE] < len) ++ break; ++ ++ done = 1; ++ /* check whether the line is connected to another exact line at an extremum */ ++ pge = age[(f->aidx + len - 1)%clen]; /* last gentry of exact line */ ++ len2 = X_FRAG(pge)->len[GEXFI_EXACTLINE]; ++ if(len2 > 0) { ++ if( len2 >= 4 && (X_FRAG(pge)->flags & GEXFF_EXTR) ) { ++ len += len2 - 1; ++ sharpness = 2; ++ done = 0; ++ } ++ } else { ++ /* see if the extremum is between two exact lines */ ++ pge = pge->frwd; ++ if(X_FRAG(pge)->flags & GEXFF_EXTR) { ++ pge = pge->frwd; ++ len2 = X_FRAG(pge)->len[GEXFI_EXACTLINE]; ++ if(len2 >= 4) { ++ len += len2 + 1; ++ done = 0; ++ } ++ } ++ } ++ if(done) ++ break; ++ } ++ } ++ ++ ge = ge->frwd; ++ } while(ge != cge->next); ++ ++ /* ++ * The lines may cover only whole curves (or otherwise empty space), ++ * so cut them where they overlap parts of the curves. If 2 or less ++ * gentries are left in the line, remove the line. ++ * If a line and a curve fully coincide, remove the line. Otherwise ++ * remove the curves that are completely covered by the lines. ++ */ ++ ++ ge = cge->next; ++ do { ++ f = X_FRAG(ge); ++ ++ reconsider_line: ++ len = f->len[GEXFI_LINE]; ++ ++ if(len == 0) { ++ ge = ge->frwd; ++ continue; ++ } ++ ++ if(f->len[GEXFI_CONVEX] >= len ++ || f->len[GEXFI_CONCAVE] >= len) { ++ line_completely_covered: ++ fprintf(stderr, " removed covered Line frag at %p len=%d\n", ++ ge, len); ++ f->len[GEXFI_LINE] = 0; ++ for(pge = ge->frwd; len > 1; len--, pge = pge->frwd) ++ X_FRAG(pge)->lenback[GEXFI_LINE] = 0; ++ gex_dump_contour(ge, clen); ++ ge = ge->frwd; ++ continue; ++ } ++ ++ k1 = 0; /* how much to cut at the front */ ++ for(d = GEXFI_CONVEX; d<= GEXFI_CONCAVE; d++) { ++ if(f->lenback[d]) { ++ pge = age[(f->aidx + clen - f->lenback[d])%clen]; ++ i = X_FRAG(pge)->len[d] - f->lenback[d] - 1; ++ if(i > k1) ++ k1 = i; ++ } ++ } ++ ++ k2 = 0; /* how much to cut at the end */ ++ pge = age[(f->aidx + len)%clen]; /* gentry after the end */ ++ for(d = GEXFI_CONVEX; d<= GEXFI_CONCAVE; d++) { ++ i = X_FRAG(pge)->lenback[d] - 1; ++ if(i > k2) ++ k2 = i; ++ } ++ ++ if(k1+k2 > 0 && k1+k2 >= len-3) { ++ fprintf(stderr, " k1=%d k2=%d\n", k1, k2); ++ goto line_completely_covered; ++ } ++ ++ ++ if(k2 != 0) { /* cut the end */ ++ len -= k2; ++ f->len[GEXFI_LINE] = len; ++ /* pge still points after the end */ ++ for(i = k2, pge = pge->bkwd; i > 0; i--, pge = pge->bkwd) ++ X_FRAG(pge)->lenback[GEXFI_LINE] = 0; ++ } ++ if(k1 != 0) { /* cut the beginning */ ++ len -= k1; ++ f->len[GEXFI_LINE] = 0; ++ for(i = 1, pge = ge->frwd; i < k1; i++, pge = pge->frwd) ++ X_FRAG(pge)->lenback[GEXFI_LINE] = 0; ++ X_FRAG(pge)->len[GEXFI_LINE] = len; ++ for(i = 0; i < len; i++, pge = pge->frwd) ++ X_FRAG(pge)->lenback[GEXFI_LINE] = i; ++ } ++ if(k1 != 0 || k2 != 0) { ++ fprintf(stderr, " cut Line frag at %p by (%d,%d) to len=%d\n", ++ ge, k1, k2, len); ++ gex_dump_contour(ge, clen); ++ ++ goto reconsider_line; /* the line may have to be cut again */ ++ } ++ pge = age[(f->aidx + k1)%clen]; /* new beginning */ ++ good = 1; /* flag: no need do do a debugging dump */ ++ for(i=1; ifrwd) ++ for(d = GEXFI_CONVEX; d<= GEXFI_CONCAVE; d++) { ++ if(X_FRAG(pge)->len[d]) { ++ fprintf(stderr, " removed %s frag at %p len=%d covered by line\n", ++ gxf_name[d], pge, X_FRAG(pge)->len[d], len); ++ good = 0; ++ } ++ X_FRAG(pge)->len[d] = 0; ++ } ++ pge = age[(f->aidx + k1 + 1)%clen]; /* next after new beginning */ ++ for(i=1; ifrwd) ++ for(d = GEXFI_CONVEX; d<= GEXFI_CONCAVE; d++) ++ X_FRAG(pge)->lenback[d] = 0; ++ if(!good) ++ gex_dump_contour(ge, clen); ++ ++ ge = ge->frwd; ++ } while(ge != cge->next); ++ ++ /* Resolve conflicts between curves */ ++ for(d = GEXFI_CONVEX; d<= GEXFI_CONCAVE; d++) { ++ dx = (GEXFI_CONVEX + GEXFI_CONCAVE) - d; /* the other type */ ++ ge = cge->next; ++ do { ++ GENTRY *sge; ++ ++ f = X_FRAG(ge); ++ len = f->len[d]; ++ if(len < 2) { ++ ge = ge->frwd; ++ continue; ++ } ++ sge = ge; /* the start of fragment */ ++ ++ i = f->len[dx]; ++ if(i != 0) { /* two curved frags starting here */ ++ /* should be i!=len because otherwise they would be ++ * covered by an exact line ++ */ ++ if(i > len) { ++ curve_completely_covered: ++ /* remove the convex frag */ ++ fprintf(stderr, " removed %s frag at %p len=%d covered by %s\n", ++ gxf_name[d], ge, len, gxf_name[dx]); ++ f->len[d] = 0; ++ for(pge = ge->frwd, j = 1; j < len; j++, pge = pge->frwd) ++ X_FRAG(pge)->lenback[d] = 0; ++ gex_dump_contour(ge, clen); ++ ++ ge = ge->frwd; /* the frag is gone, nothing more to do */ ++ continue; ++ } else { ++ /* remove the concave frag */ ++ fprintf(stderr, " removed %s frag at %p len=%d covered by %s\n", ++ gxf_name[dx], ge, i, gxf_name[d]); ++ f->len[dx] = 0; ++ for(pge = ge->frwd, j = 1; j < i; j++, pge = pge->frwd) ++ X_FRAG(pge)->lenback[dx] = 0; ++ gex_dump_contour(ge, clen); ++ } ++ } ++ ++ ++ k1 = X_FRAG(ge->frwd)->lenback[dx]; ++ if(k1 != 0) { /* conflict at the front */ ++ GENTRY *gels, *gele, *gei; ++ ++ pge = age[(f->aidx + clen - (k1-1))%clen]; /* first gentry of concave frag */ ++ k2 = X_FRAG(pge)->len[dx]; /* its length */ ++ ++ i = k2 - (k1-1); /* amount of overlap */ ++ if(i > len) ++ i = len; ++ /* i >= 2 by definition */ ++ if(i >= k2-1) { /* covers the other frag - maybe with 1 gentry showing */ ++ fprintf(stderr, " removed %s frag at %p len=%d covered by %s\n", ++ gxf_name[dx], pge, k2, gxf_name[d]); ++ X_FRAG(pge)->len[dx] = 0; ++ for(pge = pge->frwd, j = 1; j < k2; j++, pge = pge->frwd) ++ X_FRAG(pge)->lenback[dx] = 0; ++ if(i >= len-1) { /* covers our frag too - maybe with 1 gentry showing */ ++ /* our frag will be removed as well, prepare a line to replace it */ ++ gels = ge; ++ gele = age[(f->aidx + i - 1)%clen]; ++ fprintf(stderr, " new Line frag at %p-%p len=%d\n", gels, gele, i); ++ X_FRAG(gels)->len[GEXFI_LINE] = i; ++ for(gei = gels->frwd, j = 1; j < i; gei = gei->frwd, j++) ++ X_FRAG(gei)->lenback[GEXFI_LINE] = j; ++ } else { ++ gex_dump_contour(ge, clen); ++ ge = ge->frwd; ++ continue; ++ } ++ } ++ if(i >= len-1) /* covers our frag - maybe with 1 gentry showing */ ++ goto curve_completely_covered; ++ ++ /* XXX need to do something better for the case when a curve frag ++ * is actually nothing but an artifact of two other curves of ++ * the opposite type touching each other, like on the back of "3" ++ */ ++ ++ /* change the overlapping part to a line */ ++ gels = ge; ++ gele = age[(f->aidx + i - 1)%clen]; ++ /* give preference to local extremums */ ++ if(X_FRAG(gels)->flags & GEXFF_EXTR) { ++ gels = gels->frwd; ++ i--; ++ } ++ if(X_FRAG(gele)->flags & GEXFF_EXTR) { ++ gele = gele->bkwd; ++ i--; ++ } ++ if(gels->bkwd == gele) { ++ /* Oops the line became negative. Probably should ++ * never happen but I can't think of any formal reasoning ++ * leading to that, so check just in case. Restore ++ * the previous state. ++ */ ++ gels = gele; gele = gels->frwd; i = 2; ++ } ++ ++ j = X_FRAG(gels)->lenback[dx] + 1; /* new length */ ++ if(j != k2) { ++ X_FRAG(pge)->len[dx] = j; ++ fprintf(stderr, " cut %s frag at %p len=%d to %p len=%d end overlap with %s\n", ++ gxf_name[dx], pge, k2, gels, j, gxf_name[d]); ++ for(gei = gels->frwd; j < k2; gei = gei->frwd, j++) ++ X_FRAG(gei)->lenback[dx] = 0; ++ } ++ ++ if(gele != ge) { ++ sge = gele; ++ f->len[d] = 0; ++ fprintf(stderr, " cut %s frag at %p len=%d ", gxf_name[d], ge, len); ++ len--; ++ for(gei = ge->frwd; gei != gele; gei = gei->frwd, len--) ++ X_FRAG(gei)->lenback[d] = 0; ++ X_FRAG(gele)->len[d] = len; ++ X_FRAG(gele)->lenback[d] = 0; ++ fprintf(stderr, "to %p len=%d start overlap with %s\n", ++ sge, len, gxf_name[dx]); ++ for(gei = gei->frwd, j = 1; j < len; gei = gei->frwd, j++) ++ X_FRAG(gei)->lenback[d] = j; ++ ++ } ++ if(i > 1) { ++ fprintf(stderr, " new Line frag at %p-%p len=%d\n", gels, gele, i); ++ X_FRAG(gels)->len[GEXFI_LINE] = i; ++ for(gei = gels->frwd, j = 1; j < i; gei = gei->frwd, j++) ++ X_FRAG(gei)->lenback[GEXFI_LINE] = j; ++ } ++ gex_dump_contour(ge, clen); ++ } ++ ++ ge = ge->frwd; ++ } while(ge != cge->next); ++ } ++ ++ /* ++ * Assert that there are no conflicts any more and ++ * for each gentry find the fragment types that start ++ * and continue here. ++ */ ++ ge = cge->next; ++ do { ++ f = X_FRAG(ge); ++ dx = GEXFI_NONE; /* type that starts here */ ++ dy = GEXFI_NONE; /* type that goes through here */ ++ /* GEXFI_EXACTLINE and GEXFI_SERIF are auxiliary and don't ++ * generate any actual lines/curves in the result ++ */ ++ for(d = GEXFI_CONVEX; d<= GEXFI_LINE; d++) { ++ if(f->len[d]) { ++ if(dx >= 0) { ++ fprintf(stderr, "**** Internal error in vectorization\n"); ++ fprintf(stderr, "CONFLICT in %s at %p between %s and %s\n", ++ g->name, ge, gxf_name[dx], gxf_name[d]); ++ dumppaths(g, cge->next, cge->next->bkwd); ++ gex_dump_contour(ge, clen); ++ exit(1); ++ } ++ dx = d; ++ } ++ if(f->lenback[d]) { ++ if(dy >= 0) { ++ fprintf(stderr, "**** Internal error in vectorization\n"); ++ fprintf(stderr, "CONFLICT in %s at %p between %s and %s\n", ++ g->name, ge, gxf_name[dy], gxf_name[d]); ++ dumppaths(g, cge->next, cge->next->bkwd); ++ gex_dump_contour(ge, clen); ++ exit(1); ++ } ++ dy = d; ++ } ++ } ++ f->ixstart = dx; ++ f->ixcont = dy; ++ ge = ge->frwd; ++ } while(ge != cge->next); ++ ++ /* ++ * make sure that the contour does not start in the ++ * middle of a fragment ++ */ ++ ge = cge->next; /* old start of the contour */ ++ f = X_FRAG(ge); ++ if(f->ixstart == GEXFI_NONE && f->ixcont != GEXFI_NONE) { ++ /* oops, it's mid-fragment, move the start */ ++ GENTRY *xge; ++ ++ xge = ge->bkwd->next; /* entry following the contour */ ++ ++ /* find the first gentry of this frag */ ++ pge = age[(f->aidx + clen - f->lenback[f->ixcont])%clen]; ++ ++ ge->prev = ge->bkwd; ++ ge->bkwd->next = ge; ++ ++ cge->next = pge; ++ pge->prev = cge; ++ ++ pge->bkwd->next = xge; ++ if(xge) ++ xge->prev = pge->bkwd; ++ ++ cge->ix3 = pge->bkwd->ix3; cge->iy3 = pge->bkwd->iy3; ++ } ++ ++ /* vectorize each fragment separately ++ * make 2 passes: first handle the straight lines, then ++ * the curves to allow the curver to be connected smoothly ++ * to the straights ++ */ ++ ge = cge->next; ++ do { /* pass 1 */ ++ f = X_FRAG(ge); ++ switch(f->ixstart) { ++ case GEXFI_LINE: ++ len = f->len[GEXFI_LINE]; ++ pge = age[(f->aidx + len - 1)%clen]; /* last gentry */ ++ ++ if(ge->iy3 == ge->bkwd->iy3) { /* frag starts and ends horizontally */ ++ k1 = 1/*Y*/ ; /* across the direction of start */ ++ k2 = 0/*X*/ ; /* along the direction of start */ ++ } else { /* frag starts and ends vertically */ ++ k1 = 0/*X*/ ; /* across the direction of start */ ++ k2 = 1/*Y*/ ; /* along the direction of start */ ++ } ++ ++ if(len % 2) { ++ /* odd number of entries in the frag */ ++ double halfstep, halfend; ++ ++ f->vect[0][k1] = fscale * ge->ipoints[k1][2]; ++ f->vect[3][k1] = fscale * pge->ipoints[k1][2]; ++ ++ halfstep = (pge->ipoints[k2][2] - ge->bkwd->ipoints[k2][2]) ++ * 0.5 / ((len+1)/2); ++ if(f->ixcont != GEXFI_NONE) { ++ halfend = (ge->ipoints[k2][2] - ge->bkwd->ipoints[k2][2]) * 0.5; ++ if(fabs(halfstep) < fabs(halfend)) /* must be at least half gentry away */ ++ halfstep = halfend; ++ } ++ if(X_FRAG(pge)->ixstart != GEXFI_NONE) { ++ halfend = (pge->ipoints[k2][2] - pge->bkwd->ipoints[k2][2]) * 0.5; ++ if(fabs(halfstep) < fabs(halfend)) /* must be at least half gentry away */ ++ halfstep = halfend; ++ } ++ f->vect[0][k2] = fscale * (ge->bkwd->ipoints[k2][2] + halfstep); ++ f->vect[3][k2] = fscale * (pge->ipoints[k2][2] - halfstep); ++ } else { ++ /* even number of entries */ ++ double halfstep, halfend; ++ ++ f->vect[0][k1] = fscale * ge->ipoints[k1][2]; ++ halfstep = (pge->ipoints[k2][2] - ge->bkwd->ipoints[k2][2]) ++ * 0.5 / (len/2); ++ if(f->ixcont != GEXFI_NONE) { ++ halfend = (ge->ipoints[k2][2] - ge->bkwd->ipoints[k2][2]) * 0.5; ++ if(fabs(halfstep) < fabs(halfend)) /* must be at least half gentry away */ ++ halfstep = halfend; ++ } ++ f->vect[0][k2] = fscale * (ge->bkwd->ipoints[k2][2] + halfstep); ++ ++ halfstep = (pge->ipoints[k1][2] - ge->bkwd->ipoints[k1][2]) ++ * 0.5 / (len/2); ++ if(X_FRAG(pge)->ixstart != GEXFI_NONE) { ++ halfend = (pge->ipoints[k1][2] - pge->bkwd->ipoints[k1][2]) * 0.5; ++ if(fabs(halfstep) < fabs(halfend)) /* must be at least half gentry away */ ++ halfstep = halfend; ++ } ++ f->vect[3][k1] = fscale * (pge->ipoints[k1][2] - halfstep); ++ f->vect[3][k2] = fscale * pge->ipoints[k2][2]; ++ } ++ f->vectlen = len; ++ f->flags |= GEXFF_DRAWLINE; ++ break; ++ } ++ } while((ge = ge->frwd) != cge->next); ++ ++ ge = cge->next; ++ do { /* pass 2 */ ++ /* data for curves */ ++ GENTRY *firstge, *lastge, *gef, *gel, *gei, *gex; ++ GENTRY *ordhd; /* head of the order list */ ++ GENTRY **ordlast; ++ int nsub; /* number of subfrags */ ++ GEX_FRAG *ff, *lf, *xf; ++ ++ f = X_FRAG(ge); ++ switch(f->ixstart) { ++ case GEXFI_CONVEX: ++ case GEXFI_CONCAVE: ++ len = f->len[f->ixstart]; ++ firstge = ge; ++ lastge = age[(f->aidx + len - 1)%clen]; /* last gentry */ ++ ++ nsub = 0; ++ gex = firstge; ++ xf = X_FRAG(gex); ++ xf->prevsub = 0; ++ xf->sublen = 1; ++ xf->flags &= ~GEXFF_DONE; ++ for(gei = firstge->frwd; gei != lastge; gei = gei->frwd) { ++ xf->sublen++; ++ if(X_FRAG(gei)->flags & GEXFF_EXTR) { ++ xf->nextsub = gei; ++ for(i=0; i<2; i++) ++ xf->bbox[i] = abs(gei->ipoints[i][2] - gex->bkwd->ipoints[i][2]); ++ nsub++; ++ xf = X_FRAG(gei); ++ xf->prevsub = gex; ++ xf->sublen = 1; ++ xf->flags &= ~GEXFF_DONE; ++ gex = gei; ++ } ++ } ++ xf->sublen++; ++ xf->nextsub = gei; ++ for(i=0; i<2; i++) ++ xf->bbox[i] = abs(gei->ipoints[i][2] - gex->bkwd->ipoints[i][2]); ++ nsub++; ++ ff = xf; /* remember the beginning of the last subfrag */ ++ xf = X_FRAG(gei); ++ xf->prevsub = gex; ++ if(firstge != lastge) { ++ xf->nextsub = 0; ++ xf->sublen = 0; ++ ++ /* correct the bounding box of the last and first subfrags for ++ * intersections with other fragments ++ */ ++ if(xf->ixstart != GEXFI_NONE) { ++ /* ff points to the beginning of the last subfrag */ ++ for(i=0; i<2; i++) ++ ff->bbox[i] -= 0.5 * abs(lastge->ipoints[i][2] - lastge->bkwd->ipoints[i][2]); ++ } ++ ff = X_FRAG(firstge); ++ if(ff->ixcont != GEXFI_NONE) { ++ for(i=0; i<2; i++) ++ ff->bbox[i] -= 0.5 * abs(firstge->ipoints[i][2] - firstge->bkwd->ipoints[i][2]); ++ } ++ } ++ ++ fprintf(stderr, " %s frag %p%s nsub=%d\n", gxf_name[f->ixstart], ++ ge, (f->flags&GEXFF_CIRC)?" circular":"", nsub); ++ ++ /* find the symmetry between the subfragments */ ++ for(gef = firstge, count=0; count < nsub; gef = ff->nextsub, count++) { ++ ff = X_FRAG(gef); ++ gex = ff->nextsub; ++ xf = X_FRAG(gex); ++ gel = xf->nextsub; ++ if(gel == 0) { ++ ff->flags &= ~GEXFF_SYMNEXT; ++ break; /* not a circular frag */ ++ } ++ good = 1; /* assume that we have symmetry */ ++ /* gei goes backwards, gex goes forwards from the extremum */ ++ gei = gex; ++ /* i is the symmetry axis, j is the other axis (X=0 Y=1) */ ++ ff->symaxis = i = (gex->ix3 != gex->bkwd->ix3); ++ j = !i; ++ for( ; gei!=gef && gex!=gel; gei=gei->bkwd, gex=gex->frwd) { ++ if( gei->bkwd->ipoints[i][2] != gex->ipoints[i][2] ++ || gei->bkwd->ipoints[j][2] - gei->ipoints[j][2] ++ != gex->bkwd->ipoints[j][2] - gex->ipoints[j][2] ++ ) { ++ good = 0; /* no symmetry */ ++ break; ++ } ++ } ++ if(good) { ++ if( isign(gei->bkwd->ipoints[j][2] - gei->ipoints[j][2]) ++ != isign(gex->bkwd->ipoints[j][2] - gex->ipoints[j][2]) ) { ++ good = 0; /* oops, goes into another direction */ ++ } ++ } ++ if(good) ++ ff->flags |= GEXFF_SYMNEXT; ++ else ++ ff->flags &= ~GEXFF_SYMNEXT; ++ } ++ ++ for(gef = firstge, count=0; count < nsub; gef = ff->nextsub, count++) { ++ ff = X_FRAG(gef); ++ if((ff->flags & GEXFF_SYMNEXT)==0) { ++ ff->symxlen = 0; ++ continue; ++ } ++ gex = ff->prevsub; ++ if(gex == 0 || (X_FRAG(gex)->flags & GEXFF_SYMNEXT)==0) { ++ ff->symxlen = 0; ++ continue; ++ } ++ ff->symxlen = X_FRAG(gex)->sublen; ++ xf = X_FRAG(ff->nextsub); ++ if(xf->sublen < ff->symxlen) ++ ff->symxlen = xf->sublen; ++ } ++ ++ /* find the symmetry inside the subfragments */ ++ for(gef = firstge, count=0; count < nsub; gef = ff->nextsub, count++) { ++ ff = X_FRAG(gef); ++ ++ if(ff->sublen % 2) { ++ /* we must have an even number of gentries for diagonal symmetry */ ++ ff->symge = 0; ++ continue; ++ } ++ ++ /* gei goes forwards from the front */ ++ gei = gef->frwd; ++ /* gex goes backwards from the back */ ++ gex = ff->nextsub->bkwd; ++ ++ /* i is the direction of gei, j is the direction of gex */ ++ i = (gei->iy3 != gei->bkwd->iy3); ++ j = !i; ++ for( ; gei->bkwd != gex; gei=gei->frwd, gex=gex->bkwd) { ++ if( abs(gei->bkwd->ipoints[i][2] - gei->ipoints[i][2]) ++ != abs(gex->bkwd->ipoints[j][2] - gex->ipoints[j][2]) ) ++ break; /* no symmetry */ ++ i = j; ++ j = !j; ++ } ++ if(gei->bkwd == gex) ++ ff->symge = gex; ++ else ++ ff->symge = 0; /* no symmetry */ ++ } ++ ++ /* find the order of calculation: ++ * prefer to start from long fragments that have the longest ++ * neighbours symmetric with them, with all being equal prefer ++ * the fragments that have smaller physical size ++ */ ++ ordhd = 0; ++ for(gef = firstge, count=0; count < nsub; gef = ff->nextsub, count++) { ++ ff = X_FRAG(gef); ++ ++ for(ordlast = &ordhd; *ordlast != 0; ordlast = &xf->ordersub) { ++ xf = X_FRAG(*ordlast); ++ if(ff->sublen > xf->sublen) ++ break; ++ if(ff->sublen < xf->sublen) ++ continue; ++ if(ff->symxlen > xf->symxlen) ++ break; ++ if(ff->symxlen < xf->symxlen) ++ continue; ++ if(ff->bbox[0] < xf->bbox[0] || ff->bbox[1] < xf->bbox[1]) ++ break; ++ } ++ ++ ff->ordersub = *ordlast; ++ *ordlast = gef; ++ } ++ ++ /* vectorize the subfragments */ ++ for(gef = ordhd; gef != 0; gef = ff->ordersub) { ++ ++ /* debugging stuff */ ++ ff = X_FRAG(gef); ++ fprintf(stderr, " %p-%p bbox[%g,%g] sym=%p %s len=%d xlen=%d\n", ++ gef, ff->nextsub, ff->bbox[0], ff->bbox[1], ff->symge, ++ (ff->flags & GEXFF_SYMNEXT) ? "symnext" : "", ++ ff->sublen, ff->symxlen); ++ ++ dosubfrag(g, f->ixstart, firstge, gef, fscale); ++ } ++ ++ break; ++ } ++ } while((ge = ge->frwd) != cge->next); ++ ++ free(age); ++ ++ } ++ ++ } ++ ++ /* all the fragments are found, extract the vectorization */ ++ pge = g->entries; ++ g->entries = g->lastentry = 0; ++ g->flags |= GF_FLOAT; ++ loopge = 0; ++ skip = 0; ++ ++ for(ge = pge; ge != 0; ge = ge->next) { ++ GEX_FRAG *f, *pf; ++ ++ switch(ge->type) { ++ case GE_LINE: ++ f = X_FRAG(ge); ++ if(skip == 0) { ++ if(f->flags & (GEXFF_DRAWLINE|GEXFF_DRAWCURVE)) { ++ /* draw a line to the start point */ ++ fg_rlineto(g, f->vect[0][0], f->vect[0][1]); ++ /* draw the fragment */ ++ if(f->flags & GEXFF_DRAWCURVE) ++ fg_rrcurveto(g, ++ f->vect[1][0], f->vect[1][1], ++ f->vect[2][0], f->vect[2][1], ++ f->vect[3][0], f->vect[3][1]); ++ else ++ fg_rlineto(g, f->vect[3][0], f->vect[3][1]); ++ skip = f->vectlen - 2; ++ } else { ++ fg_rlineto(g, fscale * ge->ix3, fscale * ge->iy3); ++ } ++ } else ++ skip--; ++ break; ++ case GE_MOVE: ++ fg_rmoveto(g, -1e6, -1e6); /* will be fixed by GE_PATH */ ++ skip = 0; ++ /* remember the reference to update it later */ ++ loopge = g->lastentry; ++ break; ++ case GE_PATH: ++ /* update the first MOVE of this contour */ ++ if(loopge) { ++ loopge->fx3 = g->lastentry->fx3; ++ loopge->fy3 = g->lastentry->fy3; ++ loopge = 0; ++ } ++ g_closepath(g); ++ break; ++ } ++ } ++ for(ge = pge; ge != 0; ge = cge) { ++ cge = ge->next; ++ free(ge->ext); ++ free(ge); ++ } ++ dumppaths(g, NULL, NULL); ++ ++ /* end of vectorization logic */ ++ } else { ++ /* convert the data to float */ ++ GENTRY *ge; ++ double x, y; ++ ++ for(ge = g->entries; ge != 0; ge = ge->next) { ++ ge->flags |= GEF_FLOAT; ++ if(ge->type != GE_MOVE && ge->type != GE_LINE) ++ continue; ++ ++ x = fscale * ge->ix3; ++ y = fscale * ge->iy3; ++ ++ ge->fx3 = x; ++ ge->fy3 = y; ++ } ++ g->flags |= GF_FLOAT; ++ } ++ ++ free(hlm); free(vlm); free(amp); ++} ++ ++#if 0 ++/* print out the bitmap */ ++printbmap(bmap, xsz, ysz, xoff, yoff) ++ char *bmap; ++ int xsz, ysz, xoff, yoff; ++{ ++ int x, y; ++ ++ for(y=ysz-1; y>=0; y--) { ++ putchar( (y%10==0) ? y/10+'0' : ' ' ); ++ putchar( y%10+'0' ); ++ for(x=0; x=0; y--) { ++ for(x=0; x> 8))) ++#define ntohl(x) \ ++ ((ULONG)((((ULONG)(x) & 0x000000ffU) << 24) | \ ++ (((ULONG)(x) & 0x0000ff00U) << 8) | \ ++ (((ULONG)(x) & 0x00ff0000U) >> 8) | \ ++ (((ULONG)(x) & 0xff000000U) >> 24))) ++#endif +diff -ruN xserver-old/hw/xprint/extras/ttf2pt1/CHANGES.html xserver/hw/xprint/extras/ttf2pt1/CHANGES.html +--- xserver-old/hw/xprint/extras/ttf2pt1/CHANGES.html 1970-01-01 10:00:00.000000000 +1000 ++++ xserver/hw/xprint/extras/ttf2pt1/CHANGES.html 2006-06-27 13:10:26.000000000 +1000 +@@ -0,0 +1,805 @@ ++ ++ ++ ++TTF2PT1 - CHANGES history ++ ++ ++ ++

++TTF2PT1 - CHANGES history ++

++ ++ ++ ++

++3.4.4-SNAP-030526 ++

++ ++ ++New features: ++
    ++
  • Improved the auto-vectoring (-OV) alrogithm. ++
++ ++Bug fixes: ++
    ++
  • Fix to build all the features on Windows MS C++, by Tomoo Amano. ++
++ ++

++3.4.3 -- December 2, 2002 ++

++ ++ ++New features: ++
    ++
  • scripts/forceiso got an optional argument to select the ++ format of the names for glyphs without standard Latin-1 names. ++
++ ++Bug fixes: ++
    ++
  • Changed the glyph names in scripts/forceiso to match those in ttf2pt1. ++
  • Included the missing directory app/TeX. ++
++ ++

++3.4.2 -- August 30, 2002 ++

++ ++ ++New features: ++
    ++
  • New map for T2A_compat encoding (for Cyrillic LaTeX) by Mikhail ++ Umorin. ++
  • Scripts supporting font conversion for CJK-LaTeX, by Mike Fabian ++ from SuSE. ++
++ ++Bug fixes: ++
    ++
  • Explicit owner/group/permissions are used to install directories. ++
  • In scripts/convert fixed the addition of encoding name to the font ++ name for the external encoding maps, was missing "/" at the start. ++
  • Fixed the divergence between two copies of UniqueID. ++
  • Fixed the recovery after defective empty contours. ++
++ ++

++3.4.1 -- June 13, 2002 ++

++ ++ ++New features: ++
    ++
  • Added Autotrace support for the bitmap fonts (-OZ). It's horrible. ++
  • Added vectorization of bitmap fonts (-OV) - functionally the same thing as ++ autotrace but home-grown. Works mostly decently but still with large ++ space for impprovement. ++
  • Relaxed the conditions for warnings about long glyphs. ++
++ ++Bug fixes: ++
    ++
  • Fix by Rob Kolstad for a crash in the new outline smoothing ++ code (on small thin contours) and diagnostic for another crash. ++
  • Fix by Holger Huesing for a crash on degenerate contours. ++
  • Fix for bitmaps of zero dimensions. ++
  • The BDF reader does not fail on redefintion of the properties. ++
  • Fix for reading of BDF glyphs with 0 size. ++
  • Fix for a hang when guessing the boldness of some fonts. ++
  • Fix by Adriano Konzen for scaling coefficients in composite glyphs. ++
++ ++

++3.4.0 -- November 24, 2001 ++

++ ++ ++New features: ++
    ++
  • Parser for the BDF bitmap fonts. ++
  • Vastly improved the smoothing of the outlines. ++
  • The options are saved as a comment in the output file. ++
  • New script other/showdf for visual comparison of the fonts. ++
  • New option -G to select the file types to generate. ++
  • Creation of the dvips encoding files (by Rigel). ++
  • More glyphs in the Chinese maps (by Rigel). ++
  • Made the assignment of ISO8859/1 glyph names to the glyphs in the ++ fonts without PostScript names in them dependent on the original ++ encoding: no change for the 8-bit encodings, for the Unicode encoding ++ the names are assigned to the glyph with the codes 0-255 in Unicode, ++ and for the other 16-bit encodings the 8859/1 names are not assigned ++ at all. ++
++ ++Bug fixes: ++
    ++
  • Added a check for spaces in the PostScript font name in the FreeType ++ parser. ++
  • Made "-" a valid character in the glyph names. ++
  • Fixed handling of the Unicode names returned by FreeType, though ++ not perfectly. ++
  • Changed the build for FreeType-2.0.4. ++
  • Fixed the handling and printing of bad glyph names. ++
  • Fixed the bug with duplicated glyph names when more than 256 glyphs are ++ extracted from a font that has no PostScript glyph names defined. ++
  • Added ability to map a glyph to more than one code when unisng the ++ native parser (-pttf). ++
++ ++

++3.3.5 -- September 12, 2001 ++

++ ++ ++Packaged by Sergey Babkin. ++

++ ++Bug fixes: ++

    ++
  • Fixed the scaling of Ascender and Descender in the AFM file. ++
  • Fixed the brekage of "-l adobestd". ++
++ ++

++3.3.4 -- June 4, 2001 ++

++ ++ ++Packaged by Sergey Babkin. ++

++ ++New features: ++

    ++
  • Cyrillic (full set of glyphs) language tables (by Zvezdan Petkovic). ++ Now the languages "russian" and "bulgarian" are provided for compatibility ++ only, use the common language "cyrillic" instead. ++
  • More information in FONTS on using Cyrillic fonts with ++ Netscape (by Zvezdan Petkovic) ++
  • In the Netscape print filter added removal of the clipping path command: ++ otherwise Netscape tends to cut off a large piece of the rightmost column ++ of the tables. ++
  • One more script for printing from Netscape (by Zvezdan Petkovic). ++
  • Added selection of the base TTF encoding by pid/eid in the external maps. ++
  • Improved the recognition of substituted stems for intersecting contours. ++
  • Improved the substituted hints to make the horizontal positioning of ++ the points at the same height more uniform at small pixel sizes. ++
  • Made the algorithm for calculation of standard stem widths more ++ selective. ++
  • Added link to the GnuWin32 project. ++
++ ++Bug fixes: ++
    ++
  • TH: Print out metrics of un-encoded glyphs even without "-a" option. ++
  • Added missing "/" in Fontmap generation in convert (by Zvezdan Petkovic). ++
  • Removed unneccessary "\n" in messages in x2gs. ++
  • Removed the broken overoptimisation of "0 0 rmoveto". ++
  • Removed the useless warnings about multiple codes for a glyph. ++
  • Changed the FreeType2 include directory in the Makefile to match the ++ FreeType's default. ++
++ ++

++3.3.3 -- March 4, 2001 ++

++ ++ ++Packaged by Sergey Babkin. ++

++ ++New features: ++

    ++
  • TH: Added printing of front-end parser in the header of the font file. ++
  • Tested build with FreeType 2.0 Release. ++
++ ++Bug fixes: ++
    ++
  • Changed the installation script which on some versions of bash ++ copied all files into the share directory. ++
  • Fixed the close sequences of html2man comments in the HTML files, ++ now they should display correctly with lynx. ++
  • Restored the ability to include un-encoded characters into the ++ customised maps (those with codes over 255). ++
  • Fixed the Unicode mapping of the Cyrillic letters "YO" and "yo" ++ (by Yuri Shemanin). ++
  • Fixed the spurious aborts when the conversion-by-plane function ++ gets called for auto-guessing of encoding. ++
++ ++

++3.3.2 -- November 20, 2000 ++

++ ++ ++Packaged by Sergey Babkin. ++

++ ++New features: ++

    ++
  • Added generation of man pages. ++
  • Added "make install" and "make uninstall". ++
  • Added language option "-l plane". ++
  • In other/showg added better support of comparison files: ++
      ++
    • printing of the comparison file legend; ++
    • guessing of missing glyph names in a comparison file by code; ++
    • bounding boxes of all comparison files are used for page layout. ++
    ++
  • Added ability to use external t1asm instead of compiling it in. ++
  • Renamed the fonts installation guide from INSTALL*html to FONTS*html ++ to avoid confusion with installation of ttf2pt1 itself. ++
++ ++Bug fixes: ++
    ++
  • Removed erroneous extra fclose(pfa_file). ++
  • Fixed random memory corruption that manifested with crash on Linux ++ when converting fonts not containing glyph names. ++
  • Removed from the output file the comments that confused dvips. Changed ++ other/showg to work without them. ++
  • In other/showg added better checks for missing glyphs, now it ++ gives warnings about them and the output file does not crash PostScript. ++
++ ++Other: ++
    ++
  • ttf2pfa is no longer included, people interested in history ++ should look for it in the older versions. ++
++ ++

++3.3.1 -- October 22, 2000 ++

++ ++ ++Packaged by Sergey Babkin. ++

++ ++New features: ++

    ++
  • Added front-end parser based on the FreeType-2 library. See Makefile ++for build instructions. ++
  • Changed the handling of encodings to accomodate the FreeType model. ++
  • Further cleaned up the front-end parser interface. ++
++ ++Bug fixes: ++
    ++
  • Fixed a bug that caused core dump on Alpha machines. ++
  • Fixed a bug in the outline smoothing that occasionally caused core dump. ++
  • Cleaned up warnings from picky compilers ++
  • Fixed more bugs in the Windows port (by Stefan Bauer). ++
  • Fixed the RPM spec file (suggested by Brian Armstrong). ++
++

++ ++

++3.3.0 -- September 22, 2000 ++

++ ++ ++Packaged by Sergey Babkin. ++

++ ++New features: ++

    ++
  • Converted most of the outlines' processing to floating point ++arithmetic. ++
  • Added splitting of curves crossing the quadrant boundaries (no gross ++damage is done any more to the Marvosym font and others like it). ++
  • Added modular interface for front-end font parsers and option to control ++their selection at run time. ++
  • Grouped the outline processing control options into one to reduce the ++options namespace pollution. ++
  • Thomas moved the Chinese maps into a separate module, chinese-maps. ++
  • Thomas added option -V to print version number. In addition, the version ++number is put in the header of the font file. ++
  • Added long option names (suggested by Thomas). ++
  • Added support for multi-level composite glyphs. ++
  • TH: Made <fontname> command-line argument optional; default to <ttf-file> ++with suffix replaced. ++
  • In other/showg added more ways to specify glyphs and the comparison option. ++
++ ++Bug fixes: ++
    ++
  • Fixed the VC++ batch file, added batch file for Cygnus GCC on Windows. ++
  • Removed parentheses from the Version string in AFM files because it does ++not help StarOffice anyway. StarOffice 5.2 has been reported to have this ++bug fixed. Added paragraph on StarOffice in FONTS.html. ++
  • Made messages on the '?' option parameter more meaningful (by Johan Vromans). ++
  • Changed the latin1 encoding table to include the Euro sign, Z and z with ++caron (by Thomas Henlich). ++
  • Improved the smoothing code which occasionally had problems with ++joining curves. Also fixed a few minor bugs in it. ++
++ ++

++3.22 -- May 23, 2000 ++

++ ++ ++Packaged by Sergey Babkin. ++

++ ++New features: ++

    ++
  • Included windows support by Frank Siegert (somewhat amended) ++
  • Added control over verbosity of warnings. ++
  • Added arguments and initialization functions to the language ++translation routines. ++
  • Added support of planes determined by arguments to the external ++maps. ++
  • Added compact external maps format (primarily for Eastern fonts). ++
  • Added external maps for Chinese GBK and Big5 encodings (converted ++from ttf2pfb) as well as maps for other Chinese encodings by Wang Lei. ++
  • Added the idea of buckets to speed up the search in external maps. ++
  • Changed the grouping algorithm for substituted hints: now it creates ++a bit bigger files but requires smaller hint stack when being rendered. ++
  • Added maximal limit of hint stack depth, glyphs requiring bigger ++stack get generation of substituted hints disabled. This makes substituted ++hints safe to use, no more lost glyphs due to hint stack overflow. ++
  • Added the font dump program other/dumpf. ++
  • Changed the testing HTML generator other/lst.pl to use tables. ++
  • Added debugging script other/cntstems.pl to count required hint ++stack depth for the glyphs. ++
++ ++Bug fixes: ++
    ++
  • Fixed printing of UID in script/trans. Changed the auto-generated UID to ++be in range 4000000-4999999 which is reserved by Adobe for private use. ++
  • Fixed handling of "cleartomark" in built-in t1asm. ++
  • Added handling of "can't happen" case in straighten() routine ++which actually happened on strange fonts and caused failure on assertion. ++
  • Made it always include the glyph .notdef in the resulting font. ++
  • Placed the version string in AFM file in parentheses, hopefully ++that would fix the problem with StarOffice. ++
  • Improved the smoothing code which occasionally had problems with ++joining curves. ++
++ ++

++3.21 -- March 1, 2000 ++

++ ++ ++Sergey Babkin: committed the changes by Petr Titera and ++my bugfixes. ++

++ ++New features: ++

    ++
  • New Unicode map format with glyph names, by Petr Titera. ++
  • Option to force the Unicode encoding by Petr Titera ++ (I changed it to work on any MS encoding, not only Symbol). ++
  • Slightly tweaked the calculation of hints, should be better now. ++
++ ++Bug fixes: ++
    ++
  • The unicode-sample.map with description of the map formats ++ was lost in the release process, restored and enhanced. ++
  • Renamed the table ISOLatin1Encoding to Fmt3Encoding to reflect ++ the way it is used. Saved the original one for reference ++ purposes. In the new table renamed "quoteright" to "quotesingle" ++ as Thomas Henlich suggested (and he were right). ++
  • In the ISOLatinEncoding table renamed the glyph "grave" ++ at octal 0140 to "quoteleft", "quotesingle" at octal 047 to ++ "quoteright" to conform to the standard as suggested by ++ Martin Trautner). ++
  • Fixed bug in scripts/trans that corrupted the UniqueID record ++ in the translated fonts. ++
  • Fixed bug in interaction of substituted hints with BlueZones. ++ Now the fonts with hint substitution seem to be always at least ++ not worse than without it (well, when they fit in the X11 ++ file size limit). ++
++ ++ ++

++3.2 -- January 15, 2000 ++

++ ++ ++Sergey Babkin: combined my changes with the changes by ++Thomas Henlich. The result deserves a not-so-minor version ++increase. ++

++ ++New features: ++

    ++
  • Support of the external Unicode re-encoding maps ++ (by Thomas). ++
  • Support for inclusion of all the glyphs from the ++ source file into the resulting file (inspired by ++ Thomas but I re-implemented it to remove the limitation ++ of his implementation: not more than 1024 glyphs). ++
  • The hints substitution. It's an experimental feature ++ yet and needs further work. ++
  • Support for UniqueID and its auto-generation. ++
  • Support for the name-based conversions from Unicode ++ in general and the adobestd "language" in particular. ++
  • Started the split of the source code into multiple ++ files. This needs more work to do it in a cleaner ++ way. ++
  • Better framework for the debugging printout ++ in the converter. ++
  • Utilities to install the fonts in Netscape ++ Navigator/Communicator 4.x. ++
  • Patches for bigger font files in the X11 rasterizer. ++
  • Linux RPM spec-file (by Johan Vromans). ++
  • Added the COPYRIGHT file (BSD-style, as we discussed ++ on the mailing list earlier) and the CHANGES file. ++
  • Creation of the .pfb files from the convert ++ script. ++
  • Changed the .notdef-s in the built-in ++ ISOLatin1Encoding table to some valid names (by Thomas). ++ Thomas also suggested replacing `quoteright' by ++ `quotesingle' but this seems to be against the ++ Adobe ISOLatin1 table. ++
  • New aliases windows-1251 and cp-866 for ++ the Russian encodings: those are expected by Netscape ++ navigator. ++
  • The font comparison program other/cmpf. ++
  • The "magnifying glass" program for glyph outlines: ++ other/showg. ++
  • Other updates of the tools in the `other' subdirectory. ++
  • Added a link to T1LIB in README. ++
  • A few new options in convert.cfg. ++
++ ++Bux fixes: ++
    ++
  • A bug in the outline smoothing code that corrupted some ++ of the fonts (for example, Microsoft Verdana). ++
  • Added explicit `cleartomark' to the end of file, ++ this seems to be compatible with both old and new version ++ of t1asm (suggested by Thomas). ++
  • Added the FontEncoding statement to the AFM files ++ (techincally this was not a bug because this statement ++ is optional but some programs want it). ++
  • A coredump when the converter tried to print a warning ++ (rather ironically) about a weird glyph width. ++
  • Changed the underscores in the font names to dashes (this ++ has been proposed long time ago by Johan Vromans). ++
  • No more glyph names of font names staring with a digit. ++
  • The names of the fonts in font and AFM files are now the ++ same as in the generated Ghostscript Fontmap file.
    ++ Warning: the names in Fontmap have been ++ changed. ++
  • The forceiso script does not corrupt the character ++ and kerning pairs counts any more, and is optional at all. ++
  • Fix for a loop going to 254 instead of 255 (by Thomas). ++
  • Added ':' in the font header (by Thomas). ++
  • A coredump when wrong language name is given (this was ++ also fixed by Thomas but I noticed it too late, after ++ I already fixed it by myself). ++
  • Fixed the links to the Adobe documents in README. ++
++ ++ ++

++3.13 -- October 18, 1999 ++

++ ++ ++Packaged by Sergey Babkin. ++

++ ++New features: ++

    ++
  • New option -v for automatic re-scaling based on the vertical size of the font ++
  • Changed the code to use getopt() instead of a home-made version of it. ++
  • Latin2 language support by Szalay Tamas. ++
++ ++Bux fixes: ++
    ++
  • Fix for the bug that made possible calls of malloc(0). ++
  • Refinement of the option -w to prevent extra wide spacing ++
++ ++

++3.12 -- October 2, 1999 ++

++ ++ ++Packaged by Sergey Babkin. ++

++ ++New features: ++

    ++
  • Added support for the Bulgarian language (actually, for now just an alias ++of Russian). ++
  • Added option -w that tries to make sure that the character widths are not ++too narrow. ++
  • Added the concept of aliased encodings. ++
  • Now the conversion scripts create and install the .afm files too. ++
  • The conversion script removes the intermediate files after installation. ++
  • Added tunables to the conversion script. ++
  • Installation of the Ghostscript fonts can now be done automatically ++together with the X11 fonts. ++
++ ++Bux fixes: ++
    ++
  • (FINALLY!!!) A correct fix for the infamous Red Hat 6.0 stdio "feature". ++
  • A number of little bugs discovered by a picky SGI compiler (well, maybe ++some day I'll try to run it through the UnixWare lint and see what happens). ++
  • A diagnostic message about the empty encodings in the convert script was ++made less cryptic and a bug in the awk sub-script was fixed. ++
  • The .afm creation code now considers the option -t. ++
++ ++

++3.11 -- May 24, 1999 ++

++ ++ ++Packaged by Sergey Babkin. ++

++ ++New features: ++

    ++
  • It includes the Turkish (Latin5, ISO8859/9) ++language support by Turgut Uyar and Baltic (ISO8859/4) languages support by ++Rihardas Hepas. ++
  • Also the installation script got updated: the configuration parameters ++are moved to a separate file and the generated fonts.dir files should now be ++compatible with Xfsft. ++
++ ++

++3.1 -- March 28, 1999 ++

++ ++ ++Packaged by Sergey Babkin. ++

++ ++New features: ++

    ++
  • Improved the interaction of the character-level hints and font-level hints ++
++ ++ ++

++3.0 -- March 6, 1999 ++

++ ++ ++Packaged by Sergey Babkin. ++

++ ++New features: ++

    ++
  • Added HTML documents. ++
++ ++

++3.0beta2 -- February 14, 1999 ++

++ ++ ++Packaged by Sergey Babkin. ++

++ ++New features: ++

    ++
  • Added ability to print the .afm file instead of the font to STDOUT. ++
  • Added the guessing of the /ForceBold parameter that proved to be useful. ++
++ ++Bux fixes: ++
    ++
  • Removed the force-fixed option that proved to be troublesome. ++
++ ++

++3.0beta1 -- December 11, 1998 ++

++ ++ ++By Andrew Weeks. ++

++ ++New features: ++

    ++
  • Added option (passed to t1asm) to create a compressed binary ++version of the font (A PFB file). ++
++ ++Bux fixes: ++
    ++
  • Versions of handle_post and handle_cmap that deal with some ++problems with buggy fonts. ++
  • Minor Bug Fixes. ++
++ ++

++3.0beta-afm -- December 5, 1998 ++

++ ++ ++By Thomas Henlich. ++

++ ++New features: ++

    ++
  • Integration of AFM file creation. ++
++ ++

++3.0beta -- November 15, 1998 ++

++ ++ ++By Sergey Babkin. ++

++ ++New features: ++

    ++
  • Added the auto-calculation of the italic angle. ++
++ ++Bux fixes: ++
    ++
  • Fixed a couple of bugs. ++
++ ++

++3.0alpha -- October 19, 1998 ++

++ ++ ++By Sergey Babkin. ++

++ ++New features: ++

    ++
  • Improved (although still not perfect) handling of ++scaling in composite glyphs ++
  • Automatic correction of outlines to make them more ++smooth (to correct both rounding errors introduced ++during conversion and present in the original font) ++
  • Automatic generation of hints (still has lots of ++space for improvement) ++
  • Automatic generation of BlueValues etc. ++
++ ++Bux fixes: ++
    ++
  • Scaling of fonts to 1000x1000 M-square required by ++Type1 standard ++
  • Printing out the contours in reverse direction, because ++TTF directions are different from Type1 ones (that was ++the major reason why the fonts generated by ++version 2.2 were rendered so badly in small sizes) ++
++ ++

++June 22, 1998 (AKA 2.2) ++

++ ++ ++By Thomas Henlich. ++

++ ++Bux fixes: ++

    ++
  • "width" should be "short int" because otherwise: ++characters with negative widths (e.g. -4) become *very* wide (65532) ++
  • The number of /CharStrings is numglyphs and not numglyphs+1 ++
++ ++

++February 13, 1998 ++

++ ++ ++By Mark Heath. ++

++ ++Bux fixes: ++

    ++
  • An original Bug Reported by Frank, which was just incorrect syntax in the ++Type 1 header, managed to creep back into the Feb 04 Version. This has been ++Fixed in the Feb 13 Version. ++
++ ++

++February 4, 1998 ++

++ ++ ++By Mark Heath. ++

++ ++Bux fixes: ++

    ++
  • A workaround was implemented in ttf2pfa by altering the matrix. I suspect ++I will have to calculate the correct values, as matrix ops are probably not ++allowed in Type 1 format. ++
++ ++ ++

++The older history seems to be lost. ++

++ ++ ++(S.B.: The story how we got the version numbers is rather funny. Initially ++there were no version umbers, the releases were marked by dates. The version ++from June 22 1998 untarred itself into a directory "ttf2pt1-22". When I ++made my changes to it I assumed that this was the version number meaning ++version 2.2. Since Mark asked me to send him a complete archive I supposed ++that I have to bump the version number. And I bumped it to 3.0 because the ++changes were rather extensive. Mark silently agreed and released the new ++version as 3.0. And that's the end of the story about how we got this ++Microsoft-like high version number.) ++ ++ ++ ++ +diff -ruN xserver-old/hw/xprint/extras/ttf2pt1/COPYRIGHT xserver/hw/xprint/extras/ttf2pt1/COPYRIGHT +--- xserver-old/hw/xprint/extras/ttf2pt1/COPYRIGHT 1970-01-01 10:00:00.000000000 +1000 ++++ xserver/hw/xprint/extras/ttf2pt1/COPYRIGHT 2006-06-27 13:10:26.000000000 +1000 +@@ -0,0 +1,87 @@ ++The following copyright notice applies to all the files provided ++in this distribution unless explicitly noted otherwise ++(the most notable exception being t1asm.c). ++ ++ Copyright (c) 1997-2002 by the AUTHORS: ++ Andrew Weeks ++ Frank M. Siegert ++ Mark Heath ++ Thomas Henlich ++ Sergey Babkin , ++ Turgut Uyar ++ Rihardas Hepas ++ Szalay Tamas ++ Johan Vromans ++ Petr Titera ++ Lei Wang ++ Chen Xiangyang ++ Zvezdan Petkovic ++ Rigel ++ All rights reserved. ++ ++ 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. All advertising materials mentioning features or use of this software ++ must display the following acknowledgement: ++ This product includes software developed by the TTF2PT1 Project ++ and its contributors. ++ ++ THIS SOFTWARE IS PROVIDED BY THE AUTHORS 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 AUTHORS 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. ++ ++For the approximate list of the AUTHORS' responsibilities see the ++project history. ++ ++Other contributions to the project are: ++ ++Turgut Uyar ++ The Unicode translation table for the Turkish language. ++ ++Rihardas Hepas ++ The Unicode translation table for the Baltic languages. ++ ++Szalay Tamas ++ The Unicode translation table for the Central European languages. ++ ++Johan Vromans ++ The RPM file. ++ ++Petr Titera ++ The Unicode map format with names, the forced Unicode option. ++ ++Frank M. Siegert ++ Port to Windows ++ ++Lei Wang ++Chen Xiangyang ++ Translation maps for Chinese fonts. ++ ++Zvezdan Petkovic ++ The Unicode translation tables for the Cyrillic alphabet. ++ ++Rigel ++ Generation of the dvips encoding files, modification to the Chinese maps. ++ ++I. Lee Hetherington ++ The Type1 assembler (from the package 't1utils'), its full copyright ++ notice: ++ Copyright (c) 1992 by I. Lee Hetherington, all rights reserved. ++ Permission is hereby granted to use, modify, and distribute this program ++ for any purpose provided this copyright notice and the one below remain ++ intact. ++ +diff -ruN xserver-old/hw/xprint/extras/ttf2pt1/cygbuild.sh xserver/hw/xprint/extras/ttf2pt1/cygbuild.sh +--- xserver-old/hw/xprint/extras/ttf2pt1/cygbuild.sh 1970-01-01 10:00:00.000000000 +1000 ++++ xserver/hw/xprint/extras/ttf2pt1/cygbuild.sh 2006-06-27 13:10:26.000000000 +1000 +@@ -0,0 +1,8 @@ ++: ++# this file should be run from Cygnus BASH ++# file to build ttf2pt1 with Cygnus GCC on Windows ++# don't forget to copy CYGWIN1.DLL into C:\WINDOWS ++ ++gcc -o ttf2pt1 -DWINDOWS ttf2pt1.c pt1.c t1asm.c ttf.c -lm ++gcc -o t1asm -DWINDOWS -DSTANDALONE t1asm.c ++ +diff -ruN xserver-old/hw/xprint/extras/ttf2pt1/FONTS.hpux.html xserver/hw/xprint/extras/ttf2pt1/FONTS.hpux.html +--- xserver-old/hw/xprint/extras/ttf2pt1/FONTS.hpux.html 1970-01-01 10:00:00.000000000 +1000 ++++ xserver/hw/xprint/extras/ttf2pt1/FONTS.hpux.html 2006-06-27 13:10:26.000000000 +1000 +@@ -0,0 +1,197 @@ ++ ++ ++ ++How to install new Type1 fonts on an HP-UX 10.20 machine ++ ++ ++ ++Sergey A. Babkin ++
++ ++<babkin@bellatlantic.net> or <sab123@hotmail.com> ++

++ ++ ++

++How to install new Type1 fonts on an HP-UX 10.20 machine ++

++ ++ ++1. Add the font files to /usr/lib/X11/fonts/type1.st/typefaces. ++

++ ++2. Add the font descriptions to ++/usr/lib/X11/fonts/type1.st/typefaces/fonts.scale. Run `mkfontdir' ++in /usr/lib/X11/fonts/type1.st/typefaces. In the descriptions ++you have to specify the font manufacturer as `misc', like: ++

++ ++ ++  -misc-courier-... ++ ++

++ ++3. Copy /usr/lib/X11/fonts/type1.st/typefaces/fonts.dir to ++/usr/lib/X11/fonts/type1.st/licenses/STSYSTEM/DISPLAYS/fonts.dir. ++Better yet, create a symbolic link. ++

++ ++4. For each font encoding you are going to use create a description ++file in /usr/lib/X11/fonts/stadmin/type1/charsets. Of course, if you ++are going to use the same fonts in several encodings, the best way ++would be to create fair descriptions of charsets and really store ++only one encoding in typefaces, all the others will be produced ++automatically. That's not difficult at all. ++But the simplest way is to just copy the file cp.iso8859-1 ++to cp.<your-encoding-name>, like cp.koi8-r. ++

++ ++5. Restart you X server and/or font server. ++

++ ++

++What if you don't have the `root' privileges ? ++

++ ++ ++You still can run the font server and configure your X server ++to get the fonts from it. ++

++ ++Further let's suppose that the name on which you are going ++to run the font server is named `somehost'. Login to it ++and configure the font server. ++

++ ++First, choose some unused port. Numbers around 9000 are a good ++choice. Verify that this port is not used by somebody else ++by entering ++

++ ++

++ netstat -naf inet |grep 9000 ++
++ ++and look what happens. If you get nothing, that's good, this ++port is unused. If you get some lines of data, try abother port. ++

++ ++Go to you home directory $HOME and create some directory for ++your font server, say, $HOME/fs. Copy the directory structure ++of /usr/lib/X11/fonts/type1.st into $HOME/fs, so that in result ++you get $HOME/fs/type1.st/<whatever was there>. Copy the directory ++structure of /usr/lib/X11/fonts/stadmin/type1/charsets into $HOME/fs, ++so that in result you get $HOME/fs/charsets/<whatever was there>. ++Install the new fonts in these directorues as described above. ++

++ ++Then create the fontserver configuration file, say, $HOME/fs/xfs.cfg. ++The sample contents (supposing that my $HOME is equal to /home/babkin) ++is: ++

++ ++ ++


++ ++# font server configuration file ++
++# $XConsortium: config.cpp,v 1.7 91/08/22 11:39:59 rws Exp $ ++
++ ++
++rasterizers = /usr/lib/X11/fs/ufstrast.sl,/usr/lib/X11/fs/iforast.sl ++
++ ++
++clone-self = off ++
++use-syslog = off ++
++catalogue = /home/babkin/fs/type1.st ++
++# in decipoints ++
++default-point-size = 120 ++
++default-resolutions = 100,100,75,75 ++
++port=9000 ++
++error-file=/home/babkin/fs/fs.err ++
++
++ ++

++ ++Then create the script to start your font server, say, $HOME/fs/runme: ++

++ ++ ++


++ ++TYPE1_CODEPAGE_DIR=$HOME/fs/charsets ++
++export TYPE1_CODEPAGE_DIR ++
++kill `ps -ef | grep $HOME/\[f\]s/xfs.cfg | awk '{print $2}'`; ++
++nohup xfs -config $HOME/fs/xfs.cfg & ++
++
++ ++

++ ++Don't forget to make $HOME/fs/runme executable. Then you can ++execute it manually or from you .profile. ++

++ ++After you get your font server running, just execute the following ++command (with proper host name and port number) in your X session ++

++ ++

++ xset fp+ tcp/somehost:9000 ++
++ ++to get the access to your private font server. You can add this ++information to the configuration data of your X server or just ++put it also into your .profile. In the latter case the best way ++to do that would be like: ++

++ ++ ++


++ ++... ++
++$HOME/fs/runme ++
++sleep 2 # give it some time to start ++
++xset fp+ tcp/somehost:9000 ++
++... ++
++
++ ++

++ ++ +diff -ruN xserver-old/hw/xprint/extras/ttf2pt1/FONTS.html xserver/hw/xprint/extras/ttf2pt1/FONTS.html +--- xserver-old/hw/xprint/extras/ttf2pt1/FONTS.html 1970-01-01 10:00:00.000000000 +1000 ++++ xserver/hw/xprint/extras/ttf2pt1/FONTS.html 2006-06-27 13:10:26.000000000 +1000 +@@ -0,0 +1,708 @@ ++ ++ ++ ++The ttf2pt1 font installation guide ++ ++ ++ ++Sergey A. Babkin ++
++ ++<babkin@bellatlantic.net> or <sab123@hotmail.com> ++

++ ++ ++ ++ ++

++THE FONT INSTALLATION GUIDE ++
++for the TTF to Type1 converter and fonts generated by it ++

++ ++ ++There is historically a number of problems with the support of the 8-bit ++character encodings. This installation guide pays a lot of attention ++to the 8-bit issues, because these issues are responsible for the ++most of troubles during the installation of fonts. But they are ++not the only things covered in this guide, so it's worth reading ++even if all you need is plain ASCII. For convenience of reading ++I have marked the paragraphs dealing solely with 8-bit problems ++with characters *8*. ++

++ ++To simplify this installation the distribution package of the ++converter contains a number of scripts written in shell and ++Perl. So, to run them you will need a shell interpreter (Bourne-shell, ++POSIX-shell, Korn-shell are OK, ba-shell is probably also OK but not ++tested yet). The Perl scripts were tested with Perl5 but probably ++should work with Perl4 too. All the scripts are located in the ++`scripts' subdirectory. ++

++ ++This guide considers the following issues of installation of the ++fonts: ++

++ ++ ++

++

++ ++ ++

++X11 ++

++ ++ ++ ++ ++ ++To simplify the conversion a set of scripts is provided with ttf2pt1. ++They are collected in the `scripts' subdirectory. ++

++ ++ ++`Convert' is the master conversion script provided with ttf2pt1. ++When installed into a public directory it's named `ttf2pt1_convert' ++to avoid name collisions with the other programs. ++

++ ++ ++It's called as: ++

++ ++ ++ ++ ++

++ convert [config-file] ++
++ ++ ++If the configuration file is not specified as an argument then the file ++`convert.cfg' in the current directory is used. This file contains ++a set of configuration variables. The distribution contains a sample file ++file `convert.cfg.sample'. Please copy it to `convert.cfg', ++look inside it and change the configuration variables. The more stable ++configuration variables, such as the path names of the scripts and ++encoding files are located in `convert' itself, they are ++automatically updated when installing ttf2pt1. ++

++ ++Put all the TTF fonts you want to convert into some directory (this ++may be just the directory that already contains all the Windows ++fonts on a mounted FAT filesystem). If you have fonts in different ++source encoding then put the fonts in each of the encodings ++into a separate directory. Up to 10 source directories are ++supported. If you (in a rather unlikely case) have more source ++directories then you can make two separate runs of the converter, ++converting up to 10 directories at a time. ++

++ ++The variables in the configuration file are: ++

++ ++ ++ ++SRCDIRS - the list of directories (with absolute paths) with ++ TTF fonts. Each line contains at least 3 fields: the name of the directory, ++ the language of the fonts in it (if you have fonts for different ++ languages you have to put them into the separate directories) and the ++ encoding of the fonts. Again, if you have some of the TTF typefaces in ++ one encoding, and some in another (say, CP-1251 and KOI-8), you have ++ to put them into the separate source directories. Some lines may contain ++ 4 fields. Then the fourth field is the name of the external map to ++ convert the Unicode fonts into the desirable encoding. This map is ++ used instead of the built-in map for the specified language. ++

++ ++*8* ++An interesting thing is that some languages have more than one ++widely used character encodings. For example, the widely used ++encodings for Russian are IBM CP-866 (MS-DOS and Unix), KOI-8 ++(Unix and VAX, also the standard Internet encoding), IBM CP-1251 (MS Windows). ++That's why I have provided the means to generate the converted fonts ++in more than one encoding. See the file encodings/README for ++details about the encoding tables. Actually, if you plan to use ++these fonts with Netscape Navigator better use the aliases ++cp-866 instead of ibm-866 and windows-1251 instead of ibm-1251 ++because that's what Netscape wants. ++

++ ++ ++DSTDIR - directory for the resulting Type1 fonts. Be careful! ++ This directory gets completely wiped out before conversion, ++ so don't use any already existing directory for this purpose. ++

++ ++ ++DSTENC{language} - the list of encodings in which the destination ++ fonts will be generated for each language. Each font of that ++ language will be generated in each of the specified ++ encodings. If you don't want any translation, just specify both ++ SRCENC and DSTENC as iso8859-1 (or if you want any other encoding ++ specified in the fonts.dir, copy the description of 8859-1 with ++ new name and use this new name for SRCENC and DSTENC). ++

++ ++ ++FOUNDRY - the foundry name to be used in the fonts.dir file. I have ++ set it to `fromttf' to avoid name conflicts with any existing font for ++ sure. But this foundry name is not registered in X11 standards and ++ if you want to get the full standard compliance or have a font server ++ that enforces such a compliance, use `misc'. ++

++ ++ ++The next few parameters control the general behavior of the converter. ++They default values are set to something reasonable. ++

++ ++ ++ ++CORRECTWIDTH - if the value is set to YES then use the ++ converter option -w, otherwise don't use it. See the description of ++ this option in the README file. ++

++ ++ ++REMOVET1A - if the value is set to YES then after ++ conversion remove the un-encoded .t1a font files and the ++ intermediate .xpfa font metric files. ++

++ ++ ++INSTALLFONTMAP - a Ghostscript parameter, if the value is set to ++ YES then install the entries for the new fonts ++ right into the main Fontmap file. Otherwise just leave ++ the file Fontmap.ttf in the Ghostscript configuration ++ directory. ++

++ ++ ++HINTSUBST - if the value is set to YES use the option ++ -H, otherwise don't use it. This option enables the ++ hint substitution technique. If you have not installed the X11 patch ++ described above, use this option with great caution. See further ++ description of this option in the README file. ++

++ ++ ++ENFORCEISO - if the value is set to YES then ++ disguise the resulting fonts as the fonts in ISOLatin1 encoding. Historically ++ this was neccessary due to the way the installer scripts created the ++ X11 font configuration files. It is not neccessary any more for this ++ purpose. But if you plan to use these fonts with some other application ++ that expects ISOLatin1 encoding then better enable this option. ++

++ ++ ++ALLGLYPHS - if the value is set to YES then ++ include all the glyphs from the source fonts into the resulting fonts, even ++ if these glyphs are inaccessible. If it's set to NO then ++ include only the glyphs which have codes assigned to them. The glyphs ++ without codes can not be used directly. But some clever programs, ++ such as the Type 1 library from XFree86 3.9 and higher can change ++ the encoding on the fly and use another set of glyphs. If you have not ++ installed the X11 patch described above, use this option with great ++ caution. See further description of the option option -a in the ++ README file. ++

++ ++ ++GENUID - if the value is set to YES then use ++ the option -uA of the converter to generate UniqueIDs for ++ the converted fonts. The standard X11 Type 1 library does not use ++ this ID, so it may only be neccessary for the other applications. ++ The script is clever enough to generate different UniqueID for the ++ same font converted to multiple encodings. Also after conversion it ++ checks all the fonts generacted during the session for duplicated ++ UniqueID and shows those. Still, this does not quarantee that these ++ UniqueIDs won't overlap with some other fonts. The UniqueIDs are ++ generated as hash values from the font names, so it's guaranteed ++ that if the `convert' script runs multiple times it will ++ generate the same UniqueIDs during each run. See further description ++ of this option in the README file. ++

++ ++ ++GENUID - if the value is set to YES then create ++ the .pfb files, otherwise the .pfa files. The .pfb ++ files are more compact but contain binary data, so you may experience some ++ troubles when transferring them through the network. ++

++ ++ ++The following parameters are used to locate the other scripts and ++configuration files. By default the scripts do a bit of guessing for them: ++they search in the ttf2pt1 installation directory if ttf2pt1 ++was installed or otherwise suppose that you are running `convert' with ++`scripts' subdirectory being the current directory. ++

++ ++ ++ ++ENCDIR - directory containing the descriptions of encodings ++
++ ++MAPDIR - directory containing the external map files ++

++ ++ ++Besides that a few parameters are built into the `convert' script itself. ++You probably won't need to change them: ++

++ ++ ++ ++T1ASM, TTF2PT1, TRANS, T1FDIR, FORCEISO - paths to the other script ++

++ ++ ++Also there are a few parameters controlling the installation of ++fonts for Ghostscript. Please look at their description in the ++Ghostscript section of documentation or in the ttf2pt1_x2gs(1) ++manual page before running `convert'. If these parameters are ++set, `convert' will call the `x2gs' script automatically ++to install the newly converted fonts in Ghostscript. ++

++ ++After creating the configuration file run the `convert' script. Look at ++the result and the log file in DSTDIR. ++

++ ++Add the directory with newly converted fonts to the configuration ++of X server or font server. For most of the systems this step is ++very straightforward. For HP-UX it's rather tricky and poorly ++documented, so the file FONTS.hpux gives a short description. ++

++ ++If you don't have the privileges of the root user, you still can ++configure your private font server. Just use some non-standard ++port number (see FONTS.hpux for an example, exept that you won't ++need all the HP-related stuff on any other system). ++

++ ++ ++

++Known Problems ++

++ ++ ++ ++ ++
    ++
  • One catch is that the X11 Type 1 font library has a rather low limit ++ on the font size. Because of this the fonts with more complicated ++ outlines and the enabled hint substitution may not fit into ++ this limit. The same applies to the fonts with very complicated ++ outlines or with very many glyphs (especially the fonts with ++ over 256 glyphs). So you will need to excercise caution with ++ these options if you plan using these fonts with X11. Some vendors ++ such as HP provide the Type 1 implementation licensed from Adobe ++ which should have no such problem. ++

    ++ ++ But there is a solution even for the generic X11. A patch located ++ in the subdirectory `app/X11' fixes this problem as well ++ as some other minor problems. Its description is provided in ++ app/X11/README. ++

    ++ ++ To fix the X11 font library, you have to get the X11 sources. I ++ can recommend the ftp sites of the XFree86 project ftp://ftp.xfree86.org ++ or of the Open Group ftp://ftp.x.org. This patch was made on the sources ++ of XFree86 so you may have better success with applying it to the ++ XFree86 distribution. After you have got the sources, make sure ++ that you can compile them. Then apply the patch as described. ++ Make sure that it was applied properly. Compile the sources again ++ (actually, you need only the fonts library, the fonts server, and ++ possibly the X server). It would be prudent now to save your old ++ font library, font server and, possibly, X server. Then install ++ the new recently compiled versions of these files. Of course, ++ if you know someone who already has compiled these files for the ++ same OS as yours, you can just copy the binary fles from him. ++

    ++ ++ Alas, building the X11 system from the source code is not the ++ easiest thing in the world and if you have no experience it ++ can be quite difficult. In this case just avoid the aforementioned ++ features or check each converted font to make sure that it ++ works properly. ++

    ++ ++

  • The Type1 font library from the standard X11 distribution ++ does not work on HP-UX (at least, up to 10.01). The font server ++ supplied with HP-UX up to 10.01 is also broken. Starting from ++ HP-UX 10.20 (I don't know about 10.10) they supply a proprietary font ++ library and the converted fonts work fine with it, provided that ++ they are configured properly (see the file FONTS.hpux). ++

    ++ ++

  • The fonts.scale files created by the older versions of the ++ ttf2pt1 installation program (up to release 3.1) have conflicted ++ with the language definitions of the Xfsft font server and ++ parts of it included into XFree86. To overcome this incompatibility ++ the never versions creats the fonts.scale file describing all the ++ fonts as belonging to the adobe-fontspecific encoding and ++ the fonts.alias file with the proper names. The drawback of ++ this solution is that xlsfonts gives the list of twice more ++ fonts. But as a side effect the option ENFORCEISO in ++ `convert.cfg' is not required for X11 any more. ++

    ++ ++

  • The conversion script has no support for Eastern multi-plane fonts. ++ Contribution of such a support would be welcome. ++

    ++

++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++

++Ghostscript ++

++ ++ ++ ++ ++ ++ ++The fonts generated with ttf2pt1 work fine with Ghostscript by ++themselves. The script `x2gs' (or `ttf2pt1_x2gs' when installed ++into a public directory, to avoid name conflicts with other ++programs) links the font files from the X11 direcotry into the Ghostscript ++directory and automatically creates the description file (Fontmap) ++in Ghostscript format. ++ ++ ++It's called as: ++

++ ++ ++ ++ ++

++ x2gs [config-file] ++
++ ++ ++If the configuration file is not specified as an argument then the file ++`convert.cfg' in the current directory is used, just like the ++`convert' script does. Indeed, this configuration file is used for ++both scripts. ++

++ ++The Ghostscript-related parameters in the configuration file are: ++

++ ++DSTDIR - the X11 font directory used by `x2gs' as the ++ source of the fonts. This parameter is common with the X11 ++ configuration. ++

++ ++GSDIR - the base directory of Ghostsript. If this ++ parameter is set to an empty string then `convert' won't ++ call `x2gs'. So if you want to get only the X11 fonts ++ installed then set this parameter to an empty string. This ++ directory may vary on various system, so please check your ++ system and set this value accordingly before running the script. ++

++ ++GSFONTDIR - the font directory of Ghostscript. In the standard ++ Ghostscript installation it's a subdirectory of GSDIR ++ but some systems may use completely different directories. ++

++ ++GSCONFDIR - the configuration subdirectory of Ghostscript ++ that contains the Fontmap file. ++

++ ++INSTALLFONTMAP - if the value is set to YES then ++ install the entries for the new fonts right into the main ++ Fontmap file. Otherwise just leave the file Fontmap.ttf ++ in the Ghostscript configuration directory. ++

++ ++ ++After preparing the configuration file run the script. It symbolicaly links ++all the font files and creates the description file Fontmap.ttf in ++GSCONDFIR. After that there are two choices. ++

++ ++If the option INSTALLFONTMAP was set to YES then ++the font descriptions are also automatically installed into the ++master Fontmap file. The script is clever enough to ++detect if it was run multiple times with the same directories ++and if so it replaces the old Fontmap entries with ++the new ones instead of just accumulating all of them. You ++may also run it multiple times for multiple X11 directories ++and all the results will be properly collected in the Fontmap. ++But it's your responsibility to watch that the names of the ++font files don't overlap. If the X11 font directory gets ++renamed then you have to remove its font entries from the ++Fontmap and only after that re-run `x2gs' ++for the new directory. ++

++ ++On the other hand if the option INSTALLFONTMAP was set to ++NO then go to the GSCONFDIR directory and insert the ++contents of Fontmap.ttf into the Fontmap file ++manually. This step may be left manual to make the installation ++a little bit more safe. ++

++ ++After that you may also want to redefine some of the aliases in ++Fontmap to refer to the newly installed fonts. ++But the redefinition of the aliases may be dangerous if the width of ++characters in the new font will be different from the old font. ++Alas, there is no visible solution of this problem yet. ++

++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++

++MS Windows ++

++ ++ ++Ttf2pt1 can be built on Windows either with native compiler or in ++POSIX emulation mode. ++

++ ++Native MS Windows compilers require a different way to build the converter ++instead of the Makefile (their make programs commonly are quite weird ++and limited in capabilities). An example of batch file winbuild.bat ++is provided for MS Visual C/C++. Probably it can be easily adapted for other ++32-bit Windows and DOS compilers. The important part is to define the ++preprocessor symbol WINDOWS during compilation. ++

++ ++Cygnus make almost supports full Makefiles but not quite. Seems ++like its POSIX support is also of the same quality "almost but not quite". ++So another command file cygbuild.sh is provided for Cygnus GNU C, also ++with the preprocessor symbol WINDOWS defined. It is intended to be run from ++the Cygnus BASH shell. To run the programs produced by the Cygnus compiler ++the Cygnus library file CYGWIN1.DLL should be copied first into ++C:\WINDOWS. ++

++ ++To run the accompanying scripts Perl for Windows will be required as well as ++other tools from the Cygnus set. ++

++ ++The Windows support was not particularly tested, so in case of problems with ++building or running the converter please let us know. ++

++ ++The pre-built code (possibly of an older version) of ttf2pt1 for MS Windows is ++available from the GnuWin32 project from ++ ++http://gnuwin32.sourceforge.net/packages/ttf2pt1.htm ++

++ ++ ++

++Netscape Navigator/Communicator ++

++ ++ ++Basically, the biggest problem with Netscape Navigator is that ++it has built-in fixed PostScript font names and built-in fixed ++glyph tables for them. Oh, no, that's two! Let's start over: ++basically the two biggest problems of Netscape Navigator are ++that (one)it has built-in fixed PostScript font names and (two) ++built-in fixed glyph tables for them and (three) it always ++assumes that the fonts have ISOLatin1 encoding. OK, let's ++start over again: basically the three biggest problems of Netscape ++Navigator are that (one) it has built-in fixed PostScript font names, ++(two) built-in fixed glyph tables for them and (three) it always ++assumes that the fonts have ISOLatin1 encoding and (four) it ++does not remember the scaled font size between the sessions. ++You did not expect such a Spanish Inquisition, did you ? (*) ++

++ ++Luckily, we have solutions for all of these problems. They are ++located in the subdirectory `app/netscape' and described ++in app/netscape/README. ++

++ ++ ++  -------
++  *) See Monty Python's Flying Circus, episode 15 ++

++ ++*8* ++

++Netscape and cyrillic fonts
++ ++(courtesy of Zvezdan Petkovic) ++

++ ++If you use TrueType fonts in your X, as I do, and you always get ++KOI8-R encoded pages, then your Netscape does not recognise windows-1251 ++encoding. Microsoft TrueType fonts simply declare all encodings they ++can support including KOI8-R. For some reason, KOI8-R always wins over ++ISO-8859-5 in Netscape under X. If you are reading other cyrillic ++languages besides Russian, you might want to either erase KOI8-R entries ++from the fonts.dir and fonts.scale files, or alternatively fix Netscape. ++I put this line in my .Xdefaults. ++

++ ++

++ Netscape*documentFonts.charset*koi8-r: iso-8859-5 ++
++

++ ++Notice that you can still read Russian sites without trouble because ++Netscape translates KOI8-R to ISO-8859-5 on the fly. I read both Russian ++and Serbian sites with no trouble. ++

++ ++Note: If anybody knows the way to tell Netscape under Unix how to ++recognise {windows,ibm,cp}-1251 encoded fonts, I'd like to hear about that. ++

++ ++ ++

++Linux RPM package ++

++ ++ ++The spec file for the creation of a Linux RPM package is located in ++app/RPM. It has been contributed by Johan Vromans. When ++make all is ran in the main directory it among the other ++things creates the version of itself adapted to Linux in app/RPM, ++you may want to copy that version back to the main directory. ++

++ ++Warning: Please note that the install section is incomplete, and ++the installed scripts won't work until the paths inside them ++are corrected. ++

++ ++ ++

++FrameMaker ++

++ ++ ++The fonts and AFM files generated by the version 3.2 and higher ++should work with Framemaker without problems. The AFM files ++generated by the previous versions of the converter require a ++line added to them: ++

++ ++  EncodingScheme FontSpecific ++

++ ++And the underscores in the font names of the font and AFM files ++generated by the older versions may need to be changed to dashes. ++

++ ++NOTE by Jason Baietto: Ignore the directions in the Frame on-line docs ++that say to put a "serverdict begin 0 exitserver" line in the pfa files. ++Doing this caused both my printer and ghostscript to choke on the resulting ++output from FrameMaker, so I would not advise doing this (though your ++mileage may vary). ++

++ ++ ++

++StarOffice ++

++ ++ ++StarOffice 5.1x has been reported to crash if the .afm file contains ++spaces in the values of such statements as Version, Weight etc. ++These spaces are permitted by the Adobe spec, so this is a problem of ++StarOffice. The easiest way to fix these .afm files for StarOffice ++is to remove spaces in these strings or remove these strings (in case if ++they are optional) at all. This can be done automatically with a sed ++script. It seems that StarOffice 5.2 has this problem fixed, so we decided to ++spend no efforts on providing workarounds for 5.1 with ttf2pt1. ++

++ ++ ++ +diff -ruN xserver-old/hw/xprint/extras/ttf2pt1/ft.c xserver/hw/xprint/extras/ttf2pt1/ft.c +--- xserver-old/hw/xprint/extras/ttf2pt1/ft.c 1970-01-01 10:00:00.000000000 +1000 ++++ xserver/hw/xprint/extras/ttf2pt1/ft.c 2006-06-27 13:10:26.000000000 +1000 +@@ -0,0 +1,808 @@ ++/* ++ * The font parser using the FreeType library version 2. ++ * ++ * see COPYRIGHT ++ * ++ */ ++ ++#ifdef USE_FREETYPE ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include FT_FREETYPE_H ++#include FT_TRUETYPE_TABLES_H ++#include FT_BBOX_H ++#include FT_GLYPH_H ++ ++#include FT_CONFIG_CONFIG_H ++#include FT_CONFIG_OPTIONS_H ++#include FT_ERRORS_H ++#include FT_SYSTEM_H ++#include FT_IMAGE_H ++#include FT_TYPES_H ++#include FT_OUTLINE_H ++#include FT_MODULE_H ++#include FT_RENDER_H ++#include FT_TYPE1_TABLES_H ++#include FT_TRUETYPE_IDS_H ++#include FT_TRUETYPE_TAGS_H ++#include FT_MULTIPLE_MASTERS_H ++#include FT_SFNT_NAMES_H ++ ++#ifdef XP_PSTEXT ++#include "os.h" ++#include "Xproto.h" ++#include "font.h" ++#include "fontstruct.h" ++#include "fntfilst.h" ++#include "fontutil.h" ++#include "fontenc.h" ++#include "ft.h" ++#define NOT_IN_FTFUNCS ++#include "ftfuncs.h" ++#endif /* XP_PSTEXT */ ++ ++#include "pt1.h" ++#include "global.h" ++ ++/* prototypes of call entries */ ++static void openfont(char *fname, char *arg); ++static void closefont( void); ++static int getnglyphs ( void); ++static int glnames( GLYPH *glyph_list); ++static void glmetrics( GLYPH *glyph_list); ++static int glenc( GLYPH *glyph_list, int *encoding, int *unimap); ++static void fnmetrics( struct font_metrics *fm); ++static void glpath( int glyphno, GLYPH *glyph_list); ++static void kerning( GLYPH *glyph_list); ++ ++/* globals */ ++ ++/* front-end descriptor */ ++struct frontsw freetype_sw = { ++ /*name*/ "ft", ++ /*descr*/ "based on the FreeType2 library", ++ /*suffix*/ { "ttf", "ttc", "otf", "otc", "pfa", "pfb" }, ++ /*open*/ openfont, ++ /*close*/ closefont, ++ /*nglyphs*/ getnglyphs, ++ /*glnames*/ glnames, ++ /*glmetrics*/ glmetrics, ++ /*glenc*/ glenc, ++ /*fnmetrics*/ fnmetrics, ++ /*glpath*/ glpath, ++ /*kerning*/ kerning, ++}; ++ ++/* statics */ ++ ++static char * dupcnstring( unsigned char *s, int len); ++ ++#ifndef XP_PSTEXT ++static FT_Library library; ++#endif /* !XP_PSTEXT */ ++static FT_Face face; ++ ++static int enc_type, enc_found; ++ ++/* SFNT functions do not seem to be included by default in FT2beta8 */ ++#define ENABLE_SFNT ++ ++/* ++ * Open font and prepare to return information to the main driver. ++ * May print error and warning messages. ++ * Exit on error. ++ */ ++ ++static void ++openfont( ++ char *fname, ++ char *arg /* unused now */ ++) ++{ ++ FT_Error error; ++ ++#ifdef XP_PSTEXT ++ extern FT_Face xp_pstext_ft_face; ++ extern FT_Library ftypeLibrary; /* defined in xc/lib/font/FreeType/ftfuncs.c */ ++ ++ face = xp_pstext_ft_face; ++#else ++ if( FT_Init_FreeType( &library ) ) { ++ fprintf(stderr, "** FreeType initialization failed\n"); ++ exit(1); ++ } ++ ++ if( error = FT_New_Face( library, fname, 0, &face ) ) { ++ if ( error == FT_Err_Unknown_File_Format ) ++ fprintf(stderr, "**** %s has format unknown to FreeType\n", fname); ++ else ++ fprintf(stderr, "**** Cannot access %s ****\n", fname); ++ exit(1); ++ } ++#endif /* XP_PSTEXT */ ++ ++ if(FT_HAS_FIXED_SIZES(face)) { ++ WARNING_1 fprintf(stderr, "Font contains bitmaps\n"); ++ } ++ if(FT_HAS_MULTIPLE_MASTERS(face)) { ++ WARNING_1 fprintf(stderr, "Font contains multiple masters, using default\n"); ++ } ++ ++ if(ISDBG(FT)) fprintf(stderr," %d units per EM\n", face->units_per_EM); ++ ++ enc_found = 0; ++} ++ ++/* ++ * Close font. ++ * Exit on error. ++ */ ++ ++static void ++closefont( ++ void ++) ++{ ++#ifdef XP_PSTEXT ++ /* NOP */ ++#else ++ if( FT_Done_Face(face) ) { ++ WARNING_1 fprintf(stderr, "Errors when closing the font file, ignored\n"); ++ } ++ if( FT_Done_FreeType(library) ) { ++ WARNING_1 fprintf(stderr, "Errors when stopping FreeType, ignored\n"); ++ } ++#endif /* XP_PSTEXT */ ++} ++ ++/* ++ * Get the number of glyphs in font. ++ */ ++ ++static int ++getnglyphs ( ++ void ++) ++{ ++ if(ISDBG(FT)) fprintf(stderr, "%d glyphs in font\n", face->num_glyphs); ++ return (int)face->num_glyphs; ++} ++ ++/* ++ * Get the names of the glyphs. ++ * Returns 0 if the names were assigned, non-zero if the font ++ * provides no glyph names. ++ */ ++ ++static int ++glnames( ++ GLYPH *glyph_list ++) ++{ ++#define MAX_NAMELEN 1024 ++ ++#ifdef XP_PSTEXT ++ char buf[1024]; ++ long i; ++ FT_Error error; ++ ++#ifdef XP_ONLY_BLOCKS ++ extern unsigned long xp_font_block_offset; ++ extern FTFontPtr xp_xtf; ++ int bc; /* block counter */ ++ ++ ++ /* FixMe: This code should use PsOut_Get_FreeType_Glyph_Name() instead of ++ * duplicating the code ++ */ ++ for( bc = xp_font_block_offset ; bc < (xp_font_block_offset+256) ; bc++ ) { ++ /* Remap X11 font index to FreeType font index */ ++ i = FTRemap(face, &xp_xtf->mapping, bc); ++ ++ if( i >= face->num_glyphs ) ++ continue; ++#else ++ for(i=0; i < face->num_glyphs; i++) { ++#endif /* XP_ONLY_BLOCKS */ ++ if( FT_Has_PS_Glyph_Names(face) ) { ++ error = FT_Get_Glyph_Name(face, i, buf, MAX_NAMELEN); ++ } ++ else ++ { ++ error = -1; ++ } ++ ++ if( error ) { ++ /* Check for unicode mapping ++ * See Adobe document "Unicode and Glyph Names" ++ * (http://partners.adobe.com/asn/tech/type/unicodegn.jsp) ++ */ ++ if( (xp_xtf->mapping.mapping->type == FONT_ENCODING_UNICODE) && ++ (i < 0xFFFE) ) ++ { ++ sprintf(buf, "uni%04lx", i); ++ } ++ else ++ { ++ sprintf(buf, "ch%02lx", i); ++ } ++ } ++ glyph_list[i].name = strdup(buf); ++ if(ISDBG(FT)) fprintf(stderr, "%d has name %s\n", i, buf); ++ if (glyph_list[i].name == NULL) { ++ fprintf (stderr, "****malloc failed %s line %d\n", __FILE__, __LINE__); ++ exit(255); ++ } ++ } ++ ++ return 0; ++#else ++ char bf[1024]; ++ long i; ++ ++ if( ! FT_HAS_GLYPH_NAMES(face) ) { ++ WARNING_1 fprintf(stderr, "Font has no glyph names\n"); ++ return 1; ++ } ++ ++ for(i=0; i < face->num_glyphs; i++) { ++ if( FT_Get_Glyph_Name(face, i, bf, MAX_NAMELEN) || bf[0]==0 ) { ++ sprintf(bf, "_g_%d", i); ++ WARNING_2 fprintf(stderr, ++ "Glyph No. %d has no postscript name, becomes %s\n", i, bf); ++ } ++ glyph_list[i].name = strdup(bf); ++ if(ISDBG(FT)) fprintf(stderr, "%d has name %s\n", i, bf); ++ if (glyph_list[i].name == NULL) { ++ fprintf (stderr, "****malloc failed %s line %d\n", __FILE__, __LINE__); ++ exit(255); ++ } ++ } ++ ++ return 0; ++#endif /* XP_PSTEXT */ ++} ++ ++/* ++ * Get the metrics of the glyphs. ++ */ ++ ++static void ++glmetrics( ++ GLYPH *glyph_list ++) ++{ ++ GLYPH *g; ++ int i; ++ FT_Glyph_Metrics *met; ++ FT_BBox bbox; ++ FT_Glyph gly; ++ ++#ifdef XP_ONLY_BLOCKS ++ extern unsigned long xp_font_block_offset; ++ extern FTFontPtr xp_xtf; ++ int bc; /* block counter */ ++ ++ for( bc = xp_font_block_offset ; bc < (xp_font_block_offset+256) ; bc++ ) { ++ /* Remap X11 font index to FreeType font index */ ++ i = FTRemap(face, &xp_xtf->mapping, bc); ++ ++ if( i >= face->num_glyphs ) ++ continue; ++ ++#else ++ for(i=0; i < face->num_glyphs; i++) { ++#endif /* XP_ONLY_BLOCKS */ ++ g = &(glyph_list[i]); ++ ++ if( FT_Load_Glyph(face, i, FT_LOAD_NO_BITMAP|FT_LOAD_NO_SCALE) ) { ++ fprintf(stderr, "Can't load glyph %s, skipped\n", g->name); ++ continue; ++ } ++ ++ met = &face->glyph->metrics; ++ ++ if(FT_HAS_HORIZONTAL(face)) { ++ g->width = met->horiAdvance; ++ g->lsb = met->horiBearingX; ++ } else { ++ WARNING_2 fprintf(stderr, "Glyph %s has no horizontal metrics, guessed them\n", g->name); ++ g->width = met->width; ++ g->lsb = 0; ++ } ++ ++ if( FT_Get_Glyph(face->glyph, &gly) ) { ++ fprintf(stderr, "Can't access glyph %s bbox, skipped\n", g->name); ++ continue; ++ } ++ ++ FT_Glyph_Get_CBox(gly, ft_glyph_bbox_unscaled, &bbox); ++ g->xMin = bbox.xMin; ++ g->yMin = bbox.yMin; ++ g->xMax = bbox.xMax; ++ g->yMax = bbox.yMax; ++ ++ g->ttf_pathlen = face->glyph->outline.n_points; ++ } ++} ++ ++/* ++ * Get the original encoding of the font. ++ * Returns 1 for if the original encoding is Unicode, 2 if the ++ * original encoding is other 16-bit, 0 if 8-bit. ++ */ ++ ++static int ++glenc( ++ GLYPH *glyph_list, ++ int *encoding, ++ int *unimap ++) ++{ ++#ifdef XP_PSTEXT ++ int i, ++ e; ++ unsigned code; ++ extern FTFontPtr xp_xtf; ++ extern unsigned long xp_font_block_offset; ++ ++ enc_found = 1; ++ enc_type = 0; ++ ++ for(i=0; imapping, xp_font_block_offset+i); ++ ++ if(code == 0) ++ continue; /* .notdef */ ++ ++ encoding[i] = code; ++ } ++ ++ return enc_type; ++#else ++ int i, e; ++ unsigned code; ++ ++ if(ISDBG(FT)) ++ for(e=0; e < face->num_charmaps; e++) { ++ fprintf(stderr, "found encoding pid=%d eid=%d\n", ++ face->charmaps[e]->platform_id, ++ face->charmaps[e]->encoding_id); ++ } ++ ++ if(enc_found) ++ goto populate_map; ++ ++ enc_type = 0; ++ ++ /* first check for an explicit PID/EID */ ++ ++ if(force_pid != -1) { ++ for(e=0; e < face->num_charmaps; e++) { ++ if(face->charmaps[e]->platform_id == force_pid ++ && face->charmaps[e]->encoding_id == force_eid) { ++ WARNING_1 fprintf(stderr, "Found Encoding PID=%d/EID=%d\n", ++ force_pid, force_eid); ++ if( FT_Set_Charmap(face, face->charmaps[e]) ) { ++ fprintf(stderr, "**** Cannot set charmap in FreeType ****\n"); ++ exit(1); ++ } ++ enc_type = 1; ++ goto populate_map; ++ } ++ } ++ fprintf(stderr, "*** TTF encoding table PID=%d/EID=%d not found\n", ++ force_pid, force_eid); ++ exit(1); ++ } ++ ++ /* next check for a direct Adobe mapping */ ++ ++ if(!forcemap) { ++ for(e=0; e < face->num_charmaps; e++) { ++ if(face->charmaps[e]->encoding == ft_encoding_adobe_custom) { ++ WARNING_1 fputs("Found Adobe Custom Encoding\n", stderr); ++ if( FT_Set_Charmap(face, face->charmaps[e]) ) { ++ fprintf(stderr, "**** Cannot set charmap in FreeType ****\n"); ++ exit(1); ++ } ++ goto populate_map; ++ } ++ } ++ } ++ ++ for(e=0; e < face->num_charmaps; e++) { ++ if(face->charmaps[e]->platform_id == 3) { ++ switch(face->charmaps[e]->encoding_id) { ++ case 0: ++ WARNING_1 fputs("Found Symbol Encoding\n", stderr); ++ break; ++ case 1: ++ WARNING_1 fputs("Found Unicode Encoding\n", stderr); ++ enc_type = 1; ++ break; ++ default: ++ WARNING_1 { ++ fprintf(stderr, ++ "****MS Encoding ID %d not supported****\n", ++ face->charmaps[e]->encoding_id); ++ fputs("Treating it like Symbol encoding\n", stderr); ++ } ++ break; ++ } ++ break; ++ } ++ } ++ if(e >= face->num_charmaps) { ++ WARNING_1 fputs("No Microsoft encoding, using first encoding available\n", stderr); ++ e = 0; ++ } ++ ++ if( FT_Set_Charmap(face, face->charmaps[e]) ) { ++ fprintf(stderr, "**** Cannot set charmap in FreeType ****\n"); ++ exit(1); ++ } ++ ++populate_map: ++ enc_found = 1; ++ for(i=0; i=' ' && c!=127) ++ *out++ = c; ++ else if(!warned) { ++ warned=1; ++ WARNING_1 fprintf(stderr, "Some font name strings are in Unicode, may not show properly\n"); ++ } ++ } ++ *out = 0; ++ return res; ++} ++ ++/* ++ * Get the font metrics ++ */ ++static void ++fnmetrics( ++ struct font_metrics *fm ++) ++{ ++ char *str; ++ static char *fieldstocheck[3]; ++#ifdef ENABLE_SFNT ++ FT_SfntName sn; ++#endif /* ENABLE_SFNT */ ++ int i; ++ ++ fm->italic_angle = 0.0; /* FreeType hides the angle */ ++ fm->underline_position = face->underline_position; ++ fm->underline_thickness = face->underline_thickness; ++ fm->is_fixed_pitch = FT_IS_FIXED_WIDTH(face); ++ ++ fm->ascender = face->ascender; ++ fm->descender = face->descender; ++ ++ fm->units_per_em = face->units_per_EM; ++ ++ fm->bbox[0] = face->bbox.xMin; ++ fm->bbox[1] = face->bbox.yMin; ++ fm->bbox[2] = face->bbox.xMax; ++ fm->bbox[3] = face->bbox.yMax; ++ ++#ifdef ENABLE_SFNT ++ if( FT_Get_Sfnt_Name(face, TT_NAME_ID_COPYRIGHT, &sn) ) ++#endif /* ENABLE_SFNT */ ++ fm->name_copyright = ""; ++#ifdef ENABLE_SFNT ++ else ++ fm->name_copyright = dupcnstring(sn.string, sn.string_len); ++#endif /* ENABLE_SFNT */ ++ ++ fm->name_family = face->family_name; ++ ++ fm->name_style = face->style_name; ++ if(fm->name_style == NULL) ++ fm->name_style = ""; ++ ++#ifdef ENABLE_SFNT ++ if( FT_Get_Sfnt_Name(face, TT_NAME_ID_FULL_NAME, &sn) ) ++#endif /* ENABLE_SFNT */ ++ { ++ int len; ++ ++ len = strlen(fm->name_family) + strlen(fm->name_style) + 2; ++ if(( fm->name_full = malloc(len) )==NULL) { ++ fprintf (stderr, "****malloc failed %s line %d\n", __FILE__, __LINE__); ++ exit(255); ++ } ++ strcpy(fm->name_full, fm->name_family); ++ if(strlen(fm->name_style) != 0) { ++ strcat(fm->name_full, " "); ++ strcat(fm->name_full, fm->name_style); ++ } ++ } ++#ifdef ENABLE_SFNT ++ else ++ fm->name_full = dupcnstring(sn.string, sn.string_len); ++#endif /* ENABLE_SFNT */ ++ ++#ifdef ENABLE_SFNT ++ if( FT_Get_Sfnt_Name(face, TT_NAME_ID_VERSION_STRING, &sn) ) ++#endif /* ENABLE_SFNT */ ++ fm->name_version = "1.0"; ++#ifdef ENABLE_SFNT ++ else ++ fm->name_version = dupcnstring(sn.string, sn.string_len); ++#endif /* ENABLE_SFNT */ ++ ++#ifdef XP_PSTEXT ++ { ++ extern const char *xp_psfontname; ++ ++ fm->name_ps = strdup(xp_psfontname); ++ ++ /* Handle the rare case if a family name was not provided by the TTF ++ * font (like Solaris TTF fonts in /usr/openwin/lib/locale/ko.UTF-8/X11/fonts/TrueType, ++ * /usr/openwin/lib/locale/ko/X11/fonts/TrueType) - in this case we ++ * have to generate a family name somehow... */ ++ if(fm->name_family == NULL) ++ fm->name_family = fm->name_ps; ++ } ++#else ++ ++#ifdef ENABLE_SFNT ++ if( FT_Get_Sfnt_Name(face, TT_NAME_ID_PS_NAME , &sn) ) { ++#endif /* ENABLE_SFNT */ ++ if(( fm->name_ps = strdup(fm->name_full) )==NULL) { ++ fprintf (stderr, "****malloc failed %s line %d\n", __FILE__, __LINE__); ++ exit(255); ++ } ++#ifdef ENABLE_SFNT ++ } else ++ fm->name_ps = dupcnstring(sn.string, sn.string_len); ++#endif /* ENABLE_SFNT */ ++ ++#endif /* XP_PSTEXT */ ++ ++ for(i=0; fm->name_ps[i]!=0; i++) ++ if(fm->name_ps[i] == ' ') ++ fm->name_ps[i] = '_'; /* no spaces in the Postscript name *m */ ++ ++ /* guess the boldness from the font names */ ++ fm->force_bold=0; ++ ++ fieldstocheck[0] = fm->name_style; ++ fieldstocheck[1] = fm->name_full; ++ fieldstocheck[2] = fm->name_ps; ++ ++ for(i=0; !fm->force_bold && iforce_bold=1; ++ break; ++ } ++ } ++ } ++} ++ ++/* ++ * Functions to decompose the outlines ++ */ ++ ++static GLYPH *curg; ++static double lastx, lasty; ++ ++static int ++outl_moveto( ++ FT_Vector *to, ++ void *unused ++) ++{ ++ double tox, toy; ++ ++ tox = fscale((double)to->x); toy = fscale((double)to->y); ++ ++ /* FreeType does not do explicit closepath() */ ++ if(curg->lastentry) { ++ g_closepath(curg); ++ } ++ fg_rmoveto(curg, tox, toy); ++ lastx = tox; lasty = toy; ++ ++ return 0; ++} ++ ++static int ++outl_lineto( ++ FT_Vector *to, ++ void *unused ++) ++{ ++ double tox, toy; ++ ++ tox = fscale((double)to->x); toy = fscale((double)to->y); ++ ++ fg_rlineto(curg, tox, toy); ++ lastx = tox; lasty = toy; ++ ++ return 0; ++} ++ ++static int ++outl_conicto( ++ FT_Vector *control1, ++ FT_Vector *to, ++ void *unused ++) ++{ ++ double c1x, c1y, tox, toy; ++ ++ c1x = fscale((double)control1->x); c1y = fscale((double)control1->y); ++ tox = fscale((double)to->x); toy = fscale((double)to->y); ++ ++ fg_rrcurveto(curg, ++ (lastx + 2.0 * c1x) / 3.0, (lasty + 2.0 * c1y) / 3.0, ++ (2.0 * c1x + tox) / 3.0, (2.0 * c1y + toy) / 3.0, ++ tox, toy ); ++ lastx = tox; lasty = toy; ++ ++ return 0; ++} ++ ++static int ++outl_cubicto( ++ FT_Vector *control1, ++ FT_Vector *control2, ++ FT_Vector *to, ++ void *unused ++) ++{ ++ double c1x, c1y, c2x, c2y, tox, toy; ++ ++ c1x = fscale((double)control1->x); c1y = fscale((double)control1->y); ++ c2x = fscale((double)control2->x); c2y = fscale((double)control2->y); ++ tox = fscale((double)to->x); toy = fscale((double)to->y); ++ ++ fg_rrcurveto(curg, c1x, c1y, c2x, c2y, tox, toy); ++ lastx = tox; lasty = toy; ++ ++ return 0; ++} ++ ++static FT_Outline_Funcs ft_outl_funcs = { ++ outl_moveto, ++ outl_lineto, ++ outl_conicto, ++ outl_cubicto, ++ 0, ++ 0 ++}; ++ ++/* ++ * Get the path of contrours for a glyph. ++ */ ++ ++static void ++glpath( ++ int glyphno, ++ GLYPH *glyf_list ++) ++{ ++ FT_Outline *ol; ++ ++ curg = &glyf_list[glyphno]; ++ ++ if( FT_Load_Glyph(face, glyphno, FT_LOAD_NO_BITMAP|FT_LOAD_NO_SCALE|FT_LOAD_NO_HINTING) ++ || face->glyph->format != ft_glyph_format_outline ) { ++ fprintf(stderr, "Can't load glyph %s, skipped\n", curg->name); ++ return; ++ } ++ ++ ol = &face->glyph->outline; ++ lastx = 0.0; lasty = 0.0; ++ ++ if( FT_Outline_Decompose(ol, &ft_outl_funcs, NULL) ) { ++ fprintf(stderr, "Can't decompose outline of glyph %s, skipped\n", curg->name); ++ return; ++ } ++ ++ /* FreeType does not do explicit closepath() */ ++ if(curg->lastentry) { ++ g_closepath(curg); ++ } ++ ++ if(ol->flags & ft_outline_reverse_fill) { ++ assertpath(curg->entries, __FILE__, __LINE__, curg->name); ++ reversepaths(curg); ++ } ++} ++ ++/* ++ * Get the kerning data. ++ */ ++ ++static void ++kerning( ++ GLYPH *glyph_list ++) ++{ ++ int i, j, n; ++ int nglyphs = face->num_glyphs; ++ FT_Vector k; ++ GLYPH *gl; ++ ++ if( nglyphs == 0 || !FT_HAS_KERNING(face) ) { ++ WARNING_1 fputs("No Kerning data\n", stderr); ++ return; ++ } ++ ++ for(i=0; i= 1) ++#define WARNING_2 if(warnlevel >= 2) ++#define WARNING_3 if(warnlevel >= 3) ++#define WARNING_4 if(warnlevel >= 4) ++ ++/* ++ * Bitmap control macros ++ */ ++ ++#define BITMAP_BYTES(size) (((size)+7)>>3) ++#define DEF_BITMAP(name, size) unsigned char name[BITMAP_BYTES(size)] ++#define SET_BITMAP(name, bit) ( name[(bit)>>3] |= (1<<((bit)&7)) ) ++#define CLR_BITMAP(name, bit) ( name[(bit)>>3] &= ~(1<<((bit)&7)) ) ++#define IS_BITMAP(name, bit) ( name[(bit)>>3] & (1<<((bit)&7)) ) ++ ++/* debugging */ ++ ++/* debug flags */ ++#define DEBUG_UNICODE 0x00000001 /* unicode to 8-bit code conversion */ ++#define DEBUG_MAINSTEMS 0x00000002 /* glyph-wide main stem generation */ ++#define DEBUG_SUBSTEMS 0x00000004 /* substituted stem generation */ ++#define DEBUG_STEMS (DEBUG_MAINSTEMS|DEBUG_SUBSTEMS) ++#define DEBUG_REVERSAL 0x00000008 /* reversal of the paths */ ++#define DEBUG_FIXCVDIR 0x00000010 /* fixcvdir() */ ++#define DEBUG_STEMOVERLAP 0x00000020 /* stemoverlap() */ ++#define DEBUG_BLUESTEMS 0x00000040 /* markbluestems() */ ++#define DEBUG_STRAIGHTEN 0x00000080 /* markbluestems() */ ++#define DEBUG_EXTMAP 0x00000100 /* parsing of external map */ ++#define DEBUG_TOINT 0x00000200 /* conversion of path to integer */ ++#define DEBUG_BUILDG 0x00000400 /* building of glyph path */ ++#define DEBUG_QUAD 0x00000800 /* splitting curves by quadrants */ ++#define DEBUG_SQEQ 0x00001000 /* square equation solver */ ++#define DEBUG_COMPOSITE 0x00002000 /* handling of composite glyphs */ ++#define DEBUG_FCONCISE 0x00004000 /* normalization of curves */ ++#define DEBUG_FT 0x00008000 /* FreeType front-end */ ++#define DEBUG_BITMAP 0x00010000 /* conversion from bitmap */ ++#define DEBUG_DISABLED 0x80000000 /* special flag: temporary disable debugging */ ++ ++#if 0 ++/* at what we want to look now */ ++#ifndef DEBUG ++# define DEBUG (DEBUG_BITMAP) ++#endif ++ ++/* uncomment the next line if debugging data is wanted for one glyph only */ ++#define DBG_GLYPH "C118" /* */ ++#endif ++ ++#if 1 ++# define ISDBG(name) (0) ++# define ENABLEDBG(condition) (0) ++# define DISABLEDBG(condition) (0) ++#else ++ extern int debug; /* collection of the flags */ ++/* this ISDBG will only work on ANSI C, not K&R */ ++# define ISDBG(name) ( (debug & DEBUG_DISABLED) ? 0 : (debug & (DEBUG_##name)) ) ++# define ENABLEDBG(condition) ( (condition) ? (debug&=~DEBUG_DISABLED) : 0 ) ++# define DISABLEDBG(condition) ( (condition) ? (debug|=DEBUG_DISABLED) : 0 ) ++#endif ++ ++#ifdef DBG_GLYPH ++# define DBG_TO_GLYPH(g) DISABLEDBG( strcmp( (g)->name, DBG_GLYPH ) ) ++# define DBG_FROM_GLYPH(g) ENABLEDBG(1) ++#else ++# define DBG_TO_GLYPH(g) (0) ++# define DBG_FROM_GLYPH(g) (0) ++#endif ++ ++/* prototypes */ ++int iscale( int val); ++double fscale( double val); ++int unicode_rev_lookup( int unival); ++void bmp_outline( GLYPH *g, int scale, char *bmap, ++ int xsz, int ysz, int xoff, int yoff); ++int isign( int x); ++int fsign( double x); ++ ++/* global metrics for a font */ ++ ++struct font_metrics { ++ /* post */ ++ double italic_angle; ++ short underline_position; ++ short underline_thickness; ++ short is_fixed_pitch; ++ ++ /* hhea */ ++ short ascender; ++ short descender; ++ ++ /* head */ ++ unsigned short units_per_em; ++ short bbox[4]; ++ ++ /* name */ ++ char *name_copyright; ++ char *name_family; ++ char *name_style; ++ char *name_full; ++ char *name_version; ++ char *name_ps; ++ ++ /* other */ ++ int force_bold; ++}; ++ ++/* size of the encoding table - glyphs beyond 255 are actually unnumbered */ ++ ++#define ENCTABSZ 1024 ++ ++/* switch table structure for front-ends */ ++ ++#define MAXSUFFIX 10 ++ ++struct frontsw { ++ char *name; /* name of the front end */ ++ char *descr; /* description of the front end */ ++ char *suffix[MAXSUFFIX]; /* possible file name suffixes */ ++ ++ void (*open)(char *fname, char *arg); /* open font file */ ++ void (*close)(void); /* close font file */ ++ int (*nglyphs)(void); /* get the number of glyphs */ ++ int (*glnames)(GLYPH *glyphs); /* get the names of glyphs */ ++ void (*glmetrics)(GLYPH *glyphs); /* get the metrics of glyphs */ ++ int (*glenc)(GLYPH *glyphs, int *enc, int *unimap); /* get the encoding */ ++ void (*fnmetrics)(struct font_metrics *fm); /* get the font metrics */ ++ void (*glpath)(int glyphno, GLYPH *glyphs); /* get the glyph path */ ++ void (*kerning)(GLYPH *glyph_list); /* extract the kerning data */ ++}; +diff -ruN xserver-old/hw/xprint/extras/ttf2pt1/Makefile xserver/hw/xprint/extras/ttf2pt1/Makefile +--- xserver-old/hw/xprint/extras/ttf2pt1/Makefile 1970-01-01 10:00:00.000000000 +1000 ++++ xserver/hw/xprint/extras/ttf2pt1/Makefile 2006-06-27 13:10:26.000000000 +1000 +@@ -0,0 +1,279 @@ ++ ++# This file should be configured before running `make'. ++# Uncomment or change the values that are relevant for your OS. ++ ++# The preferred C compiler (by default use the OS-specific default value). ++# For BSD/OS, FreeBSD, Linux (all flavors), NetBSD, OpenBSD the default ++# compiler is GNU C. ++# (Note please the politically correct ordering by alphabet ! :-) ++# ++# Use GNU C even if it's not the default compiler ++# ++#CC=gcc ++# ++# Use the standard ANSI C compiler on HP-UX even if it's not default ++# ++#CC=c89 ++ ++# ++# The system-dependent flags for the C compiler ++# ++# Default ++ ++CFLAGS_SYS= -O ++ ++# For GNU C ++# ++#CFLAGS_SYS= -O2 ++# ++# For GNU C with long options support library (Linux etc.) ++# ++#CFLAGS_SYS= -O2 -D_GNU_SOURCE ++# ++# For GNU C on HP-UX/PA-RISC 1.1 ++# ++#CFLAGS_SYS= -O2 -Wa,-w ++# ++# For the standard ANSI C on HP-UX ++# ++#CFLAGS_SYS= +O2 -D_HPUX_SOURCE ++ ++# ++# The system-dependent libraries ++# ++# Defalut (for the BSD-style OSes) ++ ++LIBS_SYS= -lm ++ ++# For SystemV (such as SCO, UnixWare, Solaris, but _NOT_ Linux or HP-UX) ++# ++#LIBS_SYS= -lm -lsocket ++ ++# ++# The flags for C compiler for the FreeType-2 library (disabled by default). ++# This WON'T BUILD with FT2-beta8, use the FreeType release 2.0.4 ++# http://download.sourceforge.net/freetype/freetype-2.0.4.tar.gz ++ ++CFLAGS_FT= ++ ++# To enable use of the FreeType-2 library ++# (if the include and lib directory do not match your installation, ++# modify them), also uncomment LIBS_FT ++# ++#CFLAGS_FT = -DUSE_FREETYPE -I/usr/local/include/freetype2 -I/usr/local/include ++ ++# ++# The FreeType-2 library flags (disabled by default) ++ ++LIBS_FT= ++ ++# To enable use of the FreeType-2 library ++# (if the include and lib directory do not match your installation, ++# modify them), also uncomment CFLAGS_FT ++# ++#LIBS_FT= -L/usr/local/lib -lfreetype ++ ++# ++# The flags for C compiler for the Autotrace library (disabled by default). ++# USE OF THIS FEATURE IS STRONGLY DISCOURAGED, THE BUILT-IN TRACING ++# (AKA VECTORIZATION) PROVIDES MUCH BETTER RESULTS. ++# The tested version is 0.29a (and the fonts produced with it are ++# absolutely not usable). ++# http://download.sourceforge.net/autotrace/autotrace-0.29.tar.gz ++ ++CFLAGS_AT= ++ ++# To enable use of the Autotrace library ++# (if the include and lib directory do not match your installation, ++# modify them), also uncomment LIBS_AT ++# ++#CFLAGS_AT = -DUSE_AUTOTRACE -I/usr/local/include ++ ++# ++# The Autotrace library flags (disabled by default) ++ ++LIBS_AT= ++ ++# To enable use of the Autotrace library ++# (if the include and lib directory do not match your installation, ++# modify them), also uncomment CFLAGS_AT ++# ++#LIBS_AT= -L/usr/local/lib -lautotrace ++ ++# ++# Preference of front-ends if multiple parsers match a file ++# (by default the build-in front-end takes preference over FreeType) ++ ++CFLAGS_PREF= ++ ++# To prefer FreeType (if enabled): ++# ++#CFLAGS_PREF= -DPREFER_FREETYPE ++ ++# Uncomment the second line to not compile t1asm into ttf2pt1 ++CFLAGS_EXTT1ASM= ++#CFLAGS_EXTT1ASM= -DEXTERNAL_T1ASM ++ ++CFLAGS= $(CFLAGS_SYS) $(CFLAGS_FT) $(CFLAGS_AT) $(CFLAGS_PREF) ++LIBS= $(LIBS_SYS) $(LIBS_FT) $(LIBS_AT) ++ ++# Installation-related stuff ++# ++# The base dir for installation and subdirs in it ++INSTDIR = /usr/local ++# for binaries ++BINDIR = $(INSTDIR)/bin ++# for binaries of little general interest ++LIBXDIR = $(INSTDIR)/libexec/ttf2pt1 ++# for scripts, maps/encodings etc. ++SHAREDIR = $(INSTDIR)/share/ttf2pt1 ++MANDIR = $(INSTDIR)/man ++ ++# owner and group of installed files ++OWNER = root ++GROUP = bin ++ ++# After you have configured the Makefile, comment out the following ++# definition: ++warning: docs ++ @echo >&2 ++ @echo " You have to configure the Makefile before running make!" >&2 ++ @echo "(or if you are lazy and hope that it will work as is run \`make all')">&2 ++ @echo >&2 ++ ++DOCS=CHANGES README FONTS FONTS.hpux encodings/README other/README \ ++ app/X11/README app/netscape/README app/TeX/README ++ ++SUBDIRS = app encodings maps scripts other ++TXTFILES = README* FONTS* CHANGES* COPYRIGHT ++ ++MANS1=ttf2pt1.1 ttf2pt1_convert.1 ttf2pt1_x2gs.1 ++MANS=$(MANS1) $(MANS5) ++ ++all: t1asm ttf2pt1 docs mans rpm ++ ++docs: $(DOCS) ++ ++mans: $(MANS) ++ ++clean: ++ rm -f t1asm ttf2pt1 *.o app/RPM/Makefile app/RPM/*.spec *.core core.* core ++ ( cd other && make clean; ) ++ ( cd app/netscape && make clean; ) ++ ++veryclean: clean ++ rm -f $(DOCS) $(MANS) ++ ++rpm: app/RPM/Makefile app/RPM/ttf2pt1.spec ++ ++ttf2pt1.1: README.html ++ scripts/html2man . . app/RPM/Makefile ++ ++app/RPM/ttf2pt1.spec: app/RPM/ttf2pt1.spec.src version.h ++ sed 's/^Version:.*/Version: '`grep TTF2PT1_VERSION version.h| cut -d\" -f2`'/' $@ ++ ++t1asm: t1asm.c ++ $(CC) $(CFLAGS) -o t1asm -DSTANDALONE t1asm.c $(LIBS) ++ ++ttf2pt1.o: ttf2pt1.c ttf.h pt1.h global.h version.h ++ $(CC) $(CFLAGS) -c ttf2pt1.c ++ ++pt1.o: pt1.c ttf.h pt1.h global.h ++ $(CC) $(CFLAGS) -c pt1.c ++ ++ttf.o: ttf.c ttf.h pt1.h global.h ++ $(CC) $(CFLAGS) -c ttf.c ++ ++ft.o: ft.c pt1.h global.h ++ $(CC) $(CFLAGS) -c ft.c ++ ++bdf.o: bdf.c pt1.h global.h ++ $(CC) $(CFLAGS) -c bdf.c ++ ++bitmap.o: bitmap.c pt1.h global.h ++ $(CC) $(CFLAGS) -c bitmap.c ++ ++runt1asm.o: runt1asm.c global.h ++ $(CC) $(CFLAGS) $(CFLAGS_EXTT1ASM) -c runt1asm.c ++ ++ttf2pt1: ttf2pt1.o pt1.o runt1asm.o ttf.o ft.o bdf.o bitmap.o ++ $(CC) $(CFLAGS) -o ttf2pt1 ttf2pt1.o pt1.o runt1asm.o ttf.o ft.o bdf.o bitmap.o $(LIBS) ++ ++CHANGES: CHANGES.html ++ scripts/unhtml CHANGES ++ ++README: README.html ++ scripts/unhtml README ++ ++encodings/README: encodings/README.html ++ scripts/unhtml encodings/README ++ ++other/README: other/README.html ++ scripts/unhtml other/README ++ ++app/X11/README: app/X11/README.html ++ scripts/unhtml app/X11/README ++ ++app/netscape/README: app/netscape/README.html ++ scripts/unhtml app/netscape/README ++ ++app/TeX/README: app/TeX/README.html ++ scripts/unhtml app/TeX/README ++ ++FONTS: FONTS.html ++ scripts/unhtml FONTS ++ ++FONTS.hpux: FONTS.hpux.html ++ scripts/unhtml FONTS.hpux ++ ++install: all ++ scripts/inst_dir $(BINDIR) $(OWNER) $(GROUP) 0755 ++ scripts/inst_dir $(LIBXDIR) $(OWNER) $(GROUP) 0755 ++ scripts/inst_dir $(SHAREDIR) $(OWNER) $(GROUP) 0755 ++ scripts/inst_dir $(MANDIR)/man1 $(OWNER) $(GROUP) 0755 ++ scripts/inst_dir $(MANDIR)/man5 $(OWNER) $(GROUP) 0755 ++ cp -R $(TXTFILES) $(SUBDIRS) $(SHAREDIR) ++ chown -R $(OWNER) $(SHAREDIR) ++ chgrp -R $(GROUP) $(SHAREDIR) ++ chmod -R go-w $(SHAREDIR) ++ scripts/inst_file ttf2pt1 $(BINDIR)/ttf2pt1 $(OWNER) $(GROUP) 0755 ++ [ -f $(BINDIR)/t1asm ] || scripts/inst_file t1asm $(LIBXDIR)/t1asm $(OWNER) $(GROUP) 0755 ++ sed 's|^TTF2PT1_BINDIR=$$|TTF2PT1_BINDIR=$(BINDIR)|;\ ++ s|^TTF2PT1_LIBXDIR=$$|TTF2PT1_LIBXDIR=$(LIBXDIR)|;\ ++ s|^TTF2PT1_SHAREDIR=$$|TTF2PT1_SHAREDIR=$(SHAREDIR)|;' cvt.tmp ++ scripts/inst_file cvt.tmp $(BINDIR)/ttf2pt1_convert $(OWNER) $(GROUP) 0755 ++ scripts/inst_file cvt.tmp $(SHAREDIR)/scripts/convert $(OWNER) $(GROUP) 0755 ++ rm cvt.tmp ++ scripts/inst_file scripts/x2gs $(BINDIR)/ttf2pt1_x2gs $(OWNER) $(GROUP) 0755 ++ for i in $(MANS1); do { \ ++ sed 's|TTF2PT1_BINDIR|$(BINDIR)|;\ ++ s|TTF2PT1_LIBXDIR|$(LIBXDIR)|;\ ++ s|TTF2PT1_SHAREDIR|$(SHAREDIR)|;' <$$i >$(MANDIR)/man1/$$i \ ++ && chown $(OWNER) $(MANDIR)/man1/$$i \ ++ && chgrp $(GROUP) $(MANDIR)/man1/$$i \ ++ && chmod 0644 $(MANDIR)/man1/$$i \ ++ || exit 1; \ ++ } done ++ ++uninstall: ++ rm -f $(BINDIR)/ttf2pt1 $(BINDIR)/ttf2pt1_convert $(BINDIR)/ttf2pt1_x2gs ++ rm -rf $(LIBXDIR) ++ rm -rf $(SHAREDIR) ++ for i in $(MANS1); do { \ ++ rm -f $(MANDIR)/man1/$$i $(MANDIR)/man1/$$i.gz; \ ++ } done ++ ++ ++# targets for automatic generation of releases and snapshots ++ ++snapshot: ++ scripts/mkrel snapshot ++ ++release: ++ scripts/mkrel release +diff -ruN xserver-old/hw/xprint/extras/ttf2pt1/pt1.c xserver/hw/xprint/extras/ttf2pt1/pt1.c +--- xserver-old/hw/xprint/extras/ttf2pt1/pt1.c 1970-01-01 10:00:00.000000000 +1000 ++++ xserver/hw/xprint/extras/ttf2pt1/pt1.c 2006-06-27 13:10:26.000000000 +1000 +@@ -0,0 +1,7374 @@ ++/* ++ * see COPYRIGHT ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#ifndef WINDOWS ++# include ++# include ++#else ++# include "windows.h" ++#endif ++ ++#include "ttf.h" ++#include "pt1.h" ++#include "global.h" ++ ++/* big and small values for comparisons */ ++#define FBIGVAL (1e20) ++#define FEPS (100000./FBIGVAL) ++ ++/* names of the axes */ ++#define X 0 ++#define Y 1 ++ ++/* the GENTRY extension structure used in fforceconcise() */ ++ ++struct gex_con { ++ double d[2 /*X, Y*/]; /* sizes of curve */ ++ double sin2; /* squared sinus of the angle to the next gentry */ ++ double len2; /* squared distance between the endpoints */ ++ ++/* number of reference dots taken from each curve */ ++#define NREFDOTS 3 ++ ++ double dots[NREFDOTS][2]; /* reference dots */ ++ ++ int flags; /* flags for gentry and tits joint to the next gentry */ ++/* a vertical or horizontal line may be in 2 quadrants at once */ ++#define GEXF_QUL 0x00000001 /* in up-left quadrant */ ++#define GEXF_QUR 0x00000002 /* in up-right quadrant */ ++#define GEXF_QDR 0x00000004 /* in down-right quadrant */ ++#define GEXF_QDL 0x00000008 /* in down-left quadrant */ ++#define GEXF_QMASK 0x0000000F /* quadrant mask */ ++ ++/* if a line is nearly vertical or horizontal, we remember that idealized quartant too */ ++#define GEXF_QTO_IDEAL(f) (((f)&0xF)<<4) ++#define GEXF_QFROM_IDEAL(f) (((f)&0xF0)>>4) ++#define GEXF_IDQ_L 0x00000090 /* left */ ++#define GEXF_IDQ_R 0x00000060 /* right */ ++#define GEXF_IDQ_U 0x00000030 /* up */ ++#define GEXF_IDQ_D 0x000000C0 /* down */ ++ ++/* possibly can be joined with conditions: ++ * (in order of increasing preference, the numeric order is important) ++ */ ++#define GEXF_JLINE 0x00000100 /* into one line */ ++#define GEXF_JIGN 0x00000200 /* if one entry's tangent angle is ignored */ ++#define GEXF_JID 0x00000400 /* if one entry is idealized to hor/vert */ ++#define GEXF_JFLAT 0x00000800 /* if one entry is flattened */ ++#define GEXF_JGOOD 0x00001000 /* perfectly, no additional maodifications */ ++ ++#define GEXF_JMASK 0x00001F00 /* the mask of all above */ ++#define GEXF_JCVMASK 0x00001E00 /* the mask of all above except JLINE */ ++ ++/* which entry needs to be modified for conditional joining */ ++#define GEXF_JIGN1 0x00002000 ++#define GEXF_JIGN2 0x00004000 ++#define GEXF_JIGNDIR(dir) (GEXF_JIGN1<<(dir)) ++#define GEXF_JID1 0x00008000 ++#define GEXF_JID2 0x00010000 ++#define GEXF_JIDDIR(dir) (GEXF_JID1<<(dir)) ++#define GEXF_JFLAT1 0x00020000 ++#define GEXF_JFLAT2 0x00040000 ++#define GEXF_JFLATDIR(dir) (GEXF_JFLAT1<<(dir)) ++ ++#define GEXF_VERT 0x00100000 /* is nearly vertical */ ++#define GEXF_HOR 0x00200000 /* is nearly horizontal */ ++#define GEXF_FLAT 0x00400000 /* is nearly flat */ ++ ++#define GEXF_VDOTS 0x01000000 /* the dots are valid */ ++ ++ signed char isd[2 /*X,Y*/]; /* signs of the sizes */ ++}; ++typedef struct gex_con GEX_CON; ++ ++/* convenience macros */ ++#define X_CON(ge) ((GEX_CON *)((ge)->ext)) ++#define X_CON_D(ge) (X_CON(ge)->d) ++#define X_CON_DX(ge) (X_CON(ge)->d[0]) ++#define X_CON_DY(ge) (X_CON(ge)->d[1]) ++#define X_CON_ISD(ge) (X_CON(ge)->isd) ++#define X_CON_ISDX(ge) (X_CON(ge)->isd[0]) ++#define X_CON_ISDY(ge) (X_CON(ge)->isd[1]) ++#define X_CON_SIN2(ge) (X_CON(ge)->sin2) ++#define X_CON_LEN2(ge) (X_CON(ge)->len2) ++#define X_CON_F(ge) (X_CON(ge)->flags) ++ ++/* performance statistics about guessing the concise curves */ ++static int ggoodcv=0, ggoodcvdots=0, gbadcv=0, gbadcvdots=0; ++ ++int stdhw, stdvw; /* dominant stems widths */ ++int stemsnaph[12], stemsnapv[12]; /* most typical stem width */ ++ ++int bluevalues[14]; ++int nblues; ++int otherblues[10]; ++int notherb; ++int bbox[4]; /* the FontBBox array */ ++double italic_angle; ++ ++GLYPH *glyph_list; ++int encoding[ENCTABSZ]; /* inverse of glyph[].char_no */ ++int kerning_pairs = 0; ++ ++/* prototypes */ ++static void fixcvdir( GENTRY * ge, int dir); ++static void fixcvends( GENTRY * ge); ++static int fgetcvdir( GENTRY * ge); ++static int igetcvdir( GENTRY * ge); ++static int fiszigzag( GENTRY *ge); ++static int iiszigzag( GENTRY *ge); ++static GENTRY * freethisge( GENTRY *ge); ++static void addgeafter( GENTRY *oge, GENTRY *nge ); ++static GENTRY * newgentry( int flags); ++static void debugstems( char *name, STEM * hstems, int nhs, STEM * vstems, int nvs); ++static int addbluestems( STEM *s, int n); ++static void sortstems( STEM * s, int n); ++static int stemoverlap( STEM * s1, STEM * s2); ++static int steminblue( STEM *s); ++static void markbluestems( STEM *s, int nold); ++static int joinmainstems( STEM * s, int nold, int useblues); ++static void joinsubstems( STEM * s, short *pairs, int nold, int useblues); ++static void fixendpath( GENTRY *ge); ++static void fdelsmall( GLYPH *g, double minlen); ++static void alloc_gex_con( GENTRY *ge); ++static double fjointsin2( GENTRY *ge1, GENTRY *ge2); ++#if 0 ++static double fcvarea( GENTRY *ge); ++#endif ++static double fcvval( GENTRY *ge, int axis, double t); ++static void fsampledots( GENTRY *ge, double dots[][2], int ndots); ++static void fnormalizege( GENTRY *ge); ++static void fanalyzege( GENTRY *ge); ++static void fanalyzejoint( GENTRY *ge); ++static void fconcisecontour( GLYPH *g, GENTRY *ge); ++static double fclosegap( GENTRY *from, GENTRY *to, int axis, ++ double gap, double *ret); ++ ++int ++isign( ++ int x ++) ++{ ++ if (x > 0) ++ return 1; ++ else if (x < 0) ++ return -1; ++ else ++ return 0; ++} ++ ++int ++fsign( ++ double x ++) ++{ ++ if (x > 0.0) ++ return 1; ++ else if (x < 0.0) ++ return -1; ++ else ++ return 0; ++} ++ ++static GENTRY * ++newgentry( ++ int flags ++) ++{ ++ GENTRY *ge; ++ ++ ge = calloc(1, sizeof(GENTRY)); ++ ++ if (ge == 0) { ++ fprintf(stderr, "***** Memory allocation error *****\n"); ++ exit(255); ++ } ++ ge->stemid = -1; ++ ge->flags = flags; ++ /* the rest is set to 0 by calloc() */ ++ return ge; ++} ++ ++/* ++ * Routines to print out Postscript functions with optimization ++ */ ++ ++void ++rmoveto( ++ int dx, ++ int dy ++) ++{ ++ if (optimize && dx == 0) ++ fprintf(pfa_file, "%d vmoveto\n", dy); ++ else if (optimize && dy == 0) ++ fprintf(pfa_file, "%d hmoveto\n", dx); ++ else ++ fprintf(pfa_file, "%d %d rmoveto\n", dx, dy); ++} ++ ++void ++rlineto( ++ int dx, ++ int dy ++) ++{ ++ if (optimize && dx == 0 && dy == 0) /* for special pathologic ++ * case */ ++ return; ++ else if (optimize && dx == 0) ++ fprintf(pfa_file, "%d vlineto\n", dy); ++ else if (optimize && dy == 0) ++ fprintf(pfa_file, "%d hlineto\n", dx); ++ else ++ fprintf(pfa_file, "%d %d rlineto\n", dx, dy); ++} ++ ++void ++rrcurveto( ++ int dx1, ++ int dy1, ++ int dx2, ++ int dy2, ++ int dx3, ++ int dy3 ++) ++{ ++ /* first two ifs are for crazy cases that occur surprisingly often */ ++ if (optimize && dx1 == 0 && dx2 == 0 && dx3 == 0) ++ rlineto(0, dy1 + dy2 + dy3); ++ else if (optimize && dy1 == 0 && dy2 == 0 && dy3 == 0) ++ rlineto(dx1 + dx2 + dx3, 0); ++ else if (optimize && dy1 == 0 && dx3 == 0) ++ fprintf(pfa_file, "%d %d %d %d hvcurveto\n", ++ dx1, dx2, dy2, dy3); ++ else if (optimize && dx1 == 0 && dy3 == 0) ++ fprintf(pfa_file, "%d %d %d %d vhcurveto\n", ++ dy1, dx2, dy2, dx3); ++ else ++ fprintf(pfa_file, "%d %d %d %d %d %d rrcurveto\n", ++ dx1, dy1, dx2, dy2, dx3, dy3); ++} ++ ++void ++closepath(void) ++{ ++ fprintf(pfa_file, "closepath\n"); ++} ++ ++/* ++ * Many of the path processing routines exist (or will exist) in ++ * both floating-point and integer version. Fimally most of the ++ * processing will go in floating point and the integer processing ++ * will become legacy. ++ * The names of floating routines start with f, names of integer ++ * routines start with i, and those old routines existing in one ++ * version only have no such prefix at all. ++ */ ++ ++/* ++** Routine that checks integrity of the path, for debugging ++*/ ++ ++void ++assertpath( ++ GENTRY * from, ++ char *file, ++ int line, ++ char *name ++) ++{ ++ GENTRY *first, *pe, *ge; ++ int isfloat; ++ ++ if(from==0) ++ return; ++ isfloat = (from->flags & GEF_FLOAT); ++ pe = from->prev; ++ for (ge = from; ge != 0; pe = ge, ge = ge->next) { ++ if( (ge->flags & GEF_FLOAT) ^ isfloat ) { ++ fprintf(stderr, "**! assertpath: called from %s line %d (%s) ****\n", file, line, name); ++ fprintf(stderr, "float flag changes from %s to %s at 0x%p (type %c, prev type %c)\n", ++ (isfloat ? "TRUE" : "FALSE"), (isfloat ? "FALSE" : "TRUE"), ge, ge->type, pe->type); ++ abort(); ++ } ++ if (pe != ge->prev) { ++ fprintf(stderr, "**! assertpath: called from %s line %d (%s) ****\n", file, line, name); ++ fprintf(stderr, "unidirectional chain 0x%x -next-> 0x%x -prev-> 0x%x \n", ++ pe, ge, ge->prev); ++ abort(); ++ } ++ ++ switch(ge->type) { ++ case GE_MOVE: ++ break; ++ case GE_PATH: ++ if (ge->prev == 0) { ++ fprintf(stderr, "**! assertpath: called from %s line %d (%s) ****\n", file, line, name); ++ fprintf(stderr, "empty path at 0x%x \n", ge); ++ abort(); ++ } ++ break; ++ case GE_LINE: ++ case GE_CURVE: ++ if(ge->frwd->bkwd != ge) { ++ fprintf(stderr, "**! assertpath: called from %s line %d (%s) ****\n", file, line, name); ++ fprintf(stderr, "unidirectional chain 0x%x -frwd-> 0x%x -bkwd-> 0x%x \n", ++ ge, ge->frwd, ge->frwd->bkwd); ++ abort(); ++ } ++ if(ge->prev->type == GE_MOVE) { ++ first = ge; ++ if(ge->bkwd->next->type != GE_PATH) { ++ fprintf(stderr, "**! assertpath: called from %s line %d (%s) ****\n", file, line, name); ++ fprintf(stderr, "broken first backlink 0x%x -bkwd-> 0x%x -next-> 0x%x \n", ++ ge, ge->bkwd, ge->bkwd->next); ++ abort(); ++ } ++ } ++ if(ge->next->type == GE_PATH) { ++ if(ge->frwd != first) { ++ fprintf(stderr, "**! assertpath: called from %s line %d (%s) ****\n", file, line, name); ++ fprintf(stderr, "broken loop 0x%x -...-> 0x%x -frwd-> 0x%x \n", ++ first, ge, ge->frwd); ++ abort(); ++ } ++ } ++ break; ++ } ++ ++ } ++} ++ ++void ++assertisfloat( ++ GLYPH *g, ++ char *msg ++) ++{ ++ if( !(g->flags & GF_FLOAT) ) { ++ fprintf(stderr, "**! Glyph %s is not float: %s\n", g->name, msg); ++ abort(); ++ } ++ if(g->lastentry) { ++ if( !(g->lastentry->flags & GEF_FLOAT) ) { ++ fprintf(stderr, "**! Glyphs %s last entry is int: %s\n", g->name, msg); ++ abort(); ++ } ++ } ++} ++ ++void ++assertisint( ++ GLYPH *g, ++ char *msg ++) ++{ ++ if( (g->flags & GF_FLOAT) ) { ++ fprintf(stderr, "**! Glyph %s is not int: %s\n", g->name, msg); ++ abort(); ++ } ++ if(g->lastentry) { ++ if( (g->lastentry->flags & GEF_FLOAT) ) { ++ fprintf(stderr, "**! Glyphs %s last entry is float: %s\n", g->name, msg); ++ abort(); ++ } ++ } ++} ++ ++ ++/* ++ * Routines to save the generated data about glyph ++ */ ++ ++void ++fg_rmoveto( ++ GLYPH * g, ++ double x, ++ double y) ++{ ++ GENTRY *oge; ++ ++ if (ISDBG(BUILDG)) ++ fprintf(stderr, "%s: f rmoveto(%g, %g)\n", g->name, x, y); ++ ++ assertisfloat(g, "adding float MOVE"); ++ ++ if ((oge = g->lastentry) != 0) { ++ if (oge->type == GE_MOVE) { /* just eat up the first move */ ++ oge->fx3 = x; ++ oge->fy3 = y; ++ } else if (oge->type == GE_LINE || oge->type == GE_CURVE) { ++ fprintf(stderr, "Glyph %s: MOVE in middle of path\n", g->name); ++ } else { ++ GENTRY *nge; ++ ++ nge = newgentry(GEF_FLOAT); ++ nge->type = GE_MOVE; ++ nge->fx3 = x; ++ nge->fy3 = y; ++ ++ oge->next = nge; ++ nge->prev = oge; ++ g->lastentry = nge; ++ } ++ } else { ++ GENTRY *nge; ++ ++ nge = newgentry(GEF_FLOAT); ++ nge->type = GE_MOVE; ++ nge->fx3 = x; ++ nge->fy3 = y; ++ nge->bkwd = (GENTRY*)&g->entries; ++ g->entries = g->lastentry = nge; ++ } ++ ++ if (0 && ISDBG(BUILDG)) ++ dumppaths(g, NULL, NULL); ++} ++ ++void ++ig_rmoveto( ++ GLYPH * g, ++ int x, ++ int y) ++{ ++ GENTRY *oge; ++ ++ if (ISDBG(BUILDG)) ++ fprintf(stderr, "%s: i rmoveto(%d, %d)\n", g->name, x, y); ++ ++ assertisint(g, "adding int MOVE"); ++ ++ if ((oge = g->lastentry) != 0) { ++ if (oge->type == GE_MOVE) { /* just eat up the first move */ ++ oge->ix3 = x; ++ oge->iy3 = y; ++ } else if (oge->type == GE_LINE || oge->type == GE_CURVE) { ++ fprintf(stderr, "Glyph %s: MOVE in middle of path, ignored\n", g->name); ++ } else { ++ GENTRY *nge; ++ ++ nge = newgentry(0); ++ nge->type = GE_MOVE; ++ nge->ix3 = x; ++ nge->iy3 = y; ++ ++ oge->next = nge; ++ nge->prev = oge; ++ g->lastentry = nge; ++ } ++ } else { ++ GENTRY *nge; ++ ++ nge = newgentry(0); ++ nge->type = GE_MOVE; ++ nge->ix3 = x; ++ nge->iy3 = y; ++ nge->bkwd = (GENTRY*)&g->entries; ++ g->entries = g->lastentry = nge; ++ } ++ ++} ++ ++void ++fg_rlineto( ++ GLYPH * g, ++ double x, ++ double y) ++{ ++ GENTRY *oge, *nge; ++ ++ if (ISDBG(BUILDG)) ++ fprintf(stderr, "%s: f rlineto(%g, %g)\n", g->name, x, y); ++ ++ assertisfloat(g, "adding float LINE"); ++ ++ nge = newgentry(GEF_FLOAT); ++ nge->type = GE_LINE; ++ nge->fx3 = x; ++ nge->fy3 = y; ++ ++ if ((oge = g->lastentry) != 0) { ++ if (x == oge->fx3 && y == oge->fy3) { /* empty line */ ++ /* ignore it or we will get in troubles later */ ++ free(nge); ++ return; ++ } ++ if (g->path == 0) { ++ g->path = nge; ++ nge->bkwd = nge->frwd = nge; ++ } else { ++ oge->frwd = nge; ++ nge->bkwd = oge; ++ g->path->bkwd = nge; ++ nge->frwd = g->path; ++ } ++ ++ oge->next = nge; ++ nge->prev = oge; ++ g->lastentry = nge; ++ } else { ++ WARNING_1 fprintf(stderr, "Glyph %s: LINE outside of path\n", g->name); ++ free(nge); ++ } ++ ++ if (0 && ISDBG(BUILDG)) ++ dumppaths(g, NULL, NULL); ++} ++ ++void ++ig_rlineto( ++ GLYPH * g, ++ int x, ++ int y) ++{ ++ GENTRY *oge, *nge; ++ ++ if (ISDBG(BUILDG)) ++ fprintf(stderr, "%s: i rlineto(%d, %d)\n", g->name, x, y); ++ ++ assertisint(g, "adding int LINE"); ++ ++ nge = newgentry(0); ++ nge->type = GE_LINE; ++ nge->ix3 = x; ++ nge->iy3 = y; ++ ++ if ((oge = g->lastentry) != 0) { ++ if (x == oge->ix3 && y == oge->iy3) { /* empty line */ ++ /* ignore it or we will get in troubles later */ ++ free(nge); ++ return; ++ } ++ if (g->path == 0) { ++ g->path = nge; ++ nge->bkwd = nge->frwd = nge; ++ } else { ++ oge->frwd = nge; ++ nge->bkwd = oge; ++ g->path->bkwd = nge; ++ nge->frwd = g->path; ++ } ++ ++ oge->next = nge; ++ nge->prev = oge; ++ g->lastentry = nge; ++ } else { ++ WARNING_1 fprintf(stderr, "Glyph %s: LINE outside of path\n", g->name); ++ free(nge); ++ } ++ ++} ++ ++void ++fg_rrcurveto( ++ GLYPH * g, ++ double x1, ++ double y1, ++ double x2, ++ double y2, ++ double x3, ++ double y3) ++{ ++ GENTRY *oge, *nge; ++ ++ oge = g->lastentry; ++ ++ if (ISDBG(BUILDG)) ++ fprintf(stderr, "%s: f rrcurveto(%g, %g, %g, %g, %g, %g)\n" ++ ,g->name, x1, y1, x2, y2, x3, y3); ++ ++ assertisfloat(g, "adding float CURVE"); ++ ++ if (oge && oge->fx3 == x1 && x1 == x2 && x2 == x3) /* check if it's ++ * actually a line */ ++ fg_rlineto(g, x1, y3); ++ else if (oge && oge->fy3 == y1 && y1 == y2 && y2 == y3) ++ fg_rlineto(g, x3, y1); ++ else { ++ nge = newgentry(GEF_FLOAT); ++ nge->type = GE_CURVE; ++ nge->fx1 = x1; ++ nge->fy1 = y1; ++ nge->fx2 = x2; ++ nge->fy2 = y2; ++ nge->fx3 = x3; ++ nge->fy3 = y3; ++ ++ if (oge != 0) { ++ if (x3 == oge->fx3 && y3 == oge->fy3) { ++ free(nge); /* consider this curve empty */ ++ /* ignore it or we will get in troubles later */ ++ return; ++ } ++ if (g->path == 0) { ++ g->path = nge; ++ nge->bkwd = nge->frwd = nge; ++ } else { ++ oge->frwd = nge; ++ nge->bkwd = oge; ++ g->path->bkwd = nge; ++ nge->frwd = g->path; ++ } ++ ++ oge->next = nge; ++ nge->prev = oge; ++ g->lastentry = nge; ++ } else { ++ WARNING_1 fprintf(stderr, "Glyph %s: CURVE outside of path\n", g->name); ++ free(nge); ++ } ++ } ++ ++ if (0 && ISDBG(BUILDG)) ++ dumppaths(g, NULL, NULL); ++} ++ ++void ++ig_rrcurveto( ++ GLYPH * g, ++ int x1, ++ int y1, ++ int x2, ++ int y2, ++ int x3, ++ int y3) ++{ ++ GENTRY *oge, *nge; ++ ++ oge = g->lastentry; ++ ++ if (ISDBG(BUILDG)) ++ fprintf(stderr, "%s: i rrcurveto(%d, %d, %d, %d, %d, %d)\n" ++ ,g->name, x1, y1, x2, y2, x3, y3); ++ ++ assertisint(g, "adding int CURVE"); ++ ++ if (oge && oge->ix3 == x1 && x1 == x2 && x2 == x3) /* check if it's ++ * actually a line */ ++ ig_rlineto(g, x1, y3); ++ else if (oge && oge->iy3 == y1 && y1 == y2 && y2 == y3) ++ ig_rlineto(g, x3, y1); ++ else { ++ nge = newgentry(0); ++ nge->type = GE_CURVE; ++ nge->ix1 = x1; ++ nge->iy1 = y1; ++ nge->ix2 = x2; ++ nge->iy2 = y2; ++ nge->ix3 = x3; ++ nge->iy3 = y3; ++ ++ if (oge != 0) { ++ if (x3 == oge->ix3 && y3 == oge->iy3) { ++ free(nge); /* consider this curve empty */ ++ /* ignore it or we will get in troubles later */ ++ return; ++ } ++ if (g->path == 0) { ++ g->path = nge; ++ nge->bkwd = nge->frwd = nge; ++ } else { ++ oge->frwd = nge; ++ nge->bkwd = oge; ++ g->path->bkwd = nge; ++ nge->frwd = g->path; ++ } ++ ++ oge->next = nge; ++ nge->prev = oge; ++ g->lastentry = nge; ++ } else { ++ WARNING_1 fprintf(stderr, "Glyph %s: CURVE outside of path\n", g->name); ++ free(nge); ++ } ++ } ++} ++ ++void ++g_closepath( ++ GLYPH * g ++) ++{ ++ GENTRY *oge, *nge; ++ ++ if (ISDBG(BUILDG)) ++ fprintf(stderr, "%s: closepath\n", g->name); ++ ++ oge = g->lastentry; ++ ++ if (g->path == 0) { ++ WARNING_1 fprintf(stderr, "Warning: **** closepath on empty path in glyph \"%s\" ****\n", ++ g->name); ++ if (oge == 0) { ++ WARNING_1 fprintf(stderr, "No previois entry\n"); ++ } else { ++ WARNING_1 fprintf(stderr, "Previous entry type: %c\n", oge->type); ++ if (oge->type == GE_MOVE) { ++ g->lastentry = oge->prev; ++ if (oge->prev == 0) ++ g->entries = 0; ++ else ++ g->lastentry->next = 0; ++ free(oge); ++ } ++ } ++ return; ++ } ++ ++ nge = newgentry(oge->flags & GEF_FLOAT); /* keep the same type */ ++ nge->type = GE_PATH; ++ ++ g->path = 0; ++ ++ oge->next = nge; ++ nge->prev = oge; ++ g->lastentry = nge; ++ ++ if (0 && ISDBG(BUILDG)) ++ dumppaths(g, NULL, NULL); ++} ++ ++/* ++ * * SB * Routines to smooth and fix the glyphs ++ */ ++ ++/* ++** we don't want to see the curves with coinciding middle and ++** outer points ++*/ ++ ++static void ++fixcvends( ++ GENTRY * ge ++) ++{ ++ int dx, dy; ++ int x0, y0, x1, y1, x2, y2, x3, y3; ++ ++ if (ge->type != GE_CURVE) ++ return; ++ ++ if(ge->flags & GEF_FLOAT) { ++ fprintf(stderr, "**! fixcvends(0x%x) on floating entry, ABORT\n", ge); ++ abort(); /* dump core */ ++ } ++ ++ x0 = ge->prev->ix3; ++ y0 = ge->prev->iy3; ++ x1 = ge->ix1; ++ y1 = ge->iy1; ++ x2 = ge->ix2; ++ y2 = ge->iy2; ++ x3 = ge->ix3; ++ y3 = ge->iy3; ++ ++ ++ /* look at the start of the curve */ ++ if (x1 == x0 && y1 == y0) { ++ dx = x2 - x1; ++ dy = y2 - y1; ++ ++ if ((dx == 0 && dy == 0) ++ || (x2 == x3 && y2 == y3)) { ++ /* Oops, we actually have a straight line */ ++ /* ++ * if it's small, we hope that it will get optimized ++ * later ++ */ ++ if (abs(x3 - x0) <= 2 || abs(y3 - y0) <= 2) { ++ ge->ix1 = x3; ++ ge->iy1 = y3; ++ ge->ix2 = x0; ++ ge->iy2 = y0; ++ } else {/* just make it a line */ ++ ge->type = GE_LINE; ++ } ++ } else { ++ if (abs(dx) < 4 && abs(dy) < 4) { /* consider it very ++ * small */ ++ ge->ix1 = x2; ++ ge->iy1 = y2; ++ } else if (abs(dx) < 8 && abs(dy) < 8) { /* consider it small */ ++ ge->ix1 += dx / 2; ++ ge->iy1 += dy / 2; ++ } else { ++ ge->ix1 += dx / 4; ++ ge->iy1 += dy / 4; ++ } ++ /* make sure that it's still on the same side */ ++ if (abs(x3 - x0) * abs(dy) < abs(y3 - y0) * abs(dx)) { ++ if (abs(x3 - x0) * abs(ge->iy1 - y0) > abs(y3 - y0) * abs(ge->ix1 - x0)) ++ ge->ix1 += isign(dx); ++ } else { ++ if (abs(x3 - x0) * abs(ge->iy1 - y0) < abs(y3 - y0) * abs(ge->ix1 - x0)) ++ ge->iy1 += isign(dy); ++ } ++ ++ ge->ix2 += (x3 - x2) / 8; ++ ge->iy2 += (y3 - y2) / 8; ++ /* make sure that it's still on the same side */ ++ if (abs(x3 - x0) * abs(y3 - y2) < abs(y3 - y0) * abs(x3 - x2)) { ++ if (abs(x3 - x0) * abs(y3 - ge->iy2) > abs(y3 - y0) * abs(x3 - ge->ix2)) ++ ge->iy1 -= isign(y3 - y2); ++ } else { ++ if (abs(x3 - x0) * abs(y3 - ge->iy2) < abs(y3 - y0) * abs(x3 - ge->ix2)) ++ ge->ix1 -= isign(x3 - x2); ++ } ++ ++ } ++ } else if (x2 == x3 && y2 == y3) { ++ dx = x1 - x2; ++ dy = y1 - y2; ++ ++ if (dx == 0 && dy == 0) { ++ /* Oops, we actually have a straight line */ ++ /* ++ * if it's small, we hope that it will get optimized ++ * later ++ */ ++ if (abs(x3 - x0) <= 2 || abs(y3 - y0) <= 2) { ++ ge->ix1 = x3; ++ ge->iy1 = y3; ++ ge->ix2 = x0; ++ ge->iy2 = y0; ++ } else {/* just make it a line */ ++ ge->type = GE_LINE; ++ } ++ } else { ++ if (abs(dx) < 4 && abs(dy) < 4) { /* consider it very ++ * small */ ++ ge->ix2 = x1; ++ ge->iy2 = y1; ++ } else if (abs(dx) < 8 && abs(dy) < 8) { /* consider it small */ ++ ge->ix2 += dx / 2; ++ ge->iy2 += dy / 2; ++ } else { ++ ge->ix2 += dx / 4; ++ ge->iy2 += dy / 4; ++ } ++ /* make sure that it's still on the same side */ ++ if (abs(x3 - x0) * abs(dy) < abs(y3 - y0) * abs(dx)) { ++ if (abs(x3 - x0) * abs(ge->iy2 - y3) > abs(y3 - y0) * abs(ge->ix2 - x3)) ++ ge->ix2 += isign(dx); ++ } else { ++ if (abs(x3 - x0) * abs(ge->iy2 - y3) < abs(y3 - y0) * abs(ge->ix2 - x3)) ++ ge->iy2 += isign(dy); ++ } ++ ++ ge->ix1 += (x0 - x1) / 8; ++ ge->iy1 += (y0 - y1) / 8; ++ /* make sure that it's still on the same side */ ++ if (abs(x3 - x0) * abs(y0 - y1) < abs(y3 - y0) * abs(x0 - x1)) { ++ if (abs(x3 - x0) * abs(y0 - ge->iy1) > abs(y3 - y0) * abs(x0 - ge->ix1)) ++ ge->iy1 -= isign(y0 - y1); ++ } else { ++ if (abs(x3 - x0) * abs(y0 - ge->iy1) < abs(y3 - y0) * abs(x0 - ge->ix1)) ++ ge->ix1 -= isign(x0 - x1); ++ } ++ ++ } ++ } ++} ++ ++/* ++** After transformations we want to make sure that the resulting ++** curve is going in the same quadrant as the original one, ++** because rounding errors introduced during transformations ++** may make the result completeley wrong. ++** ++** `dir' argument describes the direction of the original curve, ++** it is the superposition of two values for the front and ++** rear ends of curve: ++** ++** >EQUAL - goes over the line connecting the ends ++** =EQUAL - coincides with the line connecting the ends ++** flags & GEF_FLOAT) { ++ fprintf(stderr, "**! fixcvdir(0x%x) on floating entry, ABORT\n", ge); ++ abort(); /* dump core */ ++ } ++ ++ fdir = (dir & CVDIR_FRONT) - CVDIR_FEQUAL; ++ if ((dir & CVDIR_REAR) == CVDIR_RSAME) ++ rdir = fdir; /* we need only isign, exact value doesn't matter */ ++ else ++ rdir = (dir & CVDIR_REAR) - CVDIR_REQUAL; ++ ++ fixcvends(ge); ++ ++ c = isign(ge->ix3 - ge->prev->ix3); /* note the direction of ++ * curve */ ++ d = isign(ge->iy3 - ge->prev->iy3); ++ ++ a = ge->iy3 - ge->prev->iy3; ++ b = ge->ix3 - ge->prev->ix3; ++ kk = fabs(a == 0 ? (b == 0 ? 1. : 100000.) : ((double) b / (double) a)); ++ a = ge->iy1 - ge->prev->iy3; ++ b = ge->ix1 - ge->prev->ix3; ++ kk1 = fabs(a == 0 ? (b == 0 ? 1. : 100000.) : ((double) b / (double) a)); ++ a = ge->iy3 - ge->iy2; ++ b = ge->ix3 - ge->ix2; ++ kk2 = fabs(a == 0 ? (b == 0 ? 1. : 100000.) : ((double) b / (double) a)); ++ ++ changed = 1; ++ while (changed) { ++ if (ISDBG(FIXCVDIR)) { ++ /* for debugging */ ++ fprintf(stderr, "fixcvdir %d %d (%d %d %d %d %d %d) %f %f %f\n", ++ fdir, rdir, ++ ge->ix1 - ge->prev->ix3, ++ ge->iy1 - ge->prev->iy3, ++ ge->ix2 - ge->ix1, ++ ge->iy2 - ge->iy1, ++ ge->ix3 - ge->ix2, ++ ge->iy3 - ge->iy2, ++ kk1, kk, kk2); ++ } ++ changed = 0; ++ ++ if (fdir > 0) { ++ if (kk1 > kk) { /* the front end has problems */ ++ if (c * (ge->ix1 - ge->prev->ix3) > 0) { ++ ge->ix1 -= c; ++ changed = 1; ++ } if (d * (ge->iy2 - ge->iy1) > 0) { ++ ge->iy1 += d; ++ changed = 1; ++ } ++ /* recalculate the coefficients */ ++ a = ge->iy3 - ge->prev->iy3; ++ b = ge->ix3 - ge->prev->ix3; ++ kk = fabs(a == 0 ? (b == 0 ? 1. : 100000.) : ((double) b / (double) a)); ++ a = ge->iy1 - ge->prev->iy3; ++ b = ge->ix1 - ge->prev->ix3; ++ kk1 = fabs(a == 0 ? (b == 0 ? 1. : 100000.) : ((double) b / (double) a)); ++ } ++ } else if (fdir < 0) { ++ if (kk1 < kk) { /* the front end has problems */ ++ if (c * (ge->ix2 - ge->ix1) > 0) { ++ ge->ix1 += c; ++ changed = 1; ++ } if (d * (ge->iy1 - ge->prev->iy3) > 0) { ++ ge->iy1 -= d; ++ changed = 1; ++ } ++ /* recalculate the coefficients */ ++ a = ge->iy1 - ge->prev->iy3; ++ b = ge->ix1 - ge->prev->ix3; ++ kk1 = fabs(a == 0 ? (b == 0 ? 1. : 100000.) : ((double) b / (double) a)); ++ a = ge->iy3 - ge->prev->iy3; ++ b = ge->ix3 - ge->prev->ix3; ++ kk = fabs(a == 0 ? (b == 0 ? 1. : 100000.) : ((double) b / (double) a)); ++ } ++ } ++ if (rdir > 0) { ++ if (kk2 < kk) { /* the rear end has problems */ ++ if (c * (ge->ix2 - ge->ix1) > 0) { ++ ge->ix2 -= c; ++ changed = 1; ++ } if (d * (ge->iy3 - ge->iy2) > 0) { ++ ge->iy2 += d; ++ changed = 1; ++ } ++ /* recalculate the coefficients */ ++ a = ge->iy3 - ge->prev->iy3; ++ b = ge->ix3 - ge->prev->ix3; ++ kk = fabs(a == 0 ? (b == 0 ? 1. : 100000.) : ((double) b / (double) a)); ++ a = ge->iy3 - ge->iy2; ++ b = ge->ix3 - ge->ix2; ++ kk2 = fabs(a == 0 ? (b == 0 ? 1. : 100000.) : ((double) b / (double) a)); ++ } ++ } else if (rdir < 0) { ++ if (kk2 > kk) { /* the rear end has problems */ ++ if (c * (ge->ix3 - ge->ix2) > 0) { ++ ge->ix2 += c; ++ changed = 1; ++ } if (d * (ge->iy2 - ge->iy1) > 0) { ++ ge->iy2 -= d; ++ changed = 1; ++ } ++ /* recalculate the coefficients */ ++ a = ge->iy3 - ge->prev->iy3; ++ b = ge->ix3 - ge->prev->ix3; ++ kk = fabs(a == 0 ? (b == 0 ? 1. : 100000.) : ((double) b / (double) a)); ++ a = ge->iy3 - ge->iy2; ++ b = ge->ix3 - ge->ix2; ++ kk2 = fabs(a == 0 ? (b == 0 ? 1. : 100000.) : ((double) b / (double) a)); ++ } ++ } ++ } ++ fixcvends(ge); ++} ++ ++/* Get the directions of ends of curve for further usage */ ++ ++/* expects that the previous element is also float */ ++ ++static int ++fgetcvdir( ++ GENTRY * ge ++) ++{ ++ double a, b; ++ double k, k1, k2; ++ int dir = 0; ++ ++ if( !(ge->flags & GEF_FLOAT) ) { ++ fprintf(stderr, "**! fgetcvdir(0x%x) on int entry, ABORT\n", ge); ++ abort(); /* dump core */ ++ } ++ ++ a = fabs(ge->fy3 - ge->prev->fy3); ++ b = fabs(ge->fx3 - ge->prev->fx3); ++ k = a < FEPS ? (b < FEPS ? 1. : 100000.) : ( b / a); ++ ++ a = fabs(ge->fy1 - ge->prev->fy3); ++ b = fabs(ge->fx1 - ge->prev->fx3); ++ if(a < FEPS) { ++ if(b < FEPS) { ++ a = fabs(ge->fy2 - ge->prev->fy3); ++ b = fabs(ge->fx2 - ge->prev->fx3); ++ k1 = a < FEPS ? (b < FEPS ? k : 100000.) : ( b / a); ++ } else ++ k1 = FBIGVAL; ++ } else ++ k1 = b / a; ++ ++ a = fabs(ge->fy3 - ge->fy2); ++ b = fabs(ge->fx3 - ge->fx2); ++ if(a < FEPS) { ++ if(b < FEPS) { ++ a = fabs(ge->fy3 - ge->fy1); ++ b = fabs(ge->fx3 - ge->fx1); ++ k2 = a < FEPS ? (b < FEPS ? k : 100000.) : ( b / a); ++ } else ++ k2 = FBIGVAL; ++ } else ++ k2 = b / a; ++ ++ if(fabs(k1-k) < 0.0001) ++ dir |= CVDIR_FEQUAL; ++ else if (k1 < k) ++ dir |= CVDIR_FUP; ++ else ++ dir |= CVDIR_FDOWN; ++ ++ if(fabs(k2-k) < 0.0001) ++ dir |= CVDIR_REQUAL; ++ else if (k2 > k) ++ dir |= CVDIR_RUP; ++ else ++ dir |= CVDIR_RDOWN; ++ ++ return dir; ++} ++ ++ ++/* expects that the previous element is also int */ ++ ++static int ++igetcvdir( ++ GENTRY * ge ++) ++{ ++ int a, b; ++ double k, k1, k2; ++ int dir = 0; ++ ++ if(ge->flags & GEF_FLOAT) { ++ fprintf(stderr, "**! igetcvdir(0x%x) on floating entry, ABORT\n", ge); ++ abort(); /* dump core */ ++ } ++ ++ a = ge->iy3 - ge->prev->iy3; ++ b = ge->ix3 - ge->prev->ix3; ++ k = (a == 0) ? (b == 0 ? 1. : 100000.) : fabs((double) b / (double) a); ++ ++ a = ge->iy1 - ge->prev->iy3; ++ b = ge->ix1 - ge->prev->ix3; ++ if(a == 0) { ++ if(b == 0) { ++ a = ge->iy2 - ge->prev->iy3; ++ b = ge->ix2 - ge->prev->ix3; ++ k1 = (a == 0) ? (b == 0 ? k : 100000.) : fabs((double) b / (double) a); ++ } else ++ k1 = FBIGVAL; ++ } else ++ k1 = fabs((double) b / (double) a); ++ ++ a = ge->iy3 - ge->iy2; ++ b = ge->ix3 - ge->ix2; ++ if(a == 0) { ++ if(b == 0) { ++ a = ge->iy3 - ge->iy1; ++ b = ge->ix3 - ge->ix1; ++ k2 = (a == 0) ? (b == 0 ? k : 100000.) : fabs((double) b / (double) a); ++ } else ++ k2 = FBIGVAL; ++ } else ++ k2 = fabs((double) b / (double) a); ++ ++ if(fabs(k1-k) < 0.0001) ++ dir |= CVDIR_FEQUAL; ++ else if (k1 < k) ++ dir |= CVDIR_FUP; ++ else ++ dir |= CVDIR_FDOWN; ++ ++ if(fabs(k2-k) < 0.0001) ++ dir |= CVDIR_REQUAL; ++ else if (k2 > k) ++ dir |= CVDIR_RUP; ++ else ++ dir |= CVDIR_RDOWN; ++ ++ return dir; ++} ++ ++#if 0 ++/* a function just to test the work of fixcvdir() */ ++static void ++testfixcvdir( ++ GLYPH * g ++) ++{ ++ GENTRY *ge; ++ int dir; ++ ++ for (ge = g->entries; ge != 0; ge = ge->next) { ++ if (ge->type == GE_CURVE) { ++ dir = igetcvdir(ge); ++ fixcvdir(ge, dir); ++ } ++ } ++} ++#endif ++ ++static int ++iround( ++ double val ++) ++{ ++ return (int) (val > 0 ? val + 0.5 : val - 0.5); ++} ++ ++/* for debugging - dump the glyph ++ * mark with a star the entries from start to end inclusive ++ * (start == NULL means don't mark any, end == NULL means to the last) ++ */ ++ ++void ++dumppaths( ++ GLYPH *g, ++ GENTRY *start, ++ GENTRY *end ++) ++{ ++ GENTRY *ge; ++ int i; ++ char mark=' '; ++ ++ fprintf(stderr, "Glyph %s:\n", g->name); ++ ++ /* now do the conversion */ ++ for(ge = g->entries; ge != 0; ge = ge->next) { ++ if(ge == start) ++ mark = '*'; ++ fprintf(stderr, " %c %8x", mark, ge); ++ switch(ge->type) { ++ case GE_MOVE: ++ case GE_LINE: ++ if(ge->flags & GEF_FLOAT) ++ fprintf(stderr," %c float (%g, %g)\n", ge->type, ge->fx3, ge->fy3); ++ else ++ fprintf(stderr," %c int (%d, %d)\n", ge->type, ge->ix3, ge->iy3); ++ break; ++ case GE_CURVE: ++ if(ge->flags & GEF_FLOAT) { ++ fprintf(stderr," C float "); ++ for(i=0; i<3; i++) ++ fprintf(stderr,"(%g, %g) ", ge->fxn[i], ge->fyn[i]); ++ fprintf(stderr,"\n"); ++ } else { ++ fprintf(stderr," C int "); ++ for(i=0; i<3; i++) ++ fprintf(stderr,"(%d, %d) ", ge->ixn[i], ge->iyn[i]); ++ fprintf(stderr,"\n"); ++ } ++ break; ++ default: ++ fprintf(stderr, " %c\n", ge->type); ++ break; ++ } ++ if(ge == end) ++ mark = ' '; ++ } ++} ++ ++/* ++ * Routine that converts all entries in the path from float to int ++ */ ++ ++void ++pathtoint( ++ GLYPH *g ++) ++{ ++ GENTRY *ge; ++ int x[3], y[3]; ++ int i; ++ ++ ++ if(ISDBG(TOINT)) ++ fprintf(stderr, "TOINT: glyph %s\n", g->name); ++ assertisfloat(g, "converting path to int\n"); ++ ++ fdelsmall(g, 1.0); /* get rid of sub-pixel contours */ ++ assertpath(g->entries, __FILE__, __LINE__, g->name); ++ ++ /* 1st pass, collect the directions of the curves: have ++ * to do that in advance, while everyting is float ++ */ ++ for(ge = g->entries; ge != 0; ge = ge->next) { ++ if( !(ge->flags & GEF_FLOAT) ) { ++ fprintf(stderr, "**! glyphs %s has int entry, found in conversion to int\n", ++ g->name); ++ exit(1); ++ } ++ if(ge->type == GE_CURVE) { ++ ge->dir = fgetcvdir(ge); ++ } ++ } ++ ++ /* now do the conversion */ ++ for(ge = g->entries; ge != 0; ge = ge->next) { ++ switch(ge->type) { ++ case GE_MOVE: ++ case GE_LINE: ++ if(ISDBG(TOINT)) ++ fprintf(stderr," %c float x=%g y=%g\n", ge->type, ge->fx3, ge->fy3); ++ x[0] = iround(ge->fx3); ++ y[0] = iround(ge->fy3); ++ for(i=0; i<3; i++) { /* put some valid values everywhere, for convenience */ ++ ge->ixn[i] = x[0]; ++ ge->iyn[i] = y[0]; ++ } ++ if(ISDBG(TOINT)) ++ fprintf(stderr," int x=%d y=%d\n", ge->ix3, ge->iy3); ++ break; ++ case GE_CURVE: ++ if(ISDBG(TOINT)) ++ fprintf(stderr," %c float ", ge->type); ++ ++ for(i=0; i<3; i++) { ++ if(ISDBG(TOINT)) ++ fprintf(stderr,"(%g, %g) ", ge->fxn[i], ge->fyn[i]); ++ x[i] = iround(ge->fxn[i]); ++ y[i] = iround(ge->fyn[i]); ++ } ++ ++ if(ISDBG(TOINT)) ++ fprintf(stderr,"\n int "); ++ ++ for(i=0; i<3; i++) { ++ ge->ixn[i] = x[i]; ++ ge->iyn[i] = y[i]; ++ if(ISDBG(TOINT)) ++ fprintf(stderr,"(%d, %d) ", ge->ixn[i], ge->iyn[i]); ++ } ++ ge->flags &= ~GEF_FLOAT; /* for fixcvdir */ ++ fixcvdir(ge, ge->dir); ++ ++ if(ISDBG(TOINT)) { ++ fprintf(stderr,"\n fixed "); ++ for(i=0; i<3; i++) ++ fprintf(stderr,"(%d, %d) ", ge->ixn[i], ge->iyn[i]); ++ fprintf(stderr,"\n"); ++ } ++ ++ break; ++ } ++ ge->flags &= ~GEF_FLOAT; ++ } ++ g->flags &= ~GF_FLOAT; ++} ++ ++ ++/* check whether we can fix up the curve to change its size by (dx,dy) */ ++/* 0 means NO, 1 means YES */ ++ ++/* for float: if scaling would be under 10% */ ++ ++int ++fcheckcv( ++ GENTRY * ge, ++ double dx, ++ double dy ++) ++{ ++ if( !(ge->flags & GEF_FLOAT) ) { ++ fprintf(stderr, "**! fcheckcv(0x%x) on int entry, ABORT\n", ge); ++ abort(); /* dump core */ ++ } ++ ++ if (ge->type != GE_CURVE) ++ return 0; ++ ++ if( fabs(ge->fx3 - ge->prev->fx3) < fabs(dx) * 10 ) ++ return 0; ++ ++ if( fabs(ge->fy3 - ge->prev->fy3) < fabs(dy) * 10 ) ++ return 0; ++ ++ return 1; ++} ++ ++/* for int: if won't create new zigzags at the ends */ ++ ++int ++icheckcv( ++ GENTRY * ge, ++ int dx, ++ int dy ++) ++{ ++ int xdep, ydep; ++ ++ if(ge->flags & GEF_FLOAT) { ++ fprintf(stderr, "**! icheckcv(0x%x) on floating entry, ABORT\n", ge); ++ abort(); /* dump core */ ++ } ++ ++ if (ge->type != GE_CURVE) ++ return 0; ++ ++ xdep = ge->ix3 - ge->prev->ix3; ++ ydep = ge->iy3 - ge->prev->iy3; ++ ++ if (ge->type == GE_CURVE ++ && (xdep * (xdep + dx)) > 0 ++ && (ydep * (ydep + dy)) > 0) { ++ return 1; ++ } else ++ return 0; ++} ++ ++/* float connect the ends of open contours */ ++ ++void ++fclosepaths( ++ GLYPH * g ++) ++{ ++ GENTRY *ge, *fge, *xge, *nge; ++ int i; ++ ++ assertisfloat(g, "fclosepaths float\n"); ++ ++ for (xge = g->entries; xge != 0; xge = xge->next) { ++ if( xge->type != GE_PATH ) ++ continue; ++ ++ ge = xge->prev; ++ if(ge == 0 || (ge->type != GE_LINE && ge->type!= GE_CURVE)) { ++ fprintf(stderr, "**! Glyph %s got empty path\n", ++ g->name); ++ exit(1); ++ } ++ ++ fge = ge->frwd; ++ if (fge->prev == 0 || fge->prev->type != GE_MOVE) { ++ fprintf(stderr, "**! Glyph %s got strange beginning of path\n", ++ g->name); ++ exit(1); ++ } ++ fge = fge->prev; ++ if (fge->fx3 != ge->fx3 || fge->fy3 != ge->fy3) { ++ /* we have to fix this open path */ ++ ++ WARNING_4 fprintf(stderr, "Glyph %s got path open by dx=%g dy=%g\n", ++ g->name, fge->fx3 - ge->fx3, fge->fy3 - ge->fy3); ++ ++ ++ /* add a new line */ ++ nge = newgentry(GEF_FLOAT); ++ (*nge) = (*ge); ++ nge->fx3 = fge->fx3; ++ nge->fy3 = fge->fy3; ++ nge->type = GE_LINE; ++ ++ addgeafter(ge, nge); ++ ++ if (fabs(ge->fx3 - fge->fx3) <= 2 && fabs(ge->fy3 - fge->fy3) <= 2) { ++ /* ++ * small change, try to get rid of the new entry ++ */ ++ ++ double df[2]; ++ ++ for(i=0; i<2; i++) { ++ df[i] = ge->fpoints[i][2] - fge->fpoints[i][2]; ++ df[i] = fclosegap(nge, nge, i, df[i], NULL); ++ } ++ ++ if(df[0] == 0. && df[1] == 0.) { ++ /* closed gap successfully, remove the added entry */ ++ freethisge(nge); ++ } ++ } ++ } ++ } ++} ++ ++void ++smoothjoints( ++ GLYPH * g ++) ++{ ++ GENTRY *ge, *ne; ++ int dx1, dy1, dx2, dy2, k; ++ int dir; ++ ++ return; /* this stuff seems to create problems */ ++ ++ assertisint(g, "smoothjoints int"); ++ ++ if (g->entries == 0) /* nothing to do */ ++ return; ++ ++ for (ge = g->entries->next; ge != 0; ge = ge->next) { ++ ne = ge->frwd; ++ ++ /* ++ * although there should be no one-line path * and any path ++ * must end with CLOSEPATH, * nobody can say for sure ++ */ ++ ++ if (ge == ne || ne == 0) ++ continue; ++ ++ /* now handle various joints */ ++ ++ if (ge->type == GE_LINE && ne->type == GE_LINE) { ++ dx1 = ge->ix3 - ge->prev->ix3; ++ dy1 = ge->iy3 - ge->prev->iy3; ++ dx2 = ne->ix3 - ge->ix3; ++ dy2 = ne->iy3 - ge->iy3; ++ ++ /* check whether they have the same direction */ ++ /* and the same slope */ ++ /* then we can join them into one line */ ++ ++ if (dx1 * dx2 >= 0 && dy1 * dy2 >= 0 && dx1 * dy2 == dy1 * dx2) { ++ /* extend the previous line */ ++ ge->ix3 = ne->ix3; ++ ge->iy3 = ne->iy3; ++ ++ /* and get rid of the next line */ ++ freethisge(ne); ++ } ++ } else if (ge->type == GE_LINE && ne->type == GE_CURVE) { ++ fixcvends(ne); ++ ++ dx1 = ge->ix3 - ge->prev->ix3; ++ dy1 = ge->iy3 - ge->prev->iy3; ++ dx2 = ne->ix1 - ge->ix3; ++ dy2 = ne->iy1 - ge->iy3; ++ ++ /* if the line is nearly horizontal and we can fix it */ ++ if (dx1 != 0 && 5 * abs(dy1) / abs(dx1) == 0 ++ && icheckcv(ne, 0, -dy1) ++ && abs(dy1) <= 4) { ++ dir = igetcvdir(ne); ++ ge->iy3 -= dy1; ++ ne->iy1 -= dy1; ++ fixcvdir(ne, dir); ++ if (ge->next != ne) ++ ne->prev->iy3 -= dy1; ++ dy1 = 0; ++ } else if (dy1 != 0 && 5 * abs(dx1) / abs(dy1) == 0 ++ && icheckcv(ne, -dx1, 0) ++ && abs(dx1) <= 4) { ++ /* the same but vertical */ ++ dir = igetcvdir(ne); ++ ge->ix3 -= dx1; ++ ne->ix1 -= dx1; ++ fixcvdir(ne, dir); ++ if (ge->next != ne) ++ ne->prev->ix3 -= dx1; ++ dx1 = 0; ++ } ++ /* ++ * if line is horizontal and curve begins nearly ++ * horizontally ++ */ ++ if (dy1 == 0 && dx2 != 0 && 5 * abs(dy2) / abs(dx2) == 0) { ++ dir = igetcvdir(ne); ++ ne->iy1 -= dy2; ++ fixcvdir(ne, dir); ++ dy2 = 0; ++ } else if (dx1 == 0 && dy2 != 0 && 5 * abs(dx2) / abs(dy2) == 0) { ++ /* the same but vertical */ ++ dir = igetcvdir(ne); ++ ne->ix1 -= dx2; ++ fixcvdir(ne, dir); ++ dx2 = 0; ++ } ++ } else if (ge->type == GE_CURVE && ne->type == GE_LINE) { ++ fixcvends(ge); ++ ++ dx1 = ge->ix3 - ge->ix2; ++ dy1 = ge->iy3 - ge->iy2; ++ dx2 = ne->ix3 - ge->ix3; ++ dy2 = ne->iy3 - ge->iy3; ++ ++ /* if the line is nearly horizontal and we can fix it */ ++ if (dx2 != 0 && 5 * abs(dy2) / abs(dx2) == 0 ++ && icheckcv(ge, 0, dy2) ++ && abs(dy2) <= 4) { ++ dir = igetcvdir(ge); ++ ge->iy3 += dy2; ++ ge->iy2 += dy2; ++ fixcvdir(ge, dir); ++ if (ge->next != ne) ++ ne->prev->iy3 += dy2; ++ dy2 = 0; ++ } else if (dy2 != 0 && 5 * abs(dx2) / abs(dy2) == 0 ++ && icheckcv(ge, dx2, 0) ++ && abs(dx2) <= 4) { ++ /* the same but vertical */ ++ dir = igetcvdir(ge); ++ ge->ix3 += dx2; ++ ge->ix2 += dx2; ++ fixcvdir(ge, dir); ++ if (ge->next != ne) ++ ne->prev->ix3 += dx2; ++ dx2 = 0; ++ } ++ /* ++ * if line is horizontal and curve ends nearly ++ * horizontally ++ */ ++ if (dy2 == 0 && dx1 != 0 && 5 * abs(dy1) / abs(dx1) == 0) { ++ dir = igetcvdir(ge); ++ ge->iy2 += dy1; ++ fixcvdir(ge, dir); ++ dy1 = 0; ++ } else if (dx2 == 0 && dy1 != 0 && 5 * abs(dx1) / abs(dy1) == 0) { ++ /* the same but vertical */ ++ dir = igetcvdir(ge); ++ ge->ix2 += dx1; ++ fixcvdir(ge, dir); ++ dx1 = 0; ++ } ++ } else if (ge->type == GE_CURVE && ne->type == GE_CURVE) { ++ fixcvends(ge); ++ fixcvends(ne); ++ ++ dx1 = ge->ix3 - ge->ix2; ++ dy1 = ge->iy3 - ge->iy2; ++ dx2 = ne->ix1 - ge->ix3; ++ dy2 = ne->iy1 - ge->iy3; ++ ++ /* ++ * check if we have a rather smooth joint at extremal ++ * point ++ */ ++ /* left or right extremal point */ ++ if (abs(dx1) <= 4 && abs(dx2) <= 4 ++ && dy1 != 0 && 5 * abs(dx1) / abs(dy1) == 0 ++ && dy2 != 0 && 5 * abs(dx2) / abs(dy2) == 0 ++ && ((ge->iy3 < ge->prev->iy3 && ne->iy3 < ge->iy3) ++ || (ge->iy3 > ge->prev->iy3 && ne->iy3 > ge->iy3)) ++ && (ge->ix3 - ge->prev->ix3) * (ne->ix3 - ge->ix3) < 0 ++ ) { ++ dir = igetcvdir(ge); ++ ge->ix2 += dx1; ++ dx1 = 0; ++ fixcvdir(ge, dir); ++ dir = igetcvdir(ne); ++ ne->ix1 -= dx2; ++ dx2 = 0; ++ fixcvdir(ne, dir); ++ } ++ /* top or down extremal point */ ++ else if (abs(dy1) <= 4 && abs(dy2) <= 4 ++ && dx1 != 0 && 5 * abs(dy1) / abs(dx1) == 0 ++ && dx2 != 0 && 5 * abs(dy2) / abs(dx2) == 0 ++ && ((ge->ix3 < ge->prev->ix3 && ne->ix3 < ge->ix3) ++ || (ge->ix3 > ge->prev->ix3 && ne->ix3 > ge->ix3)) ++ && (ge->iy3 - ge->prev->iy3) * (ne->iy3 - ge->iy3) < 0 ++ ) { ++ dir = igetcvdir(ge); ++ ge->iy2 += dy1; ++ dy1 = 0; ++ fixcvdir(ge, dir); ++ dir = igetcvdir(ne); ++ ne->iy1 -= dy2; ++ dy2 = 0; ++ fixcvdir(ne, dir); ++ } ++ /* or may be we just have a smooth junction */ ++ else if (dx1 * dx2 >= 0 && dy1 * dy2 >= 0 ++ && 10 * abs(k = abs(dx1 * dy2) - abs(dy1 * dx2)) < (abs(dx1 * dy2) + abs(dy1 * dx2))) { ++ int tries[6][4]; ++ int results[6]; ++ int i, b; ++ ++ /* build array of changes we are going to try */ ++ /* uninitalized entries are 0 */ ++ if (k > 0) { ++ static int t1[6][4] = { ++ {0, 0, 0, 0}, ++ {-1, 0, 1, 0}, ++ {-1, 0, 0, 1}, ++ {0, -1, 1, 0}, ++ {0, -1, 0, 1}, ++ {-1, -1, 1, 1}}; ++ memcpy(tries, t1, sizeof tries); ++ } else { ++ static int t1[6][4] = { ++ {0, 0, 0, 0}, ++ {1, 0, -1, 0}, ++ {1, 0, 0, -1}, ++ {0, 1, -1, 0}, ++ {0, 1, 0, -1}, ++ {1, 1, -1, -1}}; ++ memcpy(tries, t1, sizeof tries); ++ } ++ ++ /* now try the changes */ ++ results[0] = abs(k); ++ for (i = 1; i < 6; i++) { ++ results[i] = abs((abs(dx1) + tries[i][0]) * (abs(dy2) + tries[i][1]) - ++ (abs(dy1) + tries[i][2]) * (abs(dx2) + tries[i][3])); ++ } ++ ++ /* and find the best try */ ++ k = abs(k); ++ b = 0; ++ for (i = 1; i < 6; i++) ++ if (results[i] < k) { ++ k = results[i]; ++ b = i; ++ } ++ /* and finally apply it */ ++ if (dx1 < 0) ++ tries[b][0] = -tries[b][0]; ++ if (dy2 < 0) ++ tries[b][1] = -tries[b][1]; ++ if (dy1 < 0) ++ tries[b][2] = -tries[b][2]; ++ if (dx2 < 0) ++ tries[b][3] = -tries[b][3]; ++ ++ dir = igetcvdir(ge); ++ ge->ix2 -= tries[b][0]; ++ ge->iy2 -= tries[b][2]; ++ fixcvdir(ge, dir); ++ dir = igetcvdir(ne); ++ ne->ix1 += tries[b][3]; ++ ne->iy1 += tries[b][1]; ++ fixcvdir(ne, dir); ++ } ++ } ++ } ++} ++ ++/* debugging: print out stems of a glyph */ ++static void ++debugstems( ++ char *name, ++ STEM * hstems, ++ int nhs, ++ STEM * vstems, ++ int nvs ++) ++{ ++ int i; ++ ++ fprintf(pfa_file, "%% %s\n", name); ++ fprintf(pfa_file, "%% %d horizontal stems:\n", nhs); ++ for (i = 0; i < nhs; i++) ++ fprintf(pfa_file, "%% %3d %d (%d...%d) %c %c%c%c%c\n", i, hstems[i].value, ++ hstems[i].from, hstems[i].to, ++ ((hstems[i].flags & ST_UP) ? 'U' : 'D'), ++ ((hstems[i].flags & ST_END) ? 'E' : '-'), ++ ((hstems[i].flags & ST_FLAT) ? 'F' : '-'), ++ ((hstems[i].flags & ST_ZONE) ? 'Z' : ' '), ++ ((hstems[i].flags & ST_TOPZONE) ? 'T' : ' ')); ++ fprintf(pfa_file, "%% %d vertical stems:\n", nvs); ++ for (i = 0; i < nvs; i++) ++ fprintf(pfa_file, "%% %3d %d (%d...%d) %c %c%c\n", i, vstems[i].value, ++ vstems[i].from, vstems[i].to, ++ ((vstems[i].flags & ST_UP) ? 'U' : 'D'), ++ ((vstems[i].flags & ST_END) ? 'E' : '-'), ++ ((vstems[i].flags & ST_FLAT) ? 'F' : '-')); ++} ++ ++/* add pseudo-stems for the limits of the Blue zones to the stem array */ ++static int ++addbluestems( ++ STEM *s, ++ int n ++) ++{ ++ int i; ++ ++ for(i=0; i ++ ((s[j].flags & (ST_ZONE|ST_FLAT|ST_END)) ^ ST_FLAT) ++ ) ++ continue; ++ } else { ++ if( ++ ((s[i].flags & (ST_ZONE|ST_FLAT|ST_END)) ^ ST_FLAT) ++ < ++ ((s[j].flags & (ST_ZONE|ST_FLAT|ST_END)) ^ ST_FLAT) ++ ) ++ continue; ++ } ++ } ++ } ++ x = s[j]; ++ s[j] = s[i]; ++ s[i] = x; ++ } ++} ++ ++/* check whether two stem borders overlap */ ++ ++static int ++stemoverlap( ++ STEM * s1, ++ STEM * s2 ++) ++{ ++ int result; ++ ++ if ((s1->from <= s2->from && s1->to >= s2->from) ++ || (s2->from <= s1->from && s2->to >= s1->from)) ++ result = 1; ++ else ++ result = 0; ++ ++ if (ISDBG(STEMOVERLAP)) ++ fprintf(pfa_file, "%% overlap %d(%d..%d)x%d(%d..%d)=%d\n", ++ s1->value, s1->from, s1->to, s2->value, s2->from, s2->to, result); ++ return result; ++} ++ ++/* ++ * check if the stem [border] is in an appropriate blue zone ++ * (currently not used) ++ */ ++ ++static int ++steminblue( ++ STEM *s ++) ++{ ++ int i, val; ++ ++ val=s->value; ++ if(s->flags & ST_UP) { ++ /* painted size up, look at lower zones */ ++ if(nblues>=2 && val>=bluevalues[0] && val<=bluevalues[1] ) ++ return 1; ++ for(i=0; i=otherblues[i] && val<=otherblues[i+1] ) ++ return 1; ++ } ++ } else { ++ /* painted side down, look at upper zones */ ++ for(i=2; i=bluevalues[i] && val<=bluevalues[i+1] ) ++ return 1; ++ } ++ } ++ ++ return 0; ++} ++ ++/* mark the outermost stem [borders] in the blue zones */ ++ ++static void ++markbluestems( ++ STEM *s, ++ int nold ++) ++{ ++ int i, j, a, b, c; ++ /* ++ * traverse the list of Blue Values, mark the lowest upper ++ * stem in each bottom zone and the topmost lower stem in ++ * each top zone with ST_BLUE ++ */ ++ ++ /* top zones */ ++ for(i=2; i=0; j--) { ++ if( s[j].flags & (ST_ZONE|ST_UP|ST_END) ) ++ continue; ++ c=s[j].value; ++ if(c=0 && s[j].value==c ++ && (s[j].flags & (ST_UP|ST_ZONE))==0 ; j--) ++ s[j].flags |= ST_BLUE; ++ break; ++ } ++ } ++ } ++ /* baseline */ ++ if(nblues>=2) { ++ a=bluevalues[0]; b=bluevalues[1]; ++ for(j=0; jb) /* too high */ ++ break; ++ if(c>=a) { /* found the lowest stem border */ ++ /* mark all the stems with the same value */ ++ if(ISDBG(BLUESTEMS)) ++ fprintf(pfa_file, "%% found U BLUE at %d\n", s[j].value); ++ /* include ST_END values */ ++ while( s[j-1].value==c && (s[j-1].flags & ST_ZONE)==0 ) ++ j--; ++ s[j].flags |= ST_BLUE; ++ for(j++; jb) /* too high */ ++ break; ++ if(c>=a) { /* found the lowest stem border */ ++ /* mark all the stems with the same value */ ++ if(ISDBG(BLUESTEMS)) ++ fprintf(pfa_file, "%% found U BLUE at %d\n", s[j].value); ++ /* include ST_END values */ ++ while( s[j-1].value==c && (s[j-1].flags & ST_ZONE)==0 ) ++ j--; ++ s[j].flags |= ST_BLUE; ++ for(j++; j=b) { /* have no free space */ ++ for(j=nold; j>=b; j--) /* make free space */ ++ s[j]=s[j-1]; ++ b++; ++ nold++; ++ } ++ s[nnew]=s[a]; ++ s[nnew].flags &= ~(ST_UP|ST_BLUE); ++ nnew++; ++ i=b-1; ++ } else { ++ s[nnew++]=s[c]; ++ i=c; /* skip up to this point */ ++ } ++ if (ISDBG(MAINSTEMS)) ++ fprintf(pfa_file, "%% +stem %d...%d U BLUE\n", ++ s[nnew-2].value, s[nnew-1].value); ++ } else { ++ if (nstack >= MAX_STACK) { ++ WARNING_1 fprintf(stderr, "Warning: **** converter's stem stack overflow ****\n"); ++ nstack = 0; ++ } ++ stack[nstack++] = s[i]; ++ } ++ } else if(s[i].flags & ST_BLUE) { ++ /* again, we just HAVE to use this value */ ++ if (readystem) ++ nnew += 2; ++ readystem=0; ++ ++ /* remember the list of Blue zone stems with the same value */ ++ for(a=i, i++; i= 0; i--) { ++ if( (stack[i].flags & ST_UP)==0 ) { ++ if( (stack[i].flags & (ST_ZONE|ST_TOPZONE))==ST_ZONE ) ++ break; ++ else ++ continue; ++ } ++ for(j=a; j=0; j-=2) { ++ if (ISDBG(MAINSTEMS)) ++ fprintf(pfa_file, "%% ?stem %d...%d -- %d\n", ++ s[j].value, s[j+1].value, stack[c].value); ++ if(s[j+1].value < stack[c].value) /* no conflict */ ++ break; ++ if(s[j].flags & ST_BLUE) { ++ /* oops, we don't want to spoil other blue zones */ ++ stack[c].value=s[j+1].value+1; ++ break; ++ } ++ if( (s[j].flags|s[j+1].flags) & ST_END ) { ++ if (ISDBG(MAINSTEMS)) ++ fprintf(pfa_file, "%% -stem %d...%d p=1\n", ++ s[j].value, s[j+1].value); ++ continue; /* pri==1, silently discard it */ ++ } ++ /* we want to discard no nore than 2 stems of pri>=2 */ ++ if( ++readystem > 2 ) { ++ /* change our stem to not conflict */ ++ stack[c].value=s[j+1].value+1; ++ break; ++ } else { ++ if (ISDBG(MAINSTEMS)) ++ fprintf(pfa_file, "%% -stem %d...%d p>=2\n", ++ s[j].value, s[j+1].value); ++ continue; ++ } ++ } ++ nnew=j+2; ++ /* add this stem */ ++ if(nnew>=b-1) { /* have no free space */ ++ for(j=nold; j>=b-1; j--) /* make free space */ ++ s[j]=s[j-1]; ++ b++; ++ nold++; ++ } ++ s[nnew++]=stack[c]; ++ s[nnew++]=s[b-1]; ++ /* clean up the stack */ ++ nstack=sbottom=0; ++ readystem=0; ++ /* set the next position to search */ ++ i=b-1; ++ if (ISDBG(MAINSTEMS)) ++ fprintf(pfa_file, "%% +stem %d...%d D BLUE\n", ++ s[nnew-2].value, s[nnew-1].value); ++ } else if (nstack > 0) { ++ ++ /* ++ * check whether our stem overlaps with anything in ++ * stack ++ */ ++ for (j = nstack - 1; j >= sbottom; j--) { ++ if (s[i].value <= stack[j].value) ++ break; ++ if (stack[j].flags & ST_ZONE) ++ continue; ++ ++ if ((s[i].flags & ST_END) ++ || (stack[j].flags & ST_END)) ++ pri = 1; ++ else if ((s[i].flags & ST_FLAT) ++ || (stack[j].flags & ST_FLAT)) ++ pri = 3; ++ else ++ pri = 2; ++ ++ if ((pri < readystem && s[nnew + 1].value >= stack[j].value) ++ || !stemoverlap(&stack[j], &s[i])) ++ continue; ++ ++ if (readystem > 1 && s[nnew + 1].value < stack[j].value) { ++ nnew += 2; ++ readystem = 0; ++ nlps = 0; ++ } ++ /* ++ * width of the previous stem (if it's ++ * present) ++ */ ++ w1 = s[nnew + 1].value - s[nnew].value; ++ ++ /* width of this stem */ ++ w2 = s[i].value - stack[j].value; ++ ++ if (readystem == 0) { ++ /* nothing yet, just add a new stem */ ++ s[nnew] = stack[j]; ++ s[nnew + 1] = s[i]; ++ readystem = pri; ++ if (pri == 1) ++ nlps = 1; ++ else if (pri == 2) ++ sbottom = j; ++ else { ++ sbottom = j + 1; ++ while (sbottom < nstack ++ && stack[sbottom].value <= stack[j].value) ++ sbottom++; ++ } ++ if (ISDBG(MAINSTEMS)) ++ fprintf(pfa_file, "%% +stem %d...%d p=%d n=%d\n", ++ stack[j].value, s[i].value, pri, nlps); ++ } else if (pri == 1) { ++ if (stack[j].value > s[nnew + 1].value) { ++ /* ++ * doesn't overlap with the ++ * previous one ++ */ ++ nnew += 2; ++ nlps++; ++ s[nnew] = stack[j]; ++ s[nnew + 1] = s[i]; ++ if (ISDBG(MAINSTEMS)) ++ fprintf(pfa_file, "%% +stem %d...%d p=%d n=%d\n", ++ stack[j].value, s[i].value, pri, nlps); ++ } else if (w2 < w1) { ++ /* is narrower */ ++ s[nnew] = stack[j]; ++ s[nnew + 1] = s[i]; ++ if (ISDBG(MAINSTEMS)) ++ fprintf(pfa_file, "%% /stem %d...%d p=%d n=%d %d->%d\n", ++ stack[j].value, s[i].value, pri, nlps, w1, w2); ++ } ++ } else if (pri == 2) { ++ if (readystem == 2) { ++ /* choose the narrower stem */ ++ if (w1 > w2) { ++ s[nnew] = stack[j]; ++ s[nnew + 1] = s[i]; ++ sbottom = j; ++ if (ISDBG(MAINSTEMS)) ++ fprintf(pfa_file, "%% /stem %d...%d p=%d n=%d\n", ++ stack[j].value, s[i].value, pri, nlps); ++ } ++ /* else readystem==1 */ ++ } else if (stack[j].value > s[nnew + 1].value) { ++ /* ++ * value doesn't overlap with ++ * the previous one ++ */ ++ nnew += 2; ++ nlps = 0; ++ s[nnew] = stack[j]; ++ s[nnew + 1] = s[i]; ++ sbottom = j; ++ readystem = pri; ++ if (ISDBG(MAINSTEMS)) ++ fprintf(pfa_file, "%% +stem %d...%d p=%d n=%d\n", ++ stack[j].value, s[i].value, pri, nlps); ++ } else if (nlps == 1 ++ || stack[j].value > s[nnew - 1].value) { ++ /* ++ * we can replace the top ++ * stem ++ */ ++ nlps = 0; ++ s[nnew] = stack[j]; ++ s[nnew + 1] = s[i]; ++ readystem = pri; ++ sbottom = j; ++ if (ISDBG(MAINSTEMS)) ++ fprintf(pfa_file, "%% /stem %d...%d p=%d n=%d\n", ++ stack[j].value, s[i].value, pri, nlps); ++ } ++ } else if (readystem == 3) { /* that means also ++ * pri==3 */ ++ /* choose the narrower stem */ ++ if (w1 > w2) { ++ s[nnew] = stack[j]; ++ s[nnew + 1] = s[i]; ++ sbottom = j + 1; ++ while (sbottom < nstack ++ && stack[sbottom].value <= stack[j].value) ++ sbottom++; ++ if (ISDBG(MAINSTEMS)) ++ fprintf(pfa_file, "%% /stem %d...%d p=%d n=%d\n", ++ stack[j].value, s[i].value, pri, nlps); ++ } ++ } else if (pri == 3) { ++ /* ++ * we can replace as many stems as ++ * neccessary ++ */ ++ nnew += 2; ++ while (nnew > 0 && s[nnew - 1].value >= stack[j].value) { ++ nnew -= 2; ++ if (ISDBG(MAINSTEMS)) ++ fprintf(pfa_file, "%% -stem %d..%d\n", ++ s[nnew].value, s[nnew + 1].value); ++ } ++ nlps = 0; ++ s[nnew] = stack[j]; ++ s[nnew + 1] = s[i]; ++ readystem = pri; ++ sbottom = j + 1; ++ while (sbottom < nstack ++ && stack[sbottom].value <= stack[j].value) ++ sbottom++; ++ if (ISDBG(MAINSTEMS)) ++ fprintf(pfa_file, "%% +stem %d...%d p=%d n=%d\n", ++ stack[j].value, s[i].value, pri, nlps); ++ } ++ } ++ } ++ } ++ if (readystem) ++ nnew += 2; ++ ++ /* change the 1-pixel-wide stems to 20-pixel-wide stems if possible ++ * the constant 20 is recommended in the Type1 manual ++ */ ++ if(useblues) { ++ for(i=0; ii+2 && s[i+2].value0 && s[i-1].value>s[i].value-22) ++ s[i].value=s[i-1].value+2; /* compensate for fuzziness */ ++ else ++ s[i].value-=20; ++ } ++ } ++ } ++ /* make sure that no stem it stretched between ++ * a top zone and a bottom zone ++ */ ++ if(useblues) { ++ for(i=0; i=s[i].value && c<=s[i+1].value && c=2) { ++ c=bluevalues[1]; ++ if( c>=s[i].value && c<=s[i+1].value && c>b ) ++ b=c; ++ } ++ for(j=1; j=s[i].value && c<=s[i+1].value && c>b ) ++ b=c; ++ } ++ if( a!=10000 && b!= -10000 ) { /* it is stretched */ ++ /* split the stem into 2 ghost stems */ ++ for(j=nnew+1; j>i+1; j--) /* make free space */ ++ s[j]=s[j-2]; ++ nnew+=2; ++ ++ if(s[i].value+22 >= a) ++ s[i+1].value=a-2; /* leave space for fuzziness */ ++ else ++ s[i+1].value=s[i].value+20; ++ ++ if(s[i+3].value-22 <= b) ++ s[i+2].value=b+2; /* leave space for fuzziness */ ++ else ++ s[i+2].value=s[i+3].value-20; ++ ++ i+=2; ++ } ++ } ++ } ++ /* look for triple stems */ ++ for (i = 0; i < nnew; i += 2) { ++ if (nnew - i >= 6) { ++ a = s[i].value + s[i + 1].value; ++ b = s[i + 2].value + s[i + 3].value; ++ c = s[i + 4].value + s[i + 5].value; ++ ++ w1 = s[i + 1].value - s[i].value; ++ w2 = s[i + 3].value - s[i + 2].value; ++ w3 = s[i + 5].value - s[i + 4].value; ++ ++ fw = w3 - w1; /* fuzz in width */ ++ fd = ((c - b) - (b - a)); /* fuzz in distance ++ * (doubled) */ ++ ++ /* we are able to handle some fuzz */ ++ /* ++ * it doesn't hurt if the declared stem is a bit ++ * narrower than actual unless it's an edge in ++ * a blue zone ++ */ ++ if (abs(abs(fd) - abs(fw)) * 5 < w2 ++ && abs(fw) * 20 < (w1 + w3)) { /* width dirrerence <10% */ ++ ++ if(useblues) { /* check that we don't disturb any blue stems */ ++ j=c; k=a; ++ if (fw > 0) { ++ if (fd > 0) { ++ if( s[i+5].flags & ST_BLUE ) ++ continue; ++ j -= fw; ++ } else { ++ if( s[i+4].flags & ST_BLUE ) ++ continue; ++ j += fw; ++ } ++ } else if(fw < 0) { ++ if (fd > 0) { ++ if( s[i+1].flags & ST_BLUE ) ++ continue; ++ k -= fw; ++ } else { ++ if( s[i].flags & ST_BLUE ) ++ continue; ++ k += fw; ++ } ++ } ++ pri = ((j - b) - (b - k)); ++ ++ if (pri > 0) { ++ if( s[i+2].flags & ST_BLUE ) ++ continue; ++ } else if(pri < 0) { ++ if( s[i+3].flags & ST_BLUE ) ++ continue; ++ } ++ } ++ ++ /* ++ * first fix up the width of 1st and 3rd ++ * stems ++ */ ++ if (fw > 0) { ++ if (fd > 0) { ++ s[i + 5].value -= fw; ++ c -= fw; ++ } else { ++ s[i + 4].value += fw; ++ c += fw; ++ } ++ } else { ++ if (fd > 0) { ++ s[i + 1].value -= fw; ++ a -= fw; ++ } else { ++ s[i].value += fw; ++ a += fw; ++ } ++ } ++ fd = ((c - b) - (b - a)); ++ ++ if (fd > 0) { ++ s[i + 2].value += abs(fd) / 2; ++ } else { ++ s[i + 3].value -= abs(fd) / 2; ++ } ++ ++ s[i].flags |= ST_3; ++ i += 4; ++ } ++ } ++ } ++ ++ return (nnew & ~1); /* number of lines must be always even */ ++} ++ ++/* ++ * these macros and function allow to set the base stem, ++ * check that it's not empty and subtract another stem ++ * from the base stem (possibly dividing it into multiple parts) ++ */ ++ ++/* pairs for pieces of the base stem */ ++static short xbstem[MAX_STEMS*2]; ++/* index of the last point */ ++static int xblast= -1; ++ ++#define setbasestem(from, to) \ ++ (xbstem[0]=from, xbstem[1]=to, xblast=1) ++#define isbaseempty() (xblast<=0) ++ ++/* returns 1 if was overlapping, 0 otherwise */ ++static int ++subfrombase( ++ int from, ++ int to ++) ++{ ++ int a, b; ++ int i, j; ++ ++ if(isbaseempty()) ++ return 0; ++ ++ /* handle the simple case simply */ ++ if(from > xbstem[xblast] || to < xbstem[0]) ++ return 0; ++ ++ /* the binary search may be more efficient */ ++ /* but for now the linear search is OK */ ++ for(b=1; from > xbstem[b]; b+=2) {} /* result: from <= xbstem[b] */ ++ for(a=xblast-1; to < xbstem[a]; a-=2) {} /* result: to >= xbstem[a] */ ++ ++ /* now the interesting examples are: ++ * (it was hard for me to understand, so I looked at the examples) ++ * 1 ++ * a|-----| |-----|b |-----| |-----| ++ * f|-----|t ++ * 2 ++ * a|-----|b |-----| |-----| |-----| ++ * f|--|t ++ * 3 ++ * a|-----|b |-----| |-----| |-----| ++ * f|-----|t ++ * 4 ++ * |-----|b a|-----| |-----| |-----| ++ * f|------------|t ++ * 5 ++ * |-----| |-----|b |-----| a|-----| ++ * f|-----------------------------|t ++ * 6 ++ * |-----|b |-----| |-----| a|-----| ++ * f|--------------------------------------------------|t ++ * 7 ++ * |-----|b |-----| a|-----| |-----| ++ * f|--------------------------|t ++ */ ++ ++ if(a < b-1) /* hits a gap - example 1 */ ++ return 0; ++ ++ /* now the subtraction itself */ ++ ++ if(a==b-1 && from > xbstem[a] && to < xbstem[b]) { ++ /* overlaps with only one subrange and splits it - example 2 */ ++ j=xblast; i=(xblast+=2); ++ while(j>=b) ++ xbstem[i--]=xbstem[j--]; ++ xbstem[b]=from-1; ++ xbstem[b+1]=to+1; ++ return 1; ++ /* becomes ++ * 2a ++ * a|b || |-----| |-----| |-----| ++ * f|--|t ++ */ ++ } ++ ++ if(xbstem[b-1] < from) { ++ /* cuts the back of this subrange - examples 3, 4, 7 */ ++ xbstem[b] = from-1; ++ b+=2; ++ /* becomes ++ * 3a ++ * a|----| |-----|b |-----| |-----| ++ * f|-----|t ++ * 4a ++ * |---| a|-----|b |-----| |-----| ++ * f|------------|t ++ * 7a ++ * |---| |-----|b a|-----| |-----| ++ * f|--------------------------|t ++ */ ++ } ++ ++ if(xbstem[a+1] > to) { ++ /* cuts the front of this subrange - examples 4a, 5, 7a */ ++ xbstem[a] = to+1; ++ a-=2; ++ /* becomes ++ * 4b ++ * a|---| |---|b |-----| |-----| ++ * f|------------|t ++ * 5b ++ * |-----| |-----|b a|-----| || ++ * f|-----------------------------|t ++ * 7b ++ * |---| a|-----|b || |-----| ++ * f|--------------------------|t ++ */ ++ } ++ ++ if(a < b-1) /* now after modification it hits a gap - examples 3a, 4b */ ++ return 1; /* because we have removed something */ ++ ++ /* now remove the subranges completely covered by the new stem */ ++ /* examples 5b, 6, 7b */ ++ i=b-1; j=a+2; ++ /* positioned as: ++ * 5b i j ++ * |-----| |-----|b a|-----| || ++ * f|-----------------------------|t ++ * 6 i xblast j ++ * |-----|b |-----| |-----| a|-----| ++ * f|--------------------------------------------------|t ++ * 7b i j ++ * |---| a|-----|b || |-----| ++ * f|--------------------------|t ++ */ ++ while(j <= xblast) ++ xbstem[i++]=xbstem[j++]; ++ xblast=i-1; ++ return 1; ++} ++ ++/* for debugging */ ++static void ++printbasestem(void) ++{ ++ int i; ++ ++ printf("( "); ++ for(i=0; i lastpri ++ && ( lastpri==1 || s[j].value-v<20 || (s[x].value-v)*2 >= s[j].value-v ) ) ) { ++ lastpri=pri; ++ x=j; ++ } ++ } ++ } else { ++ for(j=i-1; j>=0; j--) { ++ if(mx[i][j]==0) ++ continue; ++ ++ if( (f | s[j].flags) & ST_END ) ++ pri=1; ++ else if( (f | s[j].flags) & ST_FLAT ) ++ pri=3; ++ else ++ pri=2; ++ ++ if(lastpri==0 ++ || ( pri > lastpri ++ && ( lastpri==1 || v-s[j].value<20 || (v-s[x].value)*2 >= v-s[j].value ) ) ) { ++ lastpri=pri; ++ x=j; ++ } ++ } ++ } ++ if(x== -1 && mx[i][i]) ++ pairs[i]=i; /* a special case */ ++ else ++ pairs[i]=x; ++ } ++ ++ if(ISDBG(SUBSTEMS)) { ++ for(i=0; i0) ++ fprintf(pfa_file, "%% %d...%d (%d x %d)\n", s[i].value, s[j].value, i, j); ++ } ++ } ++} ++ ++/* ++ * Make all the stems originating at the same value get the ++ * same width. Without this the rasterizer may move the dots ++ * randomly up or down by one pixel, and that looks bad. ++ * The prioritisation is the same as in findstemat(). ++ */ ++static void ++uniformstems( ++ STEM * s, ++ short *pairs, ++ int ns ++) ++{ ++ int i, j, from, to, val, dir; ++ int pri, prevpri[2], wd, prevwd[2], prevbest[2]; ++ ++ for(from=0; from prevpri[dir] || wd= 0) { ++ if(ISDBG(SUBSTEMS)) { ++ fprintf(stderr, "at %d (%s %d) pair %d->%d(%d)\n", i, ++ (dir ? "UP":"DOWN"), s[i].value, pairs[i], prevbest[dir], ++ s[prevbest[dir]].value); ++ } ++ pairs[i] = prevbest[dir]; ++ } ++ } ++ } ++} ++ ++/* ++ * Find the best stem in the array at the specified (value, origin), ++ * related to the entry ge. ++ * Returns its index in the array sp, -1 means "none". ++ * prevbest is the result for the other end of the line, we must ++ * find something better than it or leave it as it is. ++ */ ++static int ++findstemat( ++ int value, ++ int origin, ++ GENTRY *ge, ++ STEM *sp, ++ short *pairs, ++ int ns, ++ int prevbest /* -1 means "none" */ ++) ++{ ++ int i, min, max; ++ int v, si; ++ int pri, prevpri; /* priority, 0 = has ST_END, 1 = no ST_END */ ++ int wd, prevwd; /* stem width */ ++ ++ si= -1; /* nothing yet */ ++ ++ /* stems are ordered by value, binary search */ ++ min=0; max=ns; /* min <= i < max */ ++ while( min < max ) { ++ i=(min+max)/2; ++ v=sp[i].value; ++ if(vvalue) ++ max=i; ++ else { ++ si=i; /* temporary value */ ++ break; ++ } ++ } ++ ++ if( si < 0 ) /* found nothing this time */ ++ return prevbest; ++ ++ /* find the priority of the prevbest */ ++ /* we expect that prevbest has a pair */ ++ if(prevbest>=0) { ++ i=pairs[prevbest]; ++ prevpri=1; ++ if( (sp[prevbest].flags | sp[i].flags) & ST_END ) ++ prevpri=0; ++ prevwd=abs(sp[i].value-value); ++ } ++ ++ /* stems are not ordered by origin, so now do the linear search */ ++ ++ while( si>0 && sp[si-1].value==value ) /* find the first one */ ++ si--; ++ ++ for(; siprevpri ++ || (pri==prevpri && prevwd==0) || (wd!=0 && wdprev->ix3; ++ y=ge->prev->iy3; ++ ++ if(*nextvsi == -2) ++ si[SI_VP]=findstemat(x, y, ge, vs, vpairs, nvs, -1); ++ else { ++ si[SI_VP]= *nextvsi; *nextvsi= -2; ++ } ++ if(*nexthsi == -2) ++ si[SI_HP]=findstemat(y, x, ge, hs, hpairs, nhs, -1); ++ else { ++ si[SI_HP]= *nexthsi; *nexthsi= -2; ++ } ++ ++ /* ++ * For the horizontal lines we make sure that both ++ * ends of the line have the same horizontal stem, ++ * and the same thing for vertical lines and stems. ++ * In both cases we enforce the stem for the next entry. ++ * Otherwise unpleasant effects may arise. ++ */ ++ ++ if(ge->type==GE_LINE) { ++ if(ge->ix3==x) { /* vertical line */ ++ *nextvsi=si[SI_VP]=findstemat(x, ge->iy3, ge->frwd, vs, vpairs, nvs, si[SI_VP]); ++ } else if(ge->iy3==y) { /* horizontal line */ ++ *nexthsi=si[SI_HP]=findstemat(y, ge->ix3, ge->frwd, hs, hpairs, nhs, si[SI_HP]); ++ } ++ } ++ ++ if(si[SI_VP]+si[SI_HP] == -2) /* no stems, leave it alone */ ++ return 0; ++ ++ /* build the array of relevant bounds */ ++ nr=0; ++ for(i=0; i< sizeof(si) / sizeof(si[0]); i++) { ++ STEM *sp; ++ short *pairs; ++ int step; ++ int f; ++ int nzones, firstzone, binzone, einzone; ++ int btype, etype; ++ ++ if(si[i] < 0) ++ continue; ++ ++ if(i r[nr].high) { ++ j=r[nr].low; r[nr].low=r[nr].high; r[nr].high=j; ++ step= -1; ++ } else { ++ step=1; ++ } ++ ++ /* handle the interaction with Blue Zones */ ++ ++ if(i>=SI_HP) { /* only for horizontal stems */ ++ if(si[i]==pairs[si[i]]) { ++ /* special case, the outermost stem in the ++ * Blue Zone without a pair, simulate it to 20-pixel ++ */ ++ if(sp[ si[i] ].flags & ST_UP) { ++ r[nr].high+=20; ++ for(j=si[i]+1; j sp[j].value-2) ++ r[nr].high=sp[j].value-2; ++ break; ++ } ++ } else { ++ r[nr].low-=20; ++ for(j=si[i]-1; j>=0; j--) ++ if( (sp[j].flags & (ST_ZONE|ST_TOPZONE)) ++ == (ST_ZONE) ) { ++ if(r[nr].low < sp[j].value+2) ++ r[nr].low=sp[j].value+2; ++ break; ++ } ++ } ++ } ++ ++ /* check that the stem borders don't end up in ++ * different Blue Zones */ ++ f=sp[ si[i] ].flags; ++ nzones=0; einzone=binzone=0; ++ for(j=si[i]; j!=pairs[ si[i] ]; j+=step) { ++ if( (sp[j].flags & ST_ZONE)==0 ) ++ continue; ++ /* if see a zone border going in the same direction */ ++ if( ((f ^ sp[j].flags) & ST_UP)==0 ) { ++ if( ++nzones == 1 ) { ++ firstzone=sp[j].value; /* remember the first one */ ++ etype=sp[j].flags & ST_TOPZONE; ++ } ++ einzone=1; ++ ++ } else { /* the opposite direction */ ++ if(nzones==0) { /* beginning is in a blue zone */ ++ binzone=1; ++ btype=sp[j].flags & ST_TOPZONE; ++ } ++ einzone=0; ++ } ++ } ++ ++ /* beginning and end are in Blue Zones of different types */ ++ if( binzone && einzone && (btype ^ etype)!=0 ) { ++ if( sp[si[i]].flags & ST_UP ) { ++ if(firstzone > r[nr].low+22) ++ r[nr].high=r[nr].low+20; ++ else ++ r[nr].high=firstzone-2; ++ } else { ++ if(firstzone < r[nr].high-22) ++ r[nr].low=r[nr].high-20; ++ else ++ r[nr].low=firstzone+2; ++ } ++ } ++ } ++ ++ if(ISDBG(SUBSTEMS)) ++ fprintf(pfa_file, "%% at(%d,%d)[%d,%d] %d..%d %c (%d x %d)\n", x, y, i, nr, ++ r[nr].low, r[nr].high, r[nr].isvert ? 'v' : 'h', ++ si[i], pairs[si[i]]); ++ ++ nr++; ++ } ++ ++ /* now try to find a group */ ++ conflict=0; /* no conflicts found yet */ ++ for(j=0; j= lb ) { ++ if( r[j].low == lb && r[j].high == hb ) /* coincides */ ++ r[j].already=1; ++ else ++ conflict=1; ++ } ++ ++ if(conflict) ++ break; ++ } ++ ++ if(conflict) { /* nope, check all the groups */ ++ for(j=0; j= lb ) { ++ if( r[j].low == lb && r[j].high == hb ) /* coincides */ ++ r[j].already=1; ++ else ++ conflict=1; ++ } ++ ++ if(conflict) ++ i=egp[grp]-1; /* fast forward to the next group */ ++ } ++ } ++ ++ /* do we have any empty group ? */ ++ if(conflict && grp < NSTEMGRP-1) { ++ grp++; conflict=0; ++ for(j=0; j 0) { ++ for(i=egp[NSTEMGRP-1]-1; i>=egp[grp]; i--) ++ s[i+rexpand]=s[i]; ++ for(i=0; istemid = gssentry_lastgrp = grp; ++ return 0; ++} ++ ++/* ++ * Create the groups of substituted stems from the list. ++ * Each group will be represented by a subroutine in the Subs ++ * array. ++ */ ++ ++static void ++groupsubstems( ++ GLYPH *g, ++ STEM *hs, /* horizontal stems, sorted by value */ ++ short *hpairs, ++ int nhs, ++ STEM *vs, /* vertical stems, sorted by value */ ++ short *vpairs, ++ int nvs ++) ++{ ++ GENTRY *ge; ++ int i, j; ++ ++ /* temporary storage */ ++ STEMBOUNDS s[MAX_STEMS*2]; ++ /* indexes in there, pointing past the end each stem group */ ++ short egp[NSTEMGRP]; ++ ++ int nextvsi, nexthsi; /* -2 means "check by yourself" */ ++ ++ for(i=0; ientries; ge != 0; ge = ge->next) { ++ if(ge->type!=GE_LINE && ge->type!=GE_CURVE) { ++ nextvsi=nexthsi= -2; /* next path is independent */ ++ continue; ++ } ++ ++ if( gssentry(ge, hs, hpairs, nhs, vs, vpairs, nvs, s, egp, &nextvsi, &nexthsi) ) { ++ WARNING_2 fprintf(stderr, "*** glyph %s requires over %d hint subroutines, ignored them\n", ++ g->name, NSTEMGRP); ++ /* it's better to have no substituted hints at all than have only part */ ++ for (ge = g->entries; ge != 0; ge = ge->next) ++ ge->stemid= -1; ++ g->nsg=0; /* just to be safe, already is 0 by initialization */ ++ return; ++ } ++ ++ /* ++ * handle the last vert/horiz line of the path specially, ++ * correct the hint for the first entry of the path ++ */ ++ if(ge->frwd != ge->next && (nextvsi != -2 || nexthsi != -2) ) { ++ if( gssentry(ge->frwd, hs, hpairs, nhs, vs, vpairs, nvs, s, egp, &nextvsi, &nexthsi) ) { ++ WARNING_2 fprintf(stderr, "*** glyph %s requires over %d hint subroutines, ignored them\n", ++ g->name, NSTEMGRP); ++ /* it's better to have no substituted hints at all than have only part */ ++ for (ge = g->entries; ge != 0; ge = ge->next) ++ ge->stemid= -1; ++ g->nsg=0; /* just to be safe, already is 0 by initialization */ ++ return; ++ } ++ } ++ ++ } ++ ++ /* find the index of the first empty group - same as the number of groups */ ++ if(egp[0]>0) { ++ for(i=1; insg=i; ++ } else ++ g->nsg=0; ++ ++ if(ISDBG(SUBSTEMS)) { ++ fprintf(pfa_file, "%% %d substem groups (%d %d %d)\n", g->nsg, ++ g->nsg>1 ? egp[g->nsg-2] : -1, ++ g->nsg>0 ? egp[g->nsg-1] : -1, ++ g->nsgnsg] : -1 ); ++ j=0; ++ for(i=0; insg; i++) { ++ fprintf(pfa_file, "%% grp %3d: ", i); ++ for(; jnsg==1) { /* it would be the same as the main stems */ ++ /* so erase it */ ++ for (ge = g->entries; ge != 0; ge = ge->next) ++ ge->stemid= -1; ++ g->nsg=0; ++ } ++ ++ if(g->nsg>0) { ++ if( (g->nsbs=malloc(g->nsg * sizeof (egp[0]))) == 0 ) { ++ fprintf(stderr, "**** not enough memory for substituted hints ****\n"); ++ exit(255); ++ } ++ memmove(g->nsbs, egp, g->nsg * sizeof(short)); ++ if( (g->sbstems=malloc(egp[g->nsg-1] * sizeof (s[0]))) == 0 ) { ++ fprintf(stderr, "**** not enough memory for substituted hints ****\n"); ++ exit(255); ++ } ++ memmove(g->sbstems, s, egp[g->nsg-1] * sizeof(s[0])); ++ } ++} ++ ++void ++buildstems( ++ GLYPH * g ++) ++{ ++ STEM hs[MAX_STEMS], vs[MAX_STEMS]; /* temporary working ++ * storage */ ++ short hs_pairs[MAX_STEMS], vs_pairs[MAX_STEMS]; /* best pairs for these stems */ ++ STEM *sp; ++ GENTRY *ge, *nge, *pge; ++ int nx, ny; ++ int ovalue; ++ int totals, grp, lastgrp; ++ ++ assertisint(g, "buildstems int"); ++ ++ g->nhs = g->nvs = 0; ++ memset(hs, 0, sizeof hs); ++ memset(vs, 0, sizeof vs); ++ ++ /* first search the whole character for possible stem points */ ++ ++ for (ge = g->entries; ge != 0; ge = ge->next) { ++ if (ge->type == GE_CURVE) { ++ ++ /* ++ * SURPRISE! ++ * We consider the stems bound by the ++ * H/V ends of the curves as flat ones. ++ * ++ * But we don't include the point on the ++ * other end into the range. ++ */ ++ ++ /* first check the beginning of curve */ ++ /* if it is horizontal, add a hstem */ ++ if (ge->iy1 == ge->prev->iy3) { ++ hs[g->nhs].value = ge->iy1; ++ ++ if (ge->ix1 < ge->prev->ix3) ++ hs[g->nhs].flags = ST_FLAT | ST_UP; ++ else ++ hs[g->nhs].flags = ST_FLAT; ++ ++ hs[g->nhs].origin = ge->prev->ix3; ++ hs[g->nhs].ge = ge; ++ ++ if (ge->ix1 < ge->prev->ix3) { ++ hs[g->nhs].from = ge->ix1+1; ++ hs[g->nhs].to = ge->prev->ix3; ++ if(hs[g->nhs].from > hs[g->nhs].to) ++ hs[g->nhs].from--; ++ } else { ++ hs[g->nhs].from = ge->prev->ix3; ++ hs[g->nhs].to = ge->ix1-1; ++ if(hs[g->nhs].from > hs[g->nhs].to) ++ hs[g->nhs].to++; ++ } ++ if (ge->ix1 != ge->prev->ix3) ++ g->nhs++; ++ } ++ /* if it is vertical, add a vstem */ ++ else if (ge->ix1 == ge->prev->ix3) { ++ vs[g->nvs].value = ge->ix1; ++ ++ if (ge->iy1 > ge->prev->iy3) ++ vs[g->nvs].flags = ST_FLAT | ST_UP; ++ else ++ vs[g->nvs].flags = ST_FLAT; ++ ++ vs[g->nvs].origin = ge->prev->iy3; ++ vs[g->nvs].ge = ge; ++ ++ if (ge->iy1 < ge->prev->iy3) { ++ vs[g->nvs].from = ge->iy1+1; ++ vs[g->nvs].to = ge->prev->iy3; ++ if(vs[g->nvs].from > vs[g->nvs].to) ++ vs[g->nvs].from--; ++ } else { ++ vs[g->nvs].from = ge->prev->iy3; ++ vs[g->nvs].to = ge->iy1-1; ++ if(vs[g->nvs].from > vs[g->nvs].to) ++ vs[g->nvs].to++; ++ } ++ ++ if (ge->iy1 != ge->prev->iy3) ++ g->nvs++; ++ } ++ /* then check the end of curve */ ++ /* if it is horizontal, add a hstem */ ++ if (ge->iy3 == ge->iy2) { ++ hs[g->nhs].value = ge->iy3; ++ ++ if (ge->ix3 < ge->ix2) ++ hs[g->nhs].flags = ST_FLAT | ST_UP; ++ else ++ hs[g->nhs].flags = ST_FLAT; ++ ++ hs[g->nhs].origin = ge->ix3; ++ hs[g->nhs].ge = ge->frwd; ++ ++ if (ge->ix3 < ge->ix2) { ++ hs[g->nhs].from = ge->ix3; ++ hs[g->nhs].to = ge->ix2-1; ++ if( hs[g->nhs].from > hs[g->nhs].to ) ++ hs[g->nhs].to++; ++ } else { ++ hs[g->nhs].from = ge->ix2+1; ++ hs[g->nhs].to = ge->ix3; ++ if( hs[g->nhs].from > hs[g->nhs].to ) ++ hs[g->nhs].from--; ++ } ++ ++ if (ge->ix3 != ge->ix2) ++ g->nhs++; ++ } ++ /* if it is vertical, add a vstem */ ++ else if (ge->ix3 == ge->ix2) { ++ vs[g->nvs].value = ge->ix3; ++ ++ if (ge->iy3 > ge->iy2) ++ vs[g->nvs].flags = ST_FLAT | ST_UP; ++ else ++ vs[g->nvs].flags = ST_FLAT; ++ ++ vs[g->nvs].origin = ge->iy3; ++ vs[g->nvs].ge = ge->frwd; ++ ++ if (ge->iy3 < ge->iy2) { ++ vs[g->nvs].from = ge->iy3; ++ vs[g->nvs].to = ge->iy2-1; ++ if( vs[g->nvs].from > vs[g->nvs].to ) ++ vs[g->nvs].to++; ++ } else { ++ vs[g->nvs].from = ge->iy2+1; ++ vs[g->nvs].to = ge->iy3; ++ if( vs[g->nvs].from > vs[g->nvs].to ) ++ vs[g->nvs].from--; ++ } ++ ++ if (ge->iy3 != ge->iy2) ++ g->nvs++; ++ } else { ++ ++ /* ++ * check the end of curve for a not smooth ++ * local extremum ++ */ ++ nge = ge->frwd; ++ ++ if (nge == 0) ++ continue; ++ else if (nge->type == GE_LINE) { ++ nx = nge->ix3; ++ ny = nge->iy3; ++ } else if (nge->type == GE_CURVE) { ++ nx = nge->ix1; ++ ny = nge->iy1; ++ } else ++ continue; ++ ++ /* check for vertical extremums */ ++ if ((ge->iy3 > ge->iy2 && ge->iy3 > ny) ++ || (ge->iy3 < ge->iy2 && ge->iy3 < ny)) { ++ hs[g->nhs].value = ge->iy3; ++ hs[g->nhs].from ++ = hs[g->nhs].to ++ = hs[g->nhs].origin = ge->ix3; ++ hs[g->nhs].ge = ge->frwd; ++ ++ if (ge->ix3 < ge->ix2 ++ || nx < ge->ix3) ++ hs[g->nhs].flags = ST_UP; ++ else ++ hs[g->nhs].flags = 0; ++ ++ if (ge->ix3 != ge->ix2 || nx != ge->ix3) ++ g->nhs++; ++ } ++ /* ++ * the same point may be both horizontal and ++ * vertical extremum ++ */ ++ /* check for horizontal extremums */ ++ if ((ge->ix3 > ge->ix2 && ge->ix3 > nx) ++ || (ge->ix3 < ge->ix2 && ge->ix3 < nx)) { ++ vs[g->nvs].value = ge->ix3; ++ vs[g->nvs].from ++ = vs[g->nvs].to ++ = vs[g->nvs].origin = ge->iy3; ++ vs[g->nvs].ge = ge->frwd; ++ ++ if (ge->iy3 > ge->iy2 ++ || ny > ge->iy3) ++ vs[g->nvs].flags = ST_UP; ++ else ++ vs[g->nvs].flags = 0; ++ ++ if (ge->iy3 != ge->iy2 || ny != ge->iy3) ++ g->nvs++; ++ } ++ } ++ ++ } else if (ge->type == GE_LINE) { ++ nge = ge->frwd; ++ ++ /* if it is horizontal, add a hstem */ ++ /* and the ends as vstems if they brace the line */ ++ if (ge->iy3 == ge->prev->iy3 ++ && ge->ix3 != ge->prev->ix3) { ++ hs[g->nhs].value = ge->iy3; ++ if (ge->ix3 < ge->prev->ix3) { ++ hs[g->nhs].flags = ST_FLAT | ST_UP; ++ hs[g->nhs].from = ge->ix3; ++ hs[g->nhs].to = ge->prev->ix3; ++ } else { ++ hs[g->nhs].flags = ST_FLAT; ++ hs[g->nhs].from = ge->prev->ix3; ++ hs[g->nhs].to = ge->ix3; ++ } ++ hs[g->nhs].origin = ge->ix3; ++ hs[g->nhs].ge = ge->frwd; ++ ++ pge = ge->bkwd; ++ ++ /* add beginning as vstem */ ++ vs[g->nvs].value = pge->ix3; ++ vs[g->nvs].origin ++ = vs[g->nvs].from ++ = vs[g->nvs].to = pge->iy3; ++ vs[g->nvs].ge = ge; ++ ++ if(pge->type==GE_CURVE) ++ ovalue=pge->iy2; ++ else ++ ovalue=pge->prev->iy3; ++ ++ if (pge->iy3 > ovalue) ++ vs[g->nvs].flags = ST_UP | ST_END; ++ else if (pge->iy3 < ovalue) ++ vs[g->nvs].flags = ST_END; ++ else ++ vs[g->nvs].flags = 0; ++ ++ if( vs[g->nvs].flags != 0 ) ++ g->nvs++; ++ ++ /* add end as vstem */ ++ vs[g->nvs].value = ge->ix3; ++ vs[g->nvs].origin ++ = vs[g->nvs].from ++ = vs[g->nvs].to = ge->iy3; ++ vs[g->nvs].ge = ge->frwd; ++ ++ if(nge->type==GE_CURVE) ++ ovalue=nge->iy1; ++ else ++ ovalue=nge->iy3; ++ ++ if (ovalue > ge->iy3) ++ vs[g->nvs].flags = ST_UP | ST_END; ++ else if (ovalue < ge->iy3) ++ vs[g->nvs].flags = ST_END; ++ else ++ vs[g->nvs].flags = 0; ++ ++ if( vs[g->nvs].flags != 0 ) ++ g->nvs++; ++ ++ g->nhs++; ++ } ++ /* if it is vertical, add a vstem */ ++ /* and the ends as hstems if they brace the line */ ++ else if (ge->ix3 == ge->prev->ix3 ++ && ge->iy3 != ge->prev->iy3) { ++ vs[g->nvs].value = ge->ix3; ++ if (ge->iy3 > ge->prev->iy3) { ++ vs[g->nvs].flags = ST_FLAT | ST_UP; ++ vs[g->nvs].from = ge->prev->iy3; ++ vs[g->nvs].to = ge->iy3; ++ } else { ++ vs[g->nvs].flags = ST_FLAT; ++ vs[g->nvs].from = ge->iy3; ++ vs[g->nvs].to = ge->prev->iy3; ++ } ++ vs[g->nvs].origin = ge->iy3; ++ vs[g->nvs].ge = ge->frwd; ++ ++ pge = ge->bkwd; ++ ++ /* add beginning as hstem */ ++ hs[g->nhs].value = pge->iy3; ++ hs[g->nhs].origin ++ = hs[g->nhs].from ++ = hs[g->nhs].to = pge->ix3; ++ hs[g->nhs].ge = ge; ++ ++ if(pge->type==GE_CURVE) ++ ovalue=pge->ix2; ++ else ++ ovalue=pge->prev->ix3; ++ ++ if (pge->ix3 < ovalue) ++ hs[g->nhs].flags = ST_UP | ST_END; ++ else if (pge->ix3 > ovalue) ++ hs[g->nhs].flags = ST_END; ++ else ++ hs[g->nhs].flags = 0; ++ ++ if( hs[g->nhs].flags != 0 ) ++ g->nhs++; ++ ++ /* add end as hstem */ ++ hs[g->nhs].value = ge->iy3; ++ hs[g->nhs].origin ++ = hs[g->nhs].from ++ = hs[g->nhs].to = ge->ix3; ++ hs[g->nhs].ge = ge->frwd; ++ ++ if(nge->type==GE_CURVE) ++ ovalue=nge->ix1; ++ else ++ ovalue=nge->ix3; ++ ++ if (ovalue < ge->ix3) ++ hs[g->nhs].flags = ST_UP | ST_END; ++ else if (ovalue > ge->ix3) ++ hs[g->nhs].flags = ST_END; ++ else ++ hs[g->nhs].flags = 0; ++ ++ if( hs[g->nhs].flags != 0 ) ++ g->nhs++; ++ ++ g->nvs++; ++ } ++ /* ++ * check the end of line for a not smooth local ++ * extremum ++ */ ++ nge = ge->frwd; ++ ++ if (nge == 0) ++ continue; ++ else if (nge->type == GE_LINE) { ++ nx = nge->ix3; ++ ny = nge->iy3; ++ } else if (nge->type == GE_CURVE) { ++ nx = nge->ix1; ++ ny = nge->iy1; ++ } else ++ continue; ++ ++ /* check for vertical extremums */ ++ if ((ge->iy3 > ge->prev->iy3 && ge->iy3 > ny) ++ || (ge->iy3 < ge->prev->iy3 && ge->iy3 < ny)) { ++ hs[g->nhs].value = ge->iy3; ++ hs[g->nhs].from ++ = hs[g->nhs].to ++ = hs[g->nhs].origin = ge->ix3; ++ hs[g->nhs].ge = ge->frwd; ++ ++ if (ge->ix3 < ge->prev->ix3 ++ || nx < ge->ix3) ++ hs[g->nhs].flags = ST_UP; ++ else ++ hs[g->nhs].flags = 0; ++ ++ if (ge->ix3 != ge->prev->ix3 || nx != ge->ix3) ++ g->nhs++; ++ } ++ /* ++ * the same point may be both horizontal and vertical ++ * extremum ++ */ ++ /* check for horizontal extremums */ ++ if ((ge->ix3 > ge->prev->ix3 && ge->ix3 > nx) ++ || (ge->ix3 < ge->prev->ix3 && ge->ix3 < nx)) { ++ vs[g->nvs].value = ge->ix3; ++ vs[g->nvs].from ++ = vs[g->nvs].to ++ = vs[g->nvs].origin = ge->iy3; ++ vs[g->nvs].ge = ge->frwd; ++ ++ if (ge->iy3 > ge->prev->iy3 ++ || ny > ge->iy3) ++ vs[g->nvs].flags = ST_UP; ++ else ++ vs[g->nvs].flags = 0; ++ ++ if (ge->iy3 != ge->prev->iy3 || ny != ge->iy3) ++ g->nvs++; ++ } ++ } ++ } ++ ++ g->nhs=addbluestems(hs, g->nhs); ++ sortstems(hs, g->nhs); ++ sortstems(vs, g->nvs); ++ ++ if (ISDBG(STEMS)) ++ debugstems(g->name, hs, g->nhs, vs, g->nvs); ++ ++ /* find the stems interacting with the Blue Zones */ ++ markbluestems(hs, g->nhs); ++ ++ if(subhints) { ++ if (ISDBG(SUBSTEMS)) ++ fprintf(pfa_file, "%% %s: joining subst horizontal stems\n", g->name); ++ joinsubstems(hs, hs_pairs, g->nhs, 1); ++ uniformstems(hs, hs_pairs, g->nhs); ++ ++ if (ISDBG(SUBSTEMS)) ++ fprintf(pfa_file, "%% %s: joining subst vertical stems\n", g->name); ++ joinsubstems(vs, vs_pairs, g->nvs, 0); ++ ++ groupsubstems(g, hs, hs_pairs, g->nhs, vs, vs_pairs, g->nvs); ++ } ++ ++ if (ISDBG(MAINSTEMS)) ++ fprintf(pfa_file, "%% %s: joining main horizontal stems\n", g->name); ++ g->nhs = joinmainstems(hs, g->nhs, 1); ++ if (ISDBG(MAINSTEMS)) ++ fprintf(pfa_file, "%% %s: joining main vertical stems\n", g->name); ++ g->nvs = joinmainstems(vs, g->nvs, 0); ++ ++ if (ISDBG(MAINSTEMS)) ++ debugstems(g->name, hs, g->nhs, vs, g->nvs); ++ ++ if(g->nhs > 0) { ++ if ((sp = malloc(sizeof(STEM) * g->nhs)) == 0) { ++ fprintf(stderr, "**** not enough memory for hints ****\n"); ++ exit(255); ++ } ++ g->hstems = sp; ++ memcpy(sp, hs, sizeof(STEM) * g->nhs); ++ } else ++ g->hstems = 0; ++ ++ if(g->nvs > 0) { ++ if ((sp = malloc(sizeof(STEM) * g->nvs)) == 0) { ++ fprintf(stderr, "**** not enough memory for hints ****\n"); ++ exit(255); ++ } ++ g->vstems = sp; ++ memcpy(sp, vs, sizeof(STEM) * g->nvs); ++ } else ++ g->vstems = 0; ++ ++ /* now check that the stems won't overflow the interpreter's stem stack: ++ * some interpreters (like X11) push the stems on each change into ++ * stack and pop them only after the whole glyphs is completed. ++ */ ++ ++ totals = (g->nhs+g->nvs) / 2; /* we count whole stems, not halves */ ++ lastgrp = -1; ++ ++ for (ge = g->entries; ge != 0; ge = ge->next) { ++ grp=ge->stemid; ++ if(grp >= 0 && grp != lastgrp) { ++ if(grp==0) ++ totals += g->nsbs[0]; ++ else ++ totals += g->nsbs[grp] - g->nsbs[grp-1]; ++ ++ lastgrp = grp; ++ } ++ } ++ ++ /* be on the safe side, check for >= , not > */ ++ if(totals >= max_stemdepth) { /* oops, too deep */ ++ WARNING_2 { ++ fprintf(stderr, "Warning: glyph %s needs hint stack depth %d\n", g->name, totals); ++ fprintf(stderr, " (limit %d): removed the substituted hints from it\n", max_stemdepth); ++ } ++ if(g->nsg > 0) { ++ for (ge = g->entries; ge != 0; ge = ge->next) ++ ge->stemid = -1; ++ free(g->sbstems); g->sbstems = 0; ++ free(g->nsbs); g->nsbs = 0; ++ g->nsg = 0; ++ } ++ } ++ ++ /* now check if there are too many main stems */ ++ totals = (g->nhs+g->nvs) / 2; /* we count whole stems, not halves */ ++ if(totals >= max_stemdepth) { ++ /* even worse, too much of non-substituted stems */ ++ WARNING_2 { ++ fprintf(stderr, "Warning: glyph %s has %d main hints\n", g->name, totals); ++ fprintf(stderr, " (limit %d): removed the hints from it\n", max_stemdepth); ++ } ++ if(g->vstems) { ++ free(g->vstems); g->vstems = 0; g->nvs = 0; ++ } ++ if(g->hstems) { ++ free(g->hstems); g->hstems = 0; g->nhs = 0; ++ } ++ } ++} ++ ++/* convert weird curves that are close to lines into lines. ++*/ ++ ++void ++fstraighten( ++ GLYPH * g ++) ++{ ++ GENTRY *ge, *pge, *nge, *ige; ++ double df; ++ int dir; ++ double iln, oln; ++ int svdir, i, o; ++ ++ for (ige = g->entries; ige != 0; ige = ige->next) { ++ if (ige->type != GE_CURVE) ++ continue; ++ ++ ge = ige; ++ pge = ge->bkwd; ++ nge = ge->frwd; ++ ++ df = 0.; ++ ++ /* look for vertical then horizontal */ ++ for(i=0; i<2; i++) { ++ o = !i; /* other axis */ ++ ++ iln = fabs(ge->fpoints[i][2] - pge->fpoints[i][2]); ++ oln = fabs(ge->fpoints[o][2] - pge->fpoints[o][2]); ++ /* ++ * if current curve is almost a vertical line, and it ++ * doesn't begin or end horizontally (and the prev/next ++ * line doesn't join smoothly ?) ++ */ ++ if( oln < 1. ++ || ge->fpoints[o][2] == ge->fpoints[o][1] ++ || ge->fpoints[o][0] == pge->fpoints[o][2] ++ || iln > 2. ++ || (iln > 1. && iln/oln > 0.1) ) ++ continue; ++ ++ ++ if(ISDBG(STRAIGHTEN)) ++ fprintf(stderr,"** straighten almost %s\n", (i? "horizontal":"vertical")); ++ ++ df = ge->fpoints[i][2] - pge->fpoints[i][2]; ++ dir = fsign(ge->fpoints[o][2] - pge->fpoints[o][2]); ++ ge->type = GE_LINE; ++ ++ /* ++ * suck in all the sequence of such almost lines ++ * going in the same direction but not deviating ++ * too far from vertical ++ */ ++ iln = fabs(nge->fpoints[i][2] - ge->fpoints[i][2]); ++ oln = nge->fpoints[o][2] - ge->fpoints[o][2]; ++ ++ while (fabs(df) <= 5 && nge->type == GE_CURVE ++ && dir == fsign(oln) /* that also gives oln != 0 */ ++ && iln <= 2. ++ && ( iln <= 1. || iln/fabs(oln) <= 0.1 ) ) { ++ ge->fx3 = nge->fx3; ++ ge->fy3 = nge->fy3; ++ ++ if(ISDBG(STRAIGHTEN)) ++ fprintf(stderr,"** straighten collapsing %s\n", (i? "horizontal":"vertical")); ++ freethisge(nge); ++ fixendpath(ge); ++ pge = ge->bkwd; ++ nge = ge->frwd; ++ ++ df = ge->fpoints[i][2] - pge->fpoints[i][2]; ++ ++ iln = fabs(nge->fpoints[i][2] - ge->fpoints[i][2]); ++ oln = nge->fpoints[o][2] - ge->fpoints[o][2]; ++ } ++ ++ /* now check what do we have as previous/next line */ ++ ++ if(ge != pge) { ++ if( pge->type == GE_LINE && pge->fpoints[i][2] == pge->prev->fpoints[i][2] ++ && fabs(pge->fpoints[o][2] != pge->prev->fpoints[o][2]) ) { ++ if(ISDBG(STRAIGHTEN)) fprintf(stderr,"** straighten join with previous 0x%x 0x%x\n", pge, ge); ++ /* join the previous line with current */ ++ pge->fx3 = ge->fx3; ++ pge->fy3 = ge->fy3; ++ ++ ige = freethisge(ge)->prev; /* keep the iterator valid */ ++ ge = pge; ++ fixendpath(ge); ++ pge = ge->bkwd; ++ } ++ } ++ ++ if(ge != nge) { ++ if (nge->type == GE_LINE && nge->fpoints[i][2] == ge->fpoints[i][2] ++ && fabs(nge->fpoints[o][2] != ge->fpoints[o][2]) ) { ++ if(ISDBG(STRAIGHTEN)) fprintf(stderr,"** straighten join with next 0x%x 0x%x\n", ge, nge); ++ /* join the next line with current */ ++ ge->fx3 = nge->fx3; ++ ge->fy3 = nge->fy3; ++ ++ freethisge(nge); ++ fixendpath(ge); ++ pge = ge->bkwd; ++ nge = ge->frwd; ++ ++ } ++ } ++ ++ if(ge != pge) { ++ /* try to align the lines if neccessary */ ++ if(df != 0.) ++ fclosegap(ge, ge, i, df, NULL); ++ } else { ++ /* contour consists of only one line, get rid of it */ ++ ige = freethisge(ge); /* keep the iterator valid */ ++ if(ige == 0) /* this was the last contour */ ++ return; ++ ige = ige->prev; ++ } ++ ++ break; /* don't bother looking at the other axis */ ++ } ++ } ++} ++ ++/* solve a square equation, ++ * returns the number of solutions found, the solutions ++ * are stored in res which should point to array of two doubles. ++ * min and max limit the area for solutions ++ */ ++ ++static int ++fsqequation( ++ double a, ++ double b, ++ double c, ++ double *res, ++ double min, ++ double max ++) ++{ ++ double D; ++ int n; ++ ++ if(ISDBG(SQEQ)) fprintf(stderr, "sqeq(%g,%g,%g) [%g;%g]\n", a, b, c, min, max); ++ ++ if(fabs(a) < 0.000001) { /* if a linear equation */ ++ n=0; ++ if(fabs(b) < 0.000001) /* not an equation at all */ ++ return 0; ++ res[0] = -c/b; ++ if(ISDBG(SQEQ)) fprintf(stderr, "sqeq: linear t=%g\n", res[0]); ++ if(res[0] >= min && res[0] <= max) ++ n++; ++ return n; ++ } ++ ++ D = b*b - 4.0*a*c; ++ if(ISDBG(SQEQ)) fprintf(stderr, "sqeq: D=%g\n", D); ++ if(D<0) ++ return 0; ++ ++ D = sqrt(D); ++ ++ n=0; ++ res[0] = (-b+D) / (2*a); ++ if(ISDBG(SQEQ)) fprintf(stderr, "sqeq: t1=%g\n", res[0]); ++ if(res[0] >= min && res[0] <= max) ++ n++; ++ ++ res[n] = (-b-D) / (2*a); ++ if(ISDBG(SQEQ)) fprintf(stderr, "sqeq: t2=%g\n", res[n]); ++ if(res[n] >= min && res[n] <= max) ++ n++; ++ ++ /* return 2nd solution only if it's different enough */ ++ if(n==2 && fabs(res[0]-res[1])<0.000001) ++ n=1; ++ ++ return n; ++} ++ ++/* check that the curves don't cross quadrant boundary */ ++/* (float) */ ++ ++/* ++ Here we make sure that the curve does not continue past ++ horizontal or vertical extremums. The horizontal points are ++ explained, vertical points are by analogy. ++ ++ The horizontal points are where the derivative ++ dy/dx is equal to 0. But the Bezier curves are defined by ++ parametric formulas ++ x=fx(t) ++ y=fy(t) ++ so finding this derivative is complicated. ++ Also even if we find some point (x,y) splitting at this point ++ is far not obvious. Fortunately we can use dy/dt = 0 instead, ++ this gets to a rather simple square equation and splitting ++ at a known value of t is simple. ++ ++ The formulas are: ++ ++ y = A*(1-t)^3 + 3*B*(1-t)^2*t + 3*C*(1-t)*t^2 + D*t^3 ++ y = (-A+3*B-3*C+D)*t^3 + (3*A-6*B+3*C)*t^2 + (-3*A+3*B)*t + A ++ dy/dt = 3*(-A+3*B-3*C+D)*t^2 + 2*(3*A-6*B+3*C)*t + (-3*A+3*B) ++ */ ++ ++void ++ffixquadrants( ++ GLYPH *g ++) ++{ ++ GENTRY *ge, *nge; ++ int i, j, np, oldnp; ++ double sp[5]; /* split points, last one empty */ ++ char dir[5]; /* for debugging, direction by which split happened */ ++ double a, b, *pts; /* points of a curve */ ++ ++ for (ge = g->entries; ge != 0; ge = ge->next) { ++ if (ge->type != GE_CURVE) ++ continue; ++ ++ doagain: ++ np = 0; /* no split points yet */ ++ if(ISDBG(QUAD)) { ++ fprintf(stderr, "%s: trying 0x%x (%g %g) (%g %g) (%g %g) (%g %g)\n ", g->name, ++ ge, ge->prev->fx3, ge->prev->fy3, ge->fx1, ge->fy1, ge->fx2, ge->fy2, ++ ge->fx3, ge->fy3); ++ } ++ for(i=0; i<2; i++) { /* first for x then for y */ ++ /* find the cooridnates of control points */ ++ a = ge->prev->fpoints[i][2]; ++ pts = &ge->fpoints[i][0]; ++ ++ oldnp = np; ++ np += fsqequation( ++ 3.0*(-a + 3.0*pts[0] - 3.0*pts[1] + pts[2]), ++ 6.0*(a - 2.0*pts[0] + pts[1]), ++ 3.0*(-a + pts[0]), ++ &sp[np], ++ 0.0, 1.0); /* XXX range is [0;1] */ ++ ++ if(np == oldnp) ++ continue; ++ ++ if(ISDBG(QUAD)) ++ fprintf(stderr, "%s: 0x%x: %d pts(%c): ", ++ g->name, ge, np-oldnp, i? 'y':'x'); ++ ++ /* remove points that are too close to the ends ++ * because hor/vert ends are permitted, also ++ * if the split point is VERY close to the ends ++ * but not exactly then just flatten it and check again. ++ */ ++ for(j = oldnp; jfpoints[i][0] != ge->prev->fpoints[i][2]) { ++ ge->fpoints[i][0] = ge->prev->fpoints[i][2]; ++ if(ISDBG(QUAD)) fprintf(stderr, "flattened at front\n"); ++ goto doagain; ++ } ++ if( ge->fpoints[i][1] != ge->fpoints[i][0] ++ && fsign(ge->fpoints[i][2] - ge->fpoints[i][1]) ++ != fsign(ge->fpoints[i][1] - ge->fpoints[i][0]) ) { ++ ge->fpoints[i][1] = ge->fpoints[i][0]; ++ if(ISDBG(QUAD)) fprintf(stderr, "flattened zigzag at front\n"); ++ goto doagain; ++ } ++ sp[j] = sp[j+1]; np--; j--; ++ if(ISDBG(QUAD)) fprintf(stderr, "(front flat) "); ++ } else if(sp[j] > 0.97) { /* rear end of curve */ ++ if(ge->fpoints[i][1] != ge->fpoints[i][2]) { ++ ge->fpoints[i][1] = ge->fpoints[i][2]; ++ if(ISDBG(QUAD)) fprintf(stderr, "flattened at rear\n"); ++ goto doagain; ++ } ++ if( ge->fpoints[i][0] != ge->fpoints[i][1] ++ && fsign(ge->prev->fpoints[i][2] - ge->fpoints[i][0]) ++ != fsign(ge->fpoints[i][0] - ge->fpoints[i][1]) ) { ++ ge->fpoints[i][0] = ge->fpoints[i][1]; ++ if(ISDBG(QUAD)) fprintf(stderr, "flattened zigzag at rear\n"); ++ goto doagain; ++ } ++ sp[j] = sp[j+1]; np--; j--; ++ if(ISDBG(QUAD)) fprintf(stderr, "(rear flat) "); ++ } ++ } ++ if(ISDBG(QUAD)) fprintf(stderr, "\n"); ++ } ++ ++ if(np==0) /* no split points, leave it alone */ ++ continue; ++ ++ if(ISDBG(QUAD)) { ++ fprintf(stderr, "%s: splitting 0x%x (%g %g) (%g %g) (%g %g) (%g %g) at %d points\n ", g->name, ++ ge, ge->prev->fx3, ge->prev->fy3, ge->fx1, ge->fy1, ge->fx2, ge->fy2, ++ ge->fx3, ge->fy3, np); ++ for(i=0; i sp[j]) { ++ a = sp[i]; sp[i] = sp[j]; sp[j] = a; ++ } ++ ++ /* now finally do the split on each point */ ++ for(j=0; jfpoints[i][0]; /* get the middle points */ ++ b = ge->fpoints[i][1]; ++ ++ /* calculate new internal points */ ++ c = SPLIT(a, b); ++ ++ ge->fpoints[i][0] = SPLIT(ge->prev->fpoints[i][2], a); ++ ge->fpoints[i][1] = SPLIT(ge->fpoints[i][0], c); ++ ++ nge->fpoints[i][1] = SPLIT(b, nge->fpoints[i][2]); ++ nge->fpoints[i][0] = SPLIT(c, nge->fpoints[i][1]); ++ ++ ge->fpoints[i][2] = SPLIT(ge->fpoints[i][1], ++ + nge->fpoints[i][0]); ++ } ++#undef SPLIT ++ ++ addgeafter(ge, nge); ++ ++ /* go to the next part, adjust remaining points */ ++ ge = nge; ++ for(i=j+1; itype != GE_CURVE) ++ return 0; ++ ++ a = ge->iy2 - ge->iy1; ++ b = ge->ix2 - ge->ix1; ++ if(a == 0) { ++ if(b == 0) { ++ return 0; ++ } else ++ k = FBIGVAL; ++ } else ++ k = fabs((double) b / (double) a); ++ ++ a = ge->iy1 - ge->prev->iy3; ++ b = ge->ix1 - ge->prev->ix3; ++ if(a == 0) { ++ if(b == 0) { ++ return 0; ++ } else ++ k1 = FBIGVAL; ++ } else ++ k1 = fabs((double) b / (double) a); ++ ++ a = ge->iy3 - ge->iy2; ++ b = ge->ix3 - ge->ix2; ++ if(a == 0) { ++ if(b == 0) { ++ return 0; ++ } else ++ k2 = FBIGVAL; ++ } else ++ k2 = fabs((double) b / (double) a); ++ ++ /* if the curve is not a zigzag */ ++ if ((k1+0.0001 >= k && k2 <= k+0.0001) || (k1 <= k+0.0001 && k2+0.0001 >= k)) ++ return 0; ++ else ++ return 1; ++} ++ ++/* check if a curve is a zigzag - floating */ ++ ++static int ++fiszigzag( ++ GENTRY *ge ++) ++{ ++ double k, k1, k2; ++ double a, b; ++ ++ if (ge->type != GE_CURVE) ++ return 0; ++ ++ a = fabs(ge->fy2 - ge->fy1); ++ b = fabs(ge->fx2 - ge->fx1); ++ if(a < FEPS) { ++ if(b < FEPS) { ++ return 0; ++ } else ++ k = FBIGVAL; ++ } else ++ k = b / a; ++ ++ a = fabs(ge->fy1 - ge->prev->fy3); ++ b = fabs(ge->fx1 - ge->prev->fx3); ++ if(a < FEPS) { ++ if(b < FEPS) { ++ return 0; ++ } else ++ k1 = FBIGVAL; ++ } else ++ k1 = b / a; ++ ++ a = fabs(ge->fy3 - ge->fy2); ++ b = fabs(ge->fx3 - ge->fx2); ++ if(a < FEPS) { ++ if(b < FEPS) { ++ return 0; ++ } else ++ k2 = FBIGVAL; ++ } else ++ k2 = b / a; ++ ++ /* if the curve is not a zigzag */ ++ if ((k1+0.0001 >= k && k2 <= k+0.0001) || (k1 <= k+0.0001 && k2+0.0001 >= k)) ++ return 0; ++ else ++ return 1; ++} ++ ++/* split the zigzag-like curves into two parts */ ++ ++void ++fsplitzigzags( ++ GLYPH * g ++) ++{ ++ GENTRY *ge, *nge; ++ double a, b, c, d; ++ ++ assertisfloat(g, "splitting zigzags"); ++ for (ge = g->entries; ge != 0; ge = ge->next) { ++ if (ge->type != GE_CURVE) ++ continue; ++ ++ /* if the curve is not a zigzag */ ++ if ( !fiszigzag(ge) ) { ++ continue; ++ } ++ ++ if(ISDBG(FCONCISE)) { ++ double maxsc1, maxsc2; ++ fprintf(stderr, "split a zigzag "); ++ fnormalizege(ge); ++ if( fcrossraysge(ge, ge, &maxsc1, &maxsc2, NULL) ) { ++ fprintf(stderr, "sc1=%g sc2=%g\n", maxsc1, maxsc2); ++ } else { ++ fprintf(stderr, "(rays don't cross)\n"); ++ } ++ } ++ /* split the curve by t=0.5 */ ++ nge = newgentry(GEF_FLOAT); ++ (*nge) = (*ge); ++ nge->type = GE_CURVE; ++ ++ a = ge->prev->fx3; ++ b = ge->fx1; ++ c = ge->fx2; ++ d = ge->fx3; ++ nge->fx3 = d; ++ nge->fx2 = (c + d) / 2.; ++ nge->fx1 = (b + 2. * c + d) / 4.; ++ ge->fx3 = (a + b * 3. + c * 3. + d) / 8.; ++ ge->fx2 = (a + 2. * b + c) / 4.; ++ ge->fx1 = (a + b) / 2.; ++ ++ a = ge->prev->fy3; ++ b = ge->fy1; ++ c = ge->fy2; ++ d = ge->fy3; ++ nge->fy3 = d; ++ nge->fy2 = (c + d) / 2.; ++ nge->fy1 = (b + 2. * c + d) / 4.; ++ ge->fy3 = (a + b * 3. + c * 3. + d) / 8.; ++ ge->fy2 = (a + 2. * b + c) / 4.; ++ ge->fy1 = (a + b) / 2.; ++ ++ addgeafter(ge, nge); ++ ++ if(ISDBG(FCONCISE)) { ++ dumppaths(g, ge, nge); ++ } ++ } ++} ++ ++/* free this GENTRY, returns what was ge->next ++ * (ge must be of type GE_LINE or GE_CURVE) ++ * works on both float and int entries ++ */ ++ ++static GENTRY * ++freethisge( ++ GENTRY *ge ++) ++{ ++ GENTRY *xge; ++ ++ if (ge->bkwd != ge->prev) { ++ /* at beginning of the contour */ ++ ++ xge = ge->bkwd; ++ if(xge == ge) { /* was the only line in contour */ ++ /* remove the contour completely */ ++ /* prev is GE_MOVE, next is GE_PATH, remove them all */ ++ ++ /* may be the first contour, then ->bkwd points to ge->entries */ ++ if(ge->prev->prev == 0) ++ *(GENTRY **)(ge->prev->bkwd) = ge->next->next; ++ else ++ ge->prev->prev->next = ge->next->next; ++ ++ if(ge->next->next) { ++ ge->next->next->prev = ge->prev->prev; ++ ge->next->next->bkwd = ge->prev->bkwd; ++ } ++ ++ xge = ge->next->next; ++ free(ge->prev); free(ge->next); free(ge); ++ return xge; ++ } ++ ++ /* move the start point of the contour */ ++ if(ge->flags & GEF_FLOAT) { ++ ge->prev->fx3 = xge->fx3; ++ ge->prev->fy3 = xge->fy3; ++ } else { ++ ge->prev->ix3 = xge->ix3; ++ ge->prev->iy3 = xge->iy3; ++ } ++ } else if(ge->frwd != ge->next) { ++ /* at end of the contour */ ++ ++ xge = ge->frwd->prev; ++ /* move the start point of the contour */ ++ if(ge->flags & GEF_FLOAT) { ++ xge->fx3 = ge->bkwd->fx3; ++ xge->fy3 = ge->bkwd->fy3; ++ } else { ++ xge->ix3 = ge->bkwd->ix3; ++ xge->iy3 = ge->bkwd->iy3; ++ } ++ } ++ ++ ge->prev->next = ge->next; ++ ge->next->prev = ge->prev; ++ ge->bkwd->frwd = ge->frwd; ++ ge->frwd->bkwd = ge->bkwd; ++ ++ xge = ge->next; ++ free(ge); ++ return xge; ++} ++ ++/* inserts a new gentry (LINE or CURVE) after another (MOVE ++ * or LINE or CURVE) ++ * corrects the first GE_MOVE if neccessary ++ */ ++ ++static void ++addgeafter( ++ GENTRY *oge, /* after this */ ++ GENTRY *nge /* insert this */ ++) ++{ ++ if(oge->type == GE_MOVE) { ++ /* insert before next */ ++ if(oge->next->type == GE_PATH) { ++ /* first and only GENTRY in path */ ++ nge->frwd = nge->bkwd = nge; ++ } else { ++ nge->frwd = oge->next; ++ nge->bkwd = oge->next->bkwd; ++ oge->next->bkwd->frwd = nge; ++ oge->next->bkwd = nge; ++ } ++ } else { ++ nge->frwd = oge->frwd; ++ nge->bkwd = oge; ++ oge->frwd->bkwd = nge; ++ oge->frwd = nge; ++ } ++ ++ nge->next = oge->next; ++ nge->prev = oge; ++ oge->next->prev = nge; ++ oge->next = nge; ++ ++ if(nge->frwd->prev->type == GE_MOVE) { ++ /* fix up the GE_MOVE entry */ ++ if(nge->flags & GEF_FLOAT) { ++ nge->frwd->prev->fx3 = nge->fx3; ++ nge->frwd->prev->fy3 = nge->fy3; ++ } else { ++ nge->frwd->prev->ix3 = nge->ix3; ++ nge->frwd->prev->iy3 = nge->iy3; ++ } ++ } ++} ++ ++/* ++ * Check if this GENTRY happens to be at the end of path ++ * and fix the first MOVETO accordingly ++ * handles both int and float ++ */ ++ ++static void ++fixendpath( ++ GENTRY *ge ++) ++{ ++ GENTRY *mge; ++ ++ mge = ge->frwd->prev; ++ if(mge->type == GE_MOVE) { ++ if(ge->flags & GEF_FLOAT) { ++ mge->fx3 = ge->fx3; ++ mge->fy3 = ge->fy3; ++ } else { ++ mge->ix3 = ge->ix3; ++ mge->iy3 = ge->iy3; ++ } ++ } ++} ++ ++/* ++ * This function adjusts the rest of path (the part from...to is NOT changed) ++ * to cover the specified gap by the specified axis (0 - X, 1 - Y). ++ * Gap is counted in direction (end_of_to - beginning_of_from). ++ * Returns by how much the gap was not closed (0.0 if it was fully closed). ++ * Ret contains by how much the first and last points of [from...to] ++ * were moved to bring them in consistence to the rest of the path. ++ * If ret==NULL then this info is not returned. ++ */ ++ ++static double ++fclosegap( ++ GENTRY *from, ++ GENTRY *to, ++ int axis, ++ double gap, ++ double *ret ++) ++{ ++#define TIMESLARGER 10. /* how many times larger must be a curve to not change too much */ ++ double rm[2]; ++ double oldpos[2]; ++ double times, limit, df, dx; ++ int j, k; ++ GENTRY *xge, *pge, *nge, *bge[2]; ++ ++ /* remember the old points to calculate ret */ ++ oldpos[0] = from->prev->fpoints[axis][2]; ++ oldpos[1] = to->fpoints[axis][2]; ++ ++ rm[0] = rm[1] = gap / 2. ; ++ ++ bge[0] = from; /* this is convenient for iterations */ ++ bge[1] = to; ++ ++ /* first try to modify large curves but if have none then settle for small */ ++ for(times = (TIMESLARGER-1); times > 0.1; times /= 2. ) { ++ ++ if(rm[0]+rm[1] == 0.) ++ break; ++ ++ /* iterate in both directions, backwards then forwards */ ++ for(j = 0; j<2; j++) { ++ ++ if(rm[j] == 0.) /* if this direction is exhausted */ ++ continue; ++ ++ limit = fabs(rm[j]) * (1.+times); ++ ++ for(xge = bge[j]->cntr[j]; xge != bge[!j]; xge = xge->cntr[j]) { ++ dx = xge->fpoints[axis][2] - xge->prev->fpoints[axis][2]; ++ df = fabs(dx) - limit; ++ if( df <= FEPS ) /* curve is too small to change */ ++ continue; ++ ++ if( df >= fabs(rm[j]) ) ++ df = rm[j]; ++ else ++ df *= fsign(rm[j]); /* we may cover this part of rm */ ++ ++ rm[j] -= df; ++ limit = fabs(rm[j]) * (1.+times); ++ ++ if(xge->type == GE_CURVE) { /* correct internal points */ ++ double scale = ((dx+df) / dx) - 1.; ++ double base; ++ ++ if(j) ++ base = xge->fpoints[axis][2]; ++ else ++ base = xge->prev->fpoints[axis][2]; ++ ++ for(k = 0; k<2; k++) ++ xge->fpoints[axis][k] += scale * ++ (xge->fpoints[axis][k] - base); ++ } ++ ++ /* move all the intermediate lines */ ++ if(j) { ++ df = -df; /* absolute direction */ ++ pge = bge[1]->bkwd; ++ nge = xge->bkwd; ++ } else { ++ xge->fpoints[axis][2] += df; ++ pge = bge[0]; ++ nge = xge->frwd; ++ } ++ while(nge != pge) { ++ if(nge->type == GE_CURVE) { ++ nge->fpoints[axis][0] +=df; ++ nge->fpoints[axis][1] +=df; ++ } ++ nge->fpoints[axis][2] += df; ++ if(nge->next != nge->frwd) { /* last entry of contour */ ++ nge->frwd->prev->fpoints[axis][2] += df; ++ } ++ nge = nge->cntr[!j]; ++ } ++ ++ if(rm[j] == 0.) ++ break; ++ } ++ } ++ } ++ ++ /* find the difference */ ++ oldpos[0] -= from->prev->fpoints[axis][2]; ++ oldpos[1] -= to->fpoints[axis][2]; ++ ++ if(ret) { ++ ret[0] = oldpos[0] - from->prev->fpoints[axis][2]; ++ ret[1] = oldpos[1] - to->fpoints[axis][2]; ++ } ++ ++#if 0 ++ if( rm[0]+rm[1] != gap - oldpos[1] + oldpos[0]) { ++ fprintf(stderr, "** gap=%g rm[0]=%g rm[1]=%g o[0]=%g o[1]=%g rg=%g og=%g\n", ++ gap, rm[0], rm[1], oldpos[0], oldpos[1], rm[0]+rm[1], ++ gap - oldpos[1] + oldpos[0]); ++ } ++#endif ++ ++ return rm[0]+rm[1]; ++#undef TIMESLARGER ++} ++ ++/* remove the lines or curves smaller or equal to the size limit */ ++ ++static void ++fdelsmall( ++ GLYPH *g, ++ double minlen ++) ++{ ++ GENTRY *ge, *nge, *pge, *xge, *next; ++ int i, k; ++ double dx, dy, d2, d2m; ++ double minlen2; ++#define TIMESLARGER 10. /* how much larger must be a curve to not change too much */ ++ ++ minlen2 = minlen*minlen; ++ ++ for (ge = g->entries; ge != 0; ge = next) { ++ next = ge->next; ++ ++ if (ge->type != GE_CURVE && ge->type != GE_LINE) ++ continue; ++ ++ d2m = 0; ++ for(i= (ge->type==GE_CURVE? 0: 2); i<3; i++) { ++ dx = ge->fxn[i] - ge->prev->fx3; ++ dy = ge->fyn[i] - ge->prev->fy3; ++ d2 = dx*dx + dy*dy; ++ if(d2m < d2) ++ d2m = d2; ++ } ++ ++ if( d2m > minlen2 ) { /* line is not too small */ ++ /* XXX add more normalization here */ ++ continue; ++ } ++ ++ /* if the line is too small */ ++ ++ /* check forwards if we have a whole sequence of them */ ++ nge = ge; ++ for(xge = ge->frwd; xge != ge; xge = xge->frwd) { ++ d2m = 0; ++ for(i= (xge->type==GE_CURVE? 0: 2); i<3; i++) { ++ dx = xge->fxn[i] - xge->prev->fx3; ++ dy = xge->fyn[i] - xge->prev->fy3; ++ d2 = dx*dx + dy*dy; ++ if(d2m < d2) ++ d2m = d2; ++ } ++ if( d2m > minlen2 ) /* line is not too small */ ++ break; ++ nge = xge; ++ if(next == nge) /* move the next step past this sequence */ ++ next = next->next; ++ } ++ ++ /* check backwards if we have a whole sequence of them */ ++ pge = ge; ++ for(xge = ge->bkwd; xge != ge; xge = xge->bkwd) { ++ d2m = 0; ++ for(i= (xge->type==GE_CURVE? 0: 2); i<3; i++) { ++ dx = xge->fxn[i] - xge->prev->fx3; ++ dy = xge->fyn[i] - xge->prev->fy3; ++ d2 = dx*dx + dy*dy; ++ if(d2m < d2) ++ d2m = d2; ++ } ++ if( d2m > minlen2 ) /* line is not too small */ ++ break; ++ pge = xge; ++ } ++ ++ /* now we have a sequence of small fragments in pge...nge (inclusive) */ ++ ++ if(ISDBG(FCONCISE)) { ++ fprintf(stderr, "glyph %s has very small fragments(%x..%x..%x)\n", ++ g->name, pge, ge, nge); ++ dumppaths(g, pge, nge); ++ } ++ ++ /* reduce whole sequence to one part and remember the middle point */ ++ if(pge != nge) { ++ while(1) { ++ xge = pge->frwd; ++ if(xge == nge) { ++ pge->fx1 = pge->fx2 = pge->fx3; ++ pge->fx3 = nge->fx3; ++ pge->fy1 = pge->fy2 = pge->fy3; ++ pge->fy3 = nge->fy3; ++ pge->type = GE_CURVE; ++ freethisge(nge); ++ break; ++ } ++ if(xge == nge->bkwd) { ++ pge->fx1 = pge->fx2 = (pge->fx3+xge->fx3)/2.; ++ pge->fx3 = nge->fx3; ++ pge->fy1 = pge->fy2 = (pge->fy3+xge->fy3)/2.; ++ pge->fy3 = nge->fy3; ++ pge->type = GE_CURVE; ++ freethisge(nge); ++ freethisge(xge); ++ break; ++ } ++ freethisge(pge); pge = xge; ++ xge = nge->bkwd; freethisge(nge); nge = xge; ++ } ++ } ++ ge = pge; ++ ++ /* check if the whole sequence is small */ ++ dx = ge->fx3 - ge->prev->fx3; ++ dy = ge->fy3 - ge->prev->fy3; ++ d2 = dx*dx + dy*dy; ++ ++ if( d2 > minlen2 ) { /* no, it is not */ ++ double b, d; ++ ++ WARNING_3 fprintf(stderr, "glyph %s had a sequence of fragments < %g points each, reduced to one curve\n", ++ g->name, minlen); ++ ++ /* check that we did not create a monstrosity spanning quadrants */ ++ if(fsign(ge->fx1 - ge->prev->fx1) * fsign(ge->fx3 - ge->fx1) < 0 ++ || fsign(ge->fy1 - ge->prev->fy1) * fsign(ge->fy3 - ge->fy1) < 0 ) { ++ /* yes, we did; are both parts of this thing big enough ? */ ++ dx = ge->fx1 - ge->prev->fx3; ++ dy = ge->fy1 - ge->prev->fy3; ++ d2 = dx*dx + dy*dy; ++ ++ dx = ge->fx3 - ge->fx1; ++ dy = ge->fy3 - ge->fy1; ++ d2m = dx*dx + dy*dy; ++ ++ if(d2 > minlen2 && d2m > minlen2) { /* make two straights */ ++ nge = newgentry(GEF_FLOAT); ++ *nge = *ge; ++ ++ for(i=0; i<2; i++) { ++ ge->fpoints[i][2] = ge->fpoints[i][0]; ++ b = nge->fpoints[i][0]; ++ d = nge->fpoints[i][2] - b; ++ nge->fpoints[i][0] = b + 0.1*d; ++ nge->fpoints[i][1] = b + 0.9*d; ++ } ++ } ++ for(i=0; i<2; i++) { /* make one straight or first of two straights */ ++ b = ge->prev->fpoints[i][2]; ++ d = ge->fpoints[i][2] - b; ++ ge->fpoints[i][0] = b + 0.1*d; ++ ge->fpoints[i][1] = b + 0.9*d; ++ } ++ } ++ continue; ++ } ++ ++ if(ge->frwd == ge) { /* points to itself, just remove the path completely */ ++ WARNING_3 fprintf(stderr, "glyph %s had a path made of fragments < %g points each, removed\n", ++ g->name, minlen); ++ ++ next = freethisge(ge); ++ continue; ++ } ++ ++ /* now close the gap by x and y */ ++ for(i=0; i<2; i++) { ++ double gap; ++ ++ gap = ge->fpoints[i][2] - ge->prev->fpoints[i][2]; ++ if( fclosegap(ge, ge, i, gap, NULL) != 0.0 ) { ++ double scale, base; ++ ++ /* not good, as the last resort just scale the next line */ ++ gap = ge->fpoints[i][2] - ge->prev->fpoints[i][2]; ++ ++ if(ISDBG(FCONCISE)) ++ fprintf(stderr, " last resort on %c: closing next by %g\n", ++ (i==0 ? 'x' : 'y'), gap); ++ ++ nge = ge->frwd; ++ base = nge->fpoints[i][2]; ++ dx = ge->fpoints[i][2] - base; ++ if(fabs(dx) < FEPS) ++ continue; ++ ++ scale = ((dx-gap) / dx); ++ ++ if(nge->type == GE_CURVE) ++ for(k = 0; k<2; k++) ++ nge->fpoints[i][k] = base + ++ scale * (nge->fpoints[i][k] - base); ++ ++ ge->fpoints[i][2] -= gap; ++ } ++ } ++ ++ /* OK, the gap is closed - remove this useless GENTRY */ ++ freethisge(ge); ++ } ++#undef TIMESLARGER ++} ++ ++/* find the point where two rays continuing vectors cross ++ * returns 1 if they cross, 0 if they don't ++ * If they cross optionally (if the pointers are not NULL) returns ++ * the maximal scales for both vectors and also optionally the point ++ * where the rays cross (twice). ++ * Expects that the curves are normalized. ++ * ++ * For convenience there are 2 front-end functions taking ++ * arguments in different formats ++ */ ++ ++struct ray { ++ double x1, y1, x2, y2; ++ int isvert; ++ double k, b; /* lines are represented as y = k*x + b */ ++ double *maxp; ++}; ++static struct ray ray[3]; ++ ++/* the back-end doing the actual work ++ * the rays are defined in the static array ray[] ++ */ ++ ++static int ++fcrossraysxx( ++ double crossdot[2][2] ++) ++{ ++ double x, y, max; ++ int i; ++ ++ for(i=0; i<2; i++) { ++ if(ray[i].x1 == ray[i].x2) ++ ray[i].isvert = 1; ++ else { ++ ray[i].isvert = 0; ++ ray[i].k = (ray[i].y2 - ray[i].y1) / (ray[i].x2 - ray[i].x1); ++ ray[i].b = ray[i].y2 - ray[i].k * ray[i].x2; ++ } ++ } ++ ++ if(ray[0].isvert && ray[1].isvert) { ++ if(ISDBG(FCONCISE)) fprintf(stderr, "crossrays: both vertical\n"); ++ return 0; /* both vertical, don't cross */ ++ } ++ ++ if(ray[1].isvert) { ++ ray[2] = ray[0]; /* exchange them */ ++ ray[0] = ray[1]; ++ ray[1] = ray[2]; ++ } ++ ++ if(ray[0].isvert) { ++ x = ray[0].x1; ++ } else { ++ if( fabs(ray[0].k - ray[1].k) < FEPS) { ++ if(ISDBG(FCONCISE)) fprintf(stderr, "crossrays: parallel lines, k = %g, %g\n", ++ ray[0].k, ray[1].k); ++ return 0; /* parallel lines */ ++ } ++ x = (ray[1].b - ray[0].b) / (ray[0].k - ray[1].k) ; ++ } ++ y = ray[1].k * x + ray[1].b; ++ ++ for(i=0; i<2; i++) { ++ if(ray[i].isvert) ++ max = (y - ray[i].y1) / (ray[i].y2 - ray[i].y1); ++ else ++ max = (x - ray[i].x1) / (ray[i].x2 - ray[i].x1); ++ /* check if wrong sides of rays cross */ ++ if( max < 0 ) { ++ if(ISDBG(FCONCISE)) fprintf(stderr, "crossrays: %c scale=%g @(%g,%g) (%g,%g)<-(%g,%g)\n", ++ (i?'Y':'X'), max, x, y, ray[i].x2, ray[i].y2, ray[i].x1, ray[i].y1); ++ return 0; ++ } ++ if(ray[i].maxp) ++ *ray[i].maxp = max; ++ } ++ if(crossdot != 0) { ++ crossdot[0][0] = crossdot[1][0] = x; ++ crossdot[0][1] = crossdot[1][1] = y; ++ } ++ return 1; ++} ++ ++/* the front-end getting the arguments from 4 dots defining ++ * a curve in the same format as for fapproxcurve(): ++ * rays are defined as beginning and end of the curve, ++ * the crossdot is inserted as the two middle dots of the curve ++ */ ++ ++int ++fcrossrayscv( ++ double curve[4][2 /*X,Y*/], ++ double *max1, ++ double *max2 ++) ++{ ++ ray[0].x1 = curve[0][X]; ++ ray[0].y1 = curve[0][Y]; ++ ray[0].x2 = curve[1][X]; ++ ray[0].y2 = curve[1][Y]; ++ ray[0].maxp = max1; ++ ++ ray[1].x1 = curve[2][X]; ++ ray[1].y1 = curve[2][Y]; ++ ray[1].x2 = curve[3][X]; ++ ray[1].y2 = curve[3][Y]; ++ ray[1].maxp = max2; ++ ++ return fcrossraysxx(&curve[1]); ++} ++ ++/* the front-end getting the arguments from gentries: ++ * rays are defined as beginning of curve1 and end of curve 2 ++ */ ++ ++int ++fcrossraysge( ++ GENTRY *ge1, ++ GENTRY *ge2, ++ double *max1, ++ double *max2, ++ double crossdot[2][2] ++) ++{ ++ ray[0].x1 = ge1->prev->fx3; ++ ray[0].y1 = ge1->prev->fy3; ++ ray[0].x2 = ge1->fpoints[X][ge1->ftg]; ++ ray[0].y2 = ge1->fpoints[Y][ge1->ftg]; ++ ray[0].maxp = max1; ++ ++ ray[1].x1 = ge2->fx3; ++ ray[1].y1 = ge2->fy3; ++ if(ge2->rtg < 0) { ++ ray[1].x2 = ge2->prev->fx3; ++ ray[1].y2 = ge2->prev->fy3; ++ } else { ++ ray[1].x2 = ge2->fpoints[X][ge2->rtg]; ++ ray[1].y2 = ge2->fpoints[Y][ge2->rtg]; ++ } ++ ray[1].maxp = max2; ++ ++ return fcrossraysxx(crossdot); ++} ++ ++/* debugging printout functions */ ++ ++#if defined(DEBUG_DOTSEG) || defined(DEBUG_DOTCURVE) || defined(DEBUG_APPROXCV) ++ ++/* for debugging */ ++static ++printdot( ++ double dot[2] ++) ++{ ++ fprintf(stderr, "(%g,%g)", dot[0], dot[1]); ++} ++ ++static ++printseg( ++ double seg[2][2] ++) ++{ ++ putc('[', stderr); ++ printdot(seg[0]); ++ putc(' ', stderr); ++ printdot(seg[1]); ++ putc(']', stderr); ++} ++ ++#endif /* DEBUG_* */ ++ ++/* ++ * Find squared distance from a dot to a line segment ++ */ ++ ++double ++fdotsegdist2( ++ double seg[2][2 /*X,Y*/], ++ double dot[2 /*X,Y*/] ++) ++{ ++#define x1 seg[0][X] ++#define y1 seg[0][Y] ++#define x2 seg[1][X] ++#define y2 seg[1][Y] ++#define xdot dot[X] ++#define ydot dot[Y] ++ ++ double dx, dy; /* segment dimensions */ ++ double kline, bline; /* segment line formula is y=k*x+b */ ++ double kperp, bperp; /* perpendicular from the dot to the line */ ++ double xcross, ycross; /* where the perpendicular crosses the segment */ ++ ++/* handle the situation where the nearest point of the segment is its end */ ++#define HANDLE_LIMITS(less12, lesscr1, lesscr2) \ ++ if( less12 ) { \ ++ if( lesscr1 ) { \ ++ xcross = x1; \ ++ ycross = y1; \ ++ } else if( !(lesscr2) ) { \ ++ xcross = x2; \ ++ ycross = y2; \ ++ } \ ++ } else { \ ++ if( !(lesscr1) ) { \ ++ xcross = x1; \ ++ ycross = y1; \ ++ } else if( lesscr2 ) { \ ++ xcross = x2; \ ++ ycross = y2; \ ++ } \ ++ } \ ++ /* end of macro */ ++ ++ ++ dx = x2 - x1; ++ dy = y2 - y1; ++ ++ if(fabs(dx) < FEPS) { ++ /* special case - vertical line */ ++#ifdef DEBUG_DOTSEG ++ printf("vertical line!\n"); ++#endif ++ xcross = x1; ++ ycross = ydot; ++ HANDLE_LIMITS( y1 < y2, ycross < y1, ycross < y2); ++ } else if(fabs(dy) < FEPS) { ++ /* special case - horizontal line */ ++#ifdef DEBUG_DOTSEG ++ printf("horizontal line!\n"); ++#endif ++ xcross = xdot; ++ ycross = y1; ++ HANDLE_LIMITS( x1 < x2, xcross < x1, xcross < x2) ++ } else { ++ kline = dy/dx; ++ bline = y1 - x1*kline; ++ kperp = -1./kline; ++ bperp = ydot - xdot*kperp; ++ ++ xcross = (bline-bperp) / (kperp-kline); ++ ycross = kline*xcross + bline; ++ ++ HANDLE_LIMITS( x1 < x2, xcross < x1, xcross < x2) ++ } ++#ifdef DEBUG_DOTSEG ++ printf("crossover at (%g,%g)\n", xcross, ycross); ++#endif ++ ++ dx = xdot-xcross; ++ dy = ydot-ycross; ++ return dx*dx+dy*dy; ++#undef x1 ++#undef y1 ++#undef x2 ++#undef y2 ++#undef xdot ++#undef ydot ++#undef HANDLE_LIMITS ++} ++ ++/* find the weighted quadratic average for the distance of a set ++ * of dots from the curve; also fills out the individual distances ++ * for each dot; if maxp!=NULL then returns the maximal squared ++ * distance in there ++ */ ++ ++double ++fdotcurvdist2( ++ double curve[4][2 /*X,Y*/ ], ++ struct dot_dist *dots, ++ int ndots, /* number of entries in dots */ ++ double *maxp ++) ++{ ++ /* a curve is approximated by this many straight segments */ ++#define NAPSECT 16 ++ /* a curve is divided into this many sections with equal weight each */ ++#define NWSECT 4 ++ /* table of coefficients for finding the dots on the curve */ ++ /* tt[0] is left unused */ ++ static double tt[NAPSECT][4]; ++ static int havett = 0; /* flag: tt is initialized */ ++ /* dots on the curve */ ++ double cvd[NAPSECT+1][2 /*X,Y*/]; ++ /* sums by sections */ ++ double sum[NWSECT]; ++ /* counts by sections */ ++ double count[NWSECT]; ++ int d, i, j; ++ int id1, id2; ++ double dist1, dist2, dist3, dx, dy, x, y; ++ double max = 0.; ++ ++ if(!havett) { ++ double t, nt, t2, nt2, step; ++ ++ havett++; ++ step = 1. / NAPSECT; ++ t = 0; ++ for(i=1; iid1+1; i--) { ++ dx = x - cvd[i][X]; ++ dy = y - cvd[i][Y]; ++ dist3 = dx*dx + dy*dy; ++#ifdef DEBUG_DOTCURVE ++ printf(" dot %d ",i); printdot(cvd[i]); printf(" dist=%g\n", sqrt(dist3)); ++#endif ++ if(dist3 < dist2) { ++ dist2 = dist3; ++ id2 = i; ++ } else ++ break; ++ } ++ ++ /* now find which of the local minimums is smaller */ ++ if(dist2 < dist1) { ++ id1 = id2; ++ } ++ } ++ ++ /* the nearest segment must include the nearest dot */ ++ if(id1==0) { ++ dots[d].seg = 0; ++ dots[d].dist2 = fdotsegdist2(&cvd[0], dots[d].p); ++ } else if(id1==NAPSECT) { ++ dots[d].seg = NAPSECT-1; ++ dots[d].dist2 = fdotsegdist2(&cvd[NAPSECT-1], dots[d].p); ++ } else { ++ dist1 = fdotsegdist2(&cvd[id1], dots[d].p); ++ dist2 = fdotsegdist2(&cvd[id1-1], dots[d].p); ++ if(dist2 < dist1) { ++ dots[d].seg = id1-1; ++ dots[d].dist2 = dist2; ++ } else { ++ dots[d].seg = id1; ++ dots[d].dist2 = dist1; ++ } ++ } ++ ++ i = dots[d].seg % NWSECT; ++ sum[i] += dots[d].dist2; ++ if(dots[d].dist2 > max) ++ max = dots[d].dist2; ++ count[i]++; ++#ifdef DEBUG_DOTCURVE ++ printf(" best seg %d sect %d dist=%g\n", dots[d].seg, i, sqrt(dots[d].dist2)); ++#endif ++ } ++ ++ /* calculate the weighted average */ ++ id1=0; ++ dist1=0.; ++ for(i=0; irtg < 0) { ++ d[1][X] = ge1->fx3 - ge1->prev->fx3; ++ d[1][Y] = ge1->fy3 - ge1->prev->fy3; ++ } else { ++ d[1][X] = ge1->fx3 - ge1->fpoints[X][ge1->rtg]; ++ d[1][Y] = ge1->fy3 - ge1->fpoints[Y][ge1->rtg]; ++ } ++ d[2][X] = ge2->fpoints[X][ge2->ftg] - ge2->prev->fx3; ++ d[2][Y] = ge2->fpoints[Y][ge2->ftg] - ge2->prev->fy3; ++ ++ len1 = sqrt( d[1][X]*d[1][X] + d[1][Y]*d[1][Y] ); ++ len2 = sqrt( d[2][X]*d[2][X] + d[2][Y]*d[2][Y] ); ++ /* scale the 2nd segment to the length of 1 ++ * and to make sure that the 1st segment is longer scale it to ++ * the length of 2 and extend to the same distance backwards ++ */ ++ scale1 = 2./len1; ++ scale2 = 1./len2; ++ ++ for(axis=0; axis <2; axis++) { ++ d[0][axis] = -( d[1][axis] *= scale1 ); ++ d[2][axis] *= scale2; ++ } ++ return fdotsegdist2(d, d[2]); ++} ++ ++#if 0 ++/* find the area covered by the curve ++ * (limited by the projections to the X axis) ++ */ ++ ++static double ++fcvarea( ++ GENTRY *ge ++) ++{ ++ double Ly, My, Ny, Py, Qx, Rx, Sx; ++ double area; ++ ++ /* y = Ly*t^3 + My*t^2 + Ny*t + Py */ ++ Ly = -ge->prev->fy3 + 3*(ge->fy1 - ge->fy2) + ge->fy3; ++ My = 3*ge->prev->fy3 - 6*ge->fy1 + 3*ge->fy2; ++ Ny = 3*(-ge->prev->fy3 + ge->fy1); ++ Py = ge->prev->fy3; ++ ++ /* dx/dt = Qx*t^2 + Rx*t + Sx */ ++ Qx = 3*(-ge->prev->fx3 + 3*(ge->fx1 - ge->fx2) + ge->fx3); ++ Rx = 6*(ge->prev->fx3 - 2*ge->fx1 + ge->fx2); ++ Sx = 3*(-ge->prev->fx3 + ge->fx1); ++ ++ /* area is integral[from 0 to 1]( y(t) * dx(t)/dt *dt) */ ++ area = 1./6.*(Ly*Qx) + 1./5.*(Ly*Rx + My*Qx) ++ + 1./4.*(Ly*Sx + My*Rx + Ny*Qx) + 1./3.*(My*Sx + Ny*Rx + Py*Qx) ++ + 1./2.*(Ny*Sx + Py*Rx) + Py*Sx; ++ ++ return area; ++} ++#endif ++ ++/* find the value of point on the curve at the given parameter t, ++ * along the given axis (0 - X, 1 - Y). ++ */ ++ ++static double ++fcvval( ++ GENTRY *ge, ++ int axis, ++ double t ++) ++{ ++ double t2, mt, mt2; ++ ++ /* val = A*(1-t)^3 + 3*B*(1-t)^2*t + 3*C*(1-t)*t^2 + D*t^3 */ ++ t2 = t*t; ++ mt = 1-t; ++ mt2 = mt*mt; ++ ++ return ge->prev->fpoints[axis][2]*mt2*mt ++ + 3*(ge->fpoints[axis][0]*mt2*t + ge->fpoints[axis][1]*mt*t2) ++ + ge->fpoints[axis][2]*t*t2; ++} ++ ++/* ++ * Find ndots equally spaced dots on a curve or line and fill ++ * their coordinates into the dots array ++ */ ++ ++static void ++fsampledots( ++ GENTRY *ge, ++ double dots[][2], /* the dots to fill */ ++ int ndots ++) ++{ ++ int i, axis; ++ double t, nf, dx, d[2]; ++ ++ nf = ndots+1; ++ if(ge->type == GE_CURVE) { ++ for(i=0; ifx3 - ge->prev->fx3; ++ d[1] = ge->fy3 - ge->prev->fy3; ++ for(i=0; iprev->fpoints[axis][2] ++ + t*d[axis]; ++ } ++ } ++} ++ ++/* ++ * Allocate a structure gex_con ++ */ ++ ++static void ++alloc_gex_con( ++ GENTRY *ge ++) ++{ ++ ge->ext = (void*)calloc(1, sizeof(GEX_CON)); ++ if(ge->ext == 0) { ++ fprintf (stderr, "****malloc failed %s line %d\n", __FILE__, __LINE__); ++ exit(255); ++ } ++} ++ ++/* ++ * Normalize a gentry for fforceconcise() : find the points that ++ * can be used to calculate the tangents. ++ */ ++ ++static void ++fnormalizege( ++ GENTRY *ge ++) ++{ ++ int midsame, frontsame, rearsame; ++ ++ if(ge->type == GE_LINE) { ++ ge->ftg = 2; ++ ge->rtg = -1; ++ } else { /* assume it's a curve */ ++ midsame = (fabs(ge->fx1-ge->fx2)fy1-ge->fy2)fx1-ge->prev->fx3)fy1-ge->prev->fy3)fx3-ge->fx2)fy3-ge->fy2)ftg = 2; ++ ge->rtg = -1; ++ } else { ++ if(frontsame) { ++ ge->ftg = 1; ++ } else { ++ ge->ftg = 0; ++ } ++ if(rearsame) { ++ ge->rtg = 0; ++ } else { ++ ge->rtg = 1; ++ } ++ } ++ } ++} ++ ++/* various definition for the processing of outlines */ ++ ++/* maximal average quadratic distance from the original curve ++ * (in dots) to consider the joined curve good ++ */ ++#define CVEPS 1.5 ++#define CVEPS2 (CVEPS*CVEPS) ++/* squared sinus of the maximal angle that we consider a smooth joint */ ++#define SMOOTHSIN2 0.25 /* 0.25==sin(30 degrees)^2 */ ++/* squared line length that we consider small */ ++#define SMALL_LINE2 (15.*15.) ++/* how many times a curve must be bigger than a line to join, squared */ ++#define TIMES_LINE2 (3.*3.) ++ ++/* ++ * Normalize and analyse a gentry for fforceconcise() and fill out the gex_con ++ * structure ++ */ ++ ++static void ++fanalyzege( ++ GENTRY *ge ++) ++{ ++ int i, ix, iy; ++ double avsd2, dots[3][2 /*X,Y*/]; ++ GEX_CON *gex; ++ ++ gex = X_CON(ge); ++ memset(gex, 0, sizeof *gex); ++ ++ gex->len2 = 0; ++ for(i=0; i<2; i++) { ++ avsd2 = gex->d[i] = ge->fpoints[i][2] - ge->prev->fpoints[i][2]; ++ gex->len2 += avsd2*avsd2; ++ } ++ gex->sin2 = fjointsin2(ge, ge->frwd); ++ if(ge->type == GE_CURVE) { ++ ge->dir = fgetcvdir(ge); ++ for(i=0; i<2; i++) { ++ dots[0][i] = ge->prev->fpoints[i][2]; ++ dots[1][i] = ge->fpoints[i][2]; ++ dots[2][i] = fcvval(ge, i, 0.5); ++ } ++ avsd2 = fdotsegdist2(dots, dots[2]); ++ if(avsd2 <= CVEPS2) { ++ gex->flags |= GEXF_FLAT; ++ } ++ } else { ++ ge->dir = CVDIR_FEQUAL|CVDIR_REQUAL; ++ gex->flags |= GEXF_FLAT; ++ } ++ if(gex->flags & GEXF_FLAT) { ++ if( fabs(gex->d[X]) > FEPS && fabs(gex->d[Y]) < 5. ++ && fabs(gex->d[Y] / gex->d[X]) < 0.2) ++ gex->flags |= GEXF_HOR; ++ else if( fabs(gex->d[Y]) > FEPS && fabs(gex->d[X]) < 5. ++ && fabs(gex->d[X] / gex->d[Y]) < 0.2) ++ gex->flags |= GEXF_VERT; ++ } ++ ix = gex->isd[X] = fsign(gex->d[X]); ++ iy = gex->isd[Y] = fsign(gex->d[Y]); ++ if(ix <= 0) { ++ if(iy <= 0) ++ gex->flags |= GEXF_QDL; ++ if(iy >= 0) ++ gex->flags |= GEXF_QUL; ++ if(gex->flags & GEXF_HOR) ++ gex->flags |= GEXF_IDQ_L; ++ } ++ if(ix >= 0) { ++ if(iy <= 0) ++ gex->flags |= GEXF_QDR; ++ if(iy >= 0) ++ gex->flags |= GEXF_QUR; ++ if(gex->flags & GEXF_HOR) ++ gex->flags |= GEXF_IDQ_R; ++ } ++ if(gex->flags & GEXF_VERT) { ++ if(iy <= 0) { ++ gex->flags |= GEXF_IDQ_U; ++ } else { /* supposedly there is no 0-sized entry */ ++ gex->flags |= GEXF_IDQ_D; ++ } ++ } ++} ++ ++/* ++ * Analyse a joint between this and following gentry for fforceconcise() ++ * and fill out the corresponding parts of the gex_con structure ++ * Bothe entries must be analyzed first. ++ */ ++ ++static void ++fanalyzejoint( ++ GENTRY *ge ++) ++{ ++ GENTRY *nge = ge->frwd; ++ GENTRY tge; ++ GEX_CON *gex, *ngex; ++ double avsd2, dots[3][2 /*X,Y*/]; ++ int i; ++ ++ gex = X_CON(ge); ngex = X_CON(nge); ++ ++ /* look if they can be joined honestly */ ++ ++ /* if any is flat, they should join smoothly */ ++ if( (gex->flags & GEXF_FLAT || ngex->flags & GEXF_FLAT) ++ && gex->sin2 > SMOOTHSIN2) ++ goto try_flatboth; ++ ++ if(ge->type == GE_LINE) { ++ if(nge->type == GE_LINE) { ++ if(gex->len2 > SMALL_LINE2 || ngex->len2 > SMALL_LINE2) ++ goto try_flatboth; ++ } else { ++ if(gex->len2*TIMES_LINE2 > ngex->len2) ++ goto try_flatboth; ++ } ++ } else if(nge->type == GE_LINE) { ++ if(ngex->len2*TIMES_LINE2 > gex->len2) ++ goto try_flatboth; ++ } ++ ++ /* if curve changes direction */ ++ if( gex->isd[X]*ngex->isd[X]<0 || gex->isd[Y]*ngex->isd[Y]<0) ++ goto try_idealone; ++ ++ /* if would create a zigzag */ ++ if( ((ge->dir&CVDIR_FRONT)-CVDIR_FEQUAL) * ((nge->dir&CVDIR_REAR)-CVDIR_REQUAL) < 0 ) ++ goto try_flatone; ++ ++ if( fcrossraysge(ge, nge, NULL, NULL, NULL) ) ++ gex->flags |= GEXF_JGOOD; ++ ++try_flatone: ++ /* look if they can be joined by flatting out one of the entries */ ++ ++ /* at this point we know that the general direction of the ++ * gentries is OK ++ */ ++ ++ if( gex->flags & GEXF_FLAT ) { ++ tge = *ge; ++ tge.fx1 = tge.fx3; ++ tge.fy1 = tge.fy3; ++ fnormalizege(&tge); ++ if( fcrossraysge(&tge, nge, NULL, NULL, NULL) ) ++ gex->flags |= GEXF_JFLAT|GEXF_JFLAT1; ++ } ++ if( ngex->flags & GEXF_FLAT ) { ++ tge = *nge; ++ tge.fx2 = ge->fx3; ++ tge.fy2 = ge->fy3; ++ fnormalizege(&tge); ++ if( fcrossraysge(ge, &tge, NULL, NULL, NULL) ) ++ gex->flags |= GEXF_JFLAT|GEXF_JFLAT2; ++ } ++ ++try_idealone: ++ /* look if one of the entries can be brought to an idealized ++ * horizontal or vertical position and then joined ++ */ ++ if( gex->flags & GEXF_HOR && gex->isd[X]*ngex->isd[X]>=0 ) { ++ tge = *ge; ++ tge.fx1 = tge.fx3; ++ tge.fy1 = ge->prev->fy3; /* force horizontal */ ++ fnormalizege(&tge); ++ if( fcrossraysge(&tge, nge, NULL, NULL, NULL) ) ++ gex->flags |= GEXF_JID|GEXF_JID1; ++ } else if( gex->flags & GEXF_VERT && gex->isd[Y]*ngex->isd[Y]>=0 ) { ++ tge = *ge; ++ tge.fx1 = ge->prev->fx3; /* force vertical */ ++ tge.fy1 = tge.fy3; ++ fnormalizege(&tge); ++ if( fcrossraysge(&tge, nge, NULL, NULL, NULL) ) ++ gex->flags |= GEXF_JID|GEXF_JID1; ++ } ++ if( ngex->flags & GEXF_HOR && gex->isd[X]*ngex->isd[X]>=0 ) { ++ tge = *nge; ++ tge.fx2 = ge->fx3; ++ tge.fy2 = nge->fy3; /* force horizontal */ ++ fnormalizege(&tge); ++ if( fcrossraysge(ge, &tge, NULL, NULL, NULL) ) ++ gex->flags |= GEXF_JID|GEXF_JID2; ++ } else if( ngex->flags & GEXF_VERT && gex->isd[Y]*ngex->isd[Y]>=0 ) { ++ tge = *nge; ++ tge.fx2 = nge->fx3; /* force vertical */ ++ tge.fy2 = ge->fy3; ++ fnormalizege(&tge); ++ if( fcrossraysge(ge, &tge, NULL, NULL, NULL) ) ++ gex->flags |= GEXF_JID|GEXF_JID2; ++ } ++ ++try_flatboth: ++ /* look if we can change them to one line */ ++ if(gex->flags & GEXF_FLAT && ngex->flags & GEXF_FLAT) { ++ for(i=0; i<2; i++) { ++ dots[0][i] = ge->prev->fpoints[i][2]; ++ dots[1][i] = nge->fpoints[i][2]; ++ dots[2][i] = ge->fpoints[i][2]; ++ } ++ if( fdotsegdist2(dots, dots[2]) <= CVEPS2) ++ gex->flags |= GEXF_JLINE; ++ } ++} ++ ++/* ++ * Force conciseness of one contour in the glyph, ++ * the contour is indicated by one entry from it. ++ */ ++ ++static void ++fconcisecontour( ++ GLYPH *g, ++ GENTRY *startge ++) ++{ ++/* initial maximal number of dots to be used as reference */ ++#define MAXDOTS ((NREFDOTS+1)*12) ++ ++ GENTRY *ge, *pge, *nge, *ige; ++ GEX_CON *gex, *pgex, *ngex, *nngex; ++ GENTRY tpge, tnge; ++ int quad, qq, i, j, ndots, maxdots; ++ int found[2]; ++ int joinmask, pflag, nflag; ++ struct dot_dist *dots; ++ double avsd2, maxd2, eps2; ++ double apcv[4][2]; ++ ++ if(startge == 0) { ++ fprintf(stderr, "WARNING: assertion in %s line %d, please report it to the ttf2pt1 project\n", ++ __FILE__, __LINE__); ++ fprintf(stderr, "Strange contour in glyph %s\n", g->name); ++ dumppaths(g, NULL, NULL); ++ return; ++ } ++ ++ if(startge->type != GE_CURVE && startge->type != GE_LINE) ++ return; /* probably a degenerate contour */ ++ ++ if(ISDBG(FCONCISE)) ++ fprintf(stderr, "processing contour 0x%p of glyph %s\n", startge, g->name); ++ ++ maxdots = MAXDOTS; ++ dots = (struct dot_dist *)malloc(sizeof(*dots)*maxdots); ++ if(dots == NULL) { ++ fprintf (stderr, "****malloc failed %s line %d\n", __FILE__, __LINE__); ++ exit(255); ++ } ++ ++ ge = startge; ++ joinmask = GEXF_JGOOD; ++ while(1) { ++ restart: ++ gex = X_CON(ge); ++ if((gex->flags & GEXF_JMASK) > ((joinmask<<1)-1)) { ++ if(ISDBG(FCONCISE)) ++ fprintf(stderr, "found higher flag (%x>%x) at 0x%p\n", ++ gex->flags & GEXF_JMASK, ((joinmask<<1)-1), ge); ++ joinmask <<= 1; ++ startge = ge; /* have to redo the pass */ ++ continue; ++ } ++ if(( gex->flags & joinmask )==0) ++ goto next; ++ ++ /* if we happen to be in the middle of a string of ++ * joinable entries, find its beginning ++ */ ++ if( gex->flags & (GEXF_JCVMASK^GEXF_JID) ) ++ quad = gex->flags & X_CON_F(ge->frwd) & GEXF_QMASK; ++ else if( gex->flags & GEXF_JID2 ) ++ quad = gex->flags & GEXF_QFROM_IDEAL(X_CON_F(ge->frwd)) & GEXF_QMASK; ++ else /* must be GEXF_JID1 */ ++ quad = GEXF_QFROM_IDEAL(gex->flags) & X_CON_F(ge->frwd) & GEXF_QMASK; ++ ++ pge = ge; ++ pgex = X_CON(pge->bkwd); ++ ++ if(ISDBG(FCONCISE)) ++ fprintf(stderr, "ge %p prev -> 0x%p ", ge, pge); ++ ++ while(pgex->flags & GEXF_JCVMASK) { ++ if( !(pgex->flags & ((GEXF_JCVMASK^GEXF_JID)|GEXF_JID2)) ) ++ qq = GEXF_QFROM_IDEAL(pgex->flags); ++ else ++ qq = pgex->flags & GEXF_QMASK; ++ ++ if(ISDBG(FCONCISE)) ++ fprintf(stderr, "(%x?%x)", quad, qq); ++ ++ if( !(quad & qq) ) { ++ if( !(X_CON_F(pge) & (GEXF_JCVMASK^GEXF_JID)) ++ && pgex->flags & (GEXF_JCVMASK^GEXF_JID) ) { ++ /* the previos entry is definitely a better match */ ++ if(pge == ge) { ++ if(ISDBG(FCONCISE)) ++ fprintf(stderr, "\nprev is a better match at %p\n", pge); ++ startge = ge; ++ goto next; ++ } else ++ pge = pge->frwd; ++ } ++ break; ++ } ++ ++ quad &= qq; ++ pge = pge->bkwd; ++ pgex = X_CON(pge->bkwd); ++ if(ISDBG(FCONCISE)) ++ fprintf(stderr, "0x%p ", pge); ++ } ++ ++ /* collect as many entries for joining as possible */ ++ nge = ge->frwd; ++ ngex = X_CON(nge); ++ nngex = X_CON(nge->frwd); ++ ++ if(ISDBG(FCONCISE)) ++ fprintf(stderr, ": 0x%x\nnext -> 0x%p ", pge, nge); ++ ++ while(ngex->flags & GEXF_JCVMASK) { ++ if( !(ngex->flags & ((GEXF_JCVMASK^GEXF_JID)|GEXF_JID1)) ) ++ qq = GEXF_QFROM_IDEAL(nngex->flags); ++ else ++ qq = nngex->flags & GEXF_QMASK; ++ ++ if(ISDBG(FCONCISE)) ++ fprintf(stderr, "(%x?%x)", quad, qq); ++ if( !(quad & qq) ) { ++ if( !(X_CON_F(nge->bkwd) & (GEXF_JCVMASK^GEXF_JID)) ++ && ngex->flags & (GEXF_JCVMASK^GEXF_JID) ) { ++ /* the next-next entry is definitely a better match */ ++ if(nge == ge->frwd) { ++ if(ISDBG(FCONCISE)) ++ fprintf(stderr, "\nnext %x is a better match than %x at %p (jmask %x)\n", ++ ngex->flags & GEXF_JCVMASK, gex->flags & GEXF_JCVMASK, nge, joinmask); ++ goto next; ++ } else ++ nge = nge->bkwd; ++ } ++ break; ++ } ++ ++ quad &= qq; ++ nge = nge->frwd; ++ ngex = nngex; ++ nngex = X_CON(nge->frwd); ++ if(ISDBG(FCONCISE)) ++ fprintf(stderr, "0x%p ", nge); ++ } ++ ++ if(ISDBG(FCONCISE)) ++ fprintf(stderr, ": 0x%x\n", nge); ++ ++ /* XXX add splitting of last entries if neccessary */ ++ ++ /* make sure that all the reference dots are valid */ ++ for(ige = pge; ige != nge->frwd; ige = ige->frwd) { ++ nngex = X_CON(ige); ++ if( !(nngex->flags & GEXF_VDOTS) ) { ++ fsampledots(ige, nngex->dots, NREFDOTS); ++ nngex->flags |= GEXF_VDOTS; ++ } ++ } ++ ++ /* do the actual joining */ ++ while(1) { ++ pgex = X_CON(pge); ++ ngex = X_CON(nge->bkwd); ++ /* now the segments to be joined are pge...nge */ ++ ++ ndots = 0; ++ for(ige = pge; ige != nge->frwd; ige = ige->frwd) { ++ if(maxdots < ndots+(NREFDOTS+1)) { ++ maxdots += MAXDOTS; ++ dots = (struct dot_dist *)realloc((void *)dots, sizeof(*dots)*maxdots); ++ if(dots == NULL) { ++ fprintf (stderr, "****malloc failed %s line %d\n", __FILE__, __LINE__); ++ exit(255); ++ } ++ } ++ nngex = X_CON(ige); ++ for(i=0; idots[i][j]; ++ ndots++; ++ } ++ for(j=0; j<2; j++) ++ dots[ndots].p[j] = ige->fpoints[j][2]; ++ ndots++; ++ } ++ ndots--; /* the last point is not interesting */ ++ ++ tpge = *pge; ++ pflag = pgex->flags; ++ if(pflag & (GEXF_JGOOD|GEXF_JFLAT2|GEXF_JID2)) { ++ /* nothing */ ++ } else if(pflag & GEXF_JFLAT) { ++ tpge.fx1 = tpge.fx3; ++ tpge.fy1 = tpge.fy3; ++ } else if(pflag & GEXF_JID) { ++ if(pflag & GEXF_HOR) ++ tpge.fy1 = tpge.bkwd->fy3; ++ else ++ tpge.fx1 = tpge.bkwd->fx3; ++ } ++ ++ tnge = *nge; ++ nflag = ngex->flags; ++ if(nflag & (GEXF_JGOOD|GEXF_JFLAT1|GEXF_JID) ++ && !(nflag & GEXF_JID2)) { ++ /* nothing */ ++ } else if(nflag & GEXF_JFLAT) { ++ tnge.fx2 = tnge.bkwd->fx3; ++ tnge.fy2 = tnge.bkwd->fy3; ++ } else if(nflag & GEXF_JID) { ++ if(X_CON_F(nge) & GEXF_HOR) ++ tnge.fy2 = tnge.fy3; ++ else ++ tnge.fx2 = tnge.fx3; ++ } ++ ++ fnormalizege(&tpge); ++ fnormalizege(&tnge); ++ if( fcrossraysge(&tpge, &tnge, NULL, NULL, &apcv[1]) ) { ++ apcv[0][X] = tpge.bkwd->fx3; ++ apcv[0][Y] = tpge.bkwd->fy3; ++ /* apcv[1] and apcv[2] were filled by fcrossraysge() */ ++ apcv[3][X] = tnge.fx3; ++ apcv[3][Y] = tnge.fy3; ++ ++ /* calculate the precision depending on the smaller dimension of the curve */ ++ maxd2 = apcv[3][X]-apcv[0][X]; ++ maxd2 *= maxd2; ++ eps2 = apcv[3][Y]-apcv[0][Y]; ++ eps2 *= eps2; ++ if(maxd2 < eps2) ++ eps2 = maxd2; ++ eps2 *= (CVEPS2*4.) / (400.*400.); ++ if(eps2 < CVEPS2) ++ eps2 = CVEPS2; ++ else if(eps2 > CVEPS2*4.) ++ eps2 = CVEPS2*4.; ++ ++ fapproxcurve(apcv, dots, ndots); ++ ++ avsd2 = fdotcurvdist2(apcv, dots, ndots, &maxd2); ++ if(ISDBG(FCONCISE)) ++ fprintf(stderr, "avsd = %g, maxd = %g, ", sqrt(avsd2), sqrt(maxd2)); ++ if(avsd2 <= eps2 && maxd2 <= eps2*2.) { ++ /* we've guessed a curve that is close enough */ ++ ggoodcv++; ggoodcvdots += ndots; ++ ++ if(ISDBG(FCONCISE)) { ++ fprintf(stderr, "in %s joined %p-%p to ", g->name, pge, nge); ++ for(i=0; i<4; i++) { ++ fprintf(stderr, " (%g, %g)", apcv[i][X], apcv[i][Y]); ++ } ++ fprintf(stderr, " from\n"); ++ dumppaths(g, pge, nge); ++ } ++ for(i=0; i<3; i++) { ++ pge->fxn[i] = apcv[i+1][X]; ++ pge->fyn[i] = apcv[i+1][Y]; ++ } ++ pge->type = GE_CURVE; ++ ge = pge; ++ for(ige = pge->frwd; ; ige = pge->frwd) { ++ if(ige == pge) { ++ fprintf(stderr, "WARNING: assertion in %s line %d, please report it to the ttf2pt1 project\n", ++ __FILE__, __LINE__); ++ free(dots); ++ return; ++ } ++ if(startge == ige) ++ startge = pge; ++ free(ige->ext); ++ freethisge(ige); ++ if(ige == nge) ++ break; ++ } ++ fnormalizege(ge); ++ if(ISDBG(FCONCISE)) { ++ fprintf(stderr, "normalized "); ++ for(i=0; i<3; i++) { ++ fprintf(stderr, " (%g, %g)", ge->fpoints[X][i], ge->fpoints[Y][i]); ++ } ++ fprintf(stderr, "\n"); ++ } ++ fanalyzege(ge); ++ fanalyzejoint(ge); ++ fanalyzege(ge->bkwd); ++ fanalyzejoint(ge->bkwd); ++ ++ /* the results of this join will have to be reconsidered */ ++ startge = ge = ge->frwd; ++ goto restart; ++ } else { ++ gbadcv++; gbadcvdots += ndots; ++ } ++ } ++ ++ /* if we're down to 2 entries then the join has failed */ ++ if(pge->frwd == nge) { ++ pgex->flags &= ~joinmask; ++ if(ISDBG(FCONCISE)) ++ fprintf(stderr, "no match\n"); ++ goto next; ++ } ++ ++ /* reduce the number of entries by dropping one at some end, ++ * should never drop the original ge from the range ++ */ ++ ++ if(nge->bkwd == ge ++ || (pge != ge && (pgex->flags & GEXF_JCVMASK) <= (ngex->flags & GEXF_JCVMASK)) ) { ++ pge = pge->frwd; ++ } else { ++ nge = nge->bkwd; ++ } ++ if(ISDBG(FCONCISE)) ++ fprintf(stderr, "next try: %p to %p\n", pge, nge); ++ } ++ ++next: ++ ge = ge->frwd; ++ if(ge == startge) { ++ joinmask = (joinmask >> 1) & GEXF_JCVMASK; ++ if(joinmask == 0) ++ break; ++ } ++ } ++ ++ /* join flat segments into lines */ ++ /* here ge==startge */ ++ while(1) { ++ gex = X_CON(ge); ++ if( !(gex->flags & GEXF_JLINE) ) ++ goto next2; ++ ++ ndots = 0; ++ dots[ndots].p[X] = ge->fx3; ++ dots[ndots].p[Y] = ge->fy3; ++ ndots++; ++ ++ pge = ge->bkwd; ++ nge = ge->frwd; ++ ++ if(ISDBG(FCONCISE)) ++ fprintf(stderr, "joining LINE from %p-%p\n", ge, nge); ++ ++ while(pge!=nge) { ++ pgex = X_CON(pge); ++ ngex = X_CON(nge); ++ if(ISDBG(FCONCISE)) ++ fprintf(stderr, "(p=%p/%x n=0x%x/%x) ", pge, pgex->flags & GEXF_JLINE, ++ nge, ngex->flags & GEXF_JLINE); ++ if( !((pgex->flags | ngex->flags) & GEXF_JLINE) ) { ++ if(ISDBG(FCONCISE)) ++ fprintf(stderr, "(end p=%p n=%p) ", pge, nge); ++ break; ++ } ++ ++ if(maxdots < ndots+2) { ++ maxdots += MAXDOTS; ++ dots = (struct dot_dist *)realloc((void *)dots, sizeof(*dots)*maxdots); ++ if(dots == NULL) { ++ fprintf (stderr, "****malloc failed %s line %d\n", __FILE__, __LINE__); ++ exit(255); ++ } ++ } ++ if( pgex->flags & GEXF_JLINE ) { ++ for(i=0; i<2; i++) { ++ apcv[0][i] = pge->bkwd->fpoints[i][2]; ++ apcv[1][i] = nge->fpoints[i][2]; ++ dots[ndots].p[i] = pge->fpoints[i][2]; ++ } ++ ndots++; ++ for(i=0; i CVEPS2) ++ break; ++ } ++ if(iflags &= ~GEXF_JLINE; ++ } else { ++ pge = pge->bkwd; ++ if(pge == nge) { ++ if(ISDBG(FCONCISE)) ++ fprintf(stderr, "intersected at prev %p ", pge); ++ break; /* oops, tried to self-intersect */ ++ } ++ } ++ } else if(ISDBG(FCONCISE)) ++ fprintf(stderr, "(p=%p) ", pge); ++ ++ if( ngex->flags & GEXF_JLINE ) { ++ for(i=0; i<2; i++) { ++ apcv[0][i] = pge->fpoints[i][2]; /* pge points before the 1st segment */ ++ apcv[1][i] = nge->frwd->fpoints[i][2]; ++ dots[ndots].p[i] = nge->fpoints[i][2]; ++ } ++ ndots++; ++ for(i=0; i CVEPS2) ++ break; ++ } ++ if(ifrwd); ++ ndots--; ++ ngex->flags &= ~GEXF_JLINE; ++ } else { ++ nge = nge->frwd; ++ } ++ } else if(ISDBG(FCONCISE)) ++ fprintf(stderr, "(n=%p) ", nge); ++ } ++ ++ pge = pge->frwd; /* now the limits are pge...nge inclusive */ ++ if(pge == nge) /* a deeply perversive contour */ ++ break; ++ ++ if(ISDBG(FCONCISE)) { ++ fprintf(stderr, "\nin %s joined LINE %p-%p from\n", g->name, pge, nge); ++ dumppaths(g, pge, nge); ++ } ++ pge->type = GE_LINE; ++ for(i=0; i<2; i++) { ++ pge->fpoints[i][2] = nge->fpoints[i][2]; ++ } ++ fnormalizege(pge); ++ X_CON_F(pge) &= ~GEXF_JLINE; ++ ++ ge = pge; ++ for(ige = pge->frwd; ; ige = pge->frwd) { ++ if(ige == pge) { ++ fprintf(stderr, "WARNING: assertion in %s line %d, please report it to the ttf2pt1 project\n", ++ __FILE__, __LINE__); ++ free(dots); ++ return; ++ } ++ if(startge == ige) ++ startge = pge; ++ free(ige->ext); ++ freethisge(ige); ++ if(ige == nge) ++ break; ++ } ++next2: ++ ge = ge->frwd; ++ if(ge == startge) ++ break; ++ } ++ ++ free(dots); ++} ++ ++/* force conciseness: substitute 2 or more curves going in the ++** same quadrant with one curve ++** in floating point ++*/ ++ ++void ++fforceconcise( ++ GLYPH * g ++) ++{ ++ ++ GENTRY *ge, *nge, *endge, *xge; ++ ++ assertisfloat(g, "enforcing conciseness"); ++ ++ fdelsmall(g, 0.05); ++ assertpath(g->entries, __FILE__, __LINE__, g->name); ++ ++ if(ISDBG(FCONCISE)) ++ dumppaths(g, NULL, NULL); ++ ++ /* collect more information about each gentry and their joints */ ++ for (ge = g->entries; ge != 0; ge = ge->next) ++ if (ge->type == GE_CURVE || ge->type == GE_LINE) ++ fnormalizege(ge); ++ ++ for (ge = g->entries; ge != 0; ge = ge->next) ++ if (ge->type == GE_CURVE || ge->type == GE_LINE) { ++ alloc_gex_con(ge); ++ fanalyzege(ge); ++ } ++ ++ /* see what we can do about joining */ ++ for (ge = g->entries; ge != 0; ge = ge->next) ++ if (ge->type == GE_CURVE || ge->type == GE_LINE) ++ fanalyzejoint(ge); ++ ++ /* now do the joining */ ++ for (ge = g->entries; ge != 0; ge = ge->next) ++ if(ge->type == GE_MOVE) ++ fconcisecontour(g, ge->next); ++ ++ for (ge = g->entries; ge != 0; ge = ge->next) ++ if (ge->type == GE_CURVE || ge->type == GE_LINE) ++ free(ge->ext); ++} ++ ++void ++print_glyph( ++ int glyphno ++) ++{ ++ GLYPH *g; ++ GENTRY *ge; ++ int x = 0, y = 0; ++ int i; ++ int grp, lastgrp= -1; ++ ++ if(ISDBG(FCONCISE) && glyphno == 0) { ++ fprintf(stderr, "Guessed curves: bad %d/%d good %d/%d\n", ++ gbadcv, gbadcvdots, ggoodcv, ggoodcvdots); ++ } ++ ++ g = &glyph_list[glyphno]; ++ ++ fprintf(pfa_file, "/%s { \n", g->name); ++ ++ /* consider widths >MAXLEGALWIDTH as bugs */ ++ if( g->scaledwidth <= MAXLEGALWIDTH ) { ++ fprintf(pfa_file, "0 %d hsbw\n", g->scaledwidth); ++ } else { ++ fprintf(pfa_file, "0 1000 hsbw\n"); ++ WARNING_2 fprintf(stderr, "glyph %s: width %d seems to be buggy, set to 1000\n", ++ g->name, g->scaledwidth); ++ } ++ ++#if 0 ++ fprintf(pfa_file, "%% contours: "); ++ for (i = 0; i < g->ncontours; i++) ++ fprintf(pfa_file, "%s(%d,%d) ", (g->contours[i].direction == DIR_OUTER ? "out" : "in"), ++ g->contours[i].xofmin, g->contours[i].ymin); ++ fprintf(pfa_file, "\n"); ++ ++ if (g->rymin < 5000) ++ fprintf(pfa_file, "%d lower%s\n", g->rymin, (g->flatymin ? "flat" : "curve")); ++ if (g->rymax > -5000) ++ fprintf(pfa_file, "%d upper%s\n", g->rymax, (g->flatymax ? "flat" : "curve")); ++#endif ++ ++ if (g->hstems) ++ for (i = 0; i < g->nhs; i += 2) { ++ if (g->hstems[i].flags & ST_3) { ++ fprintf(pfa_file, "%d %d %d %d %d %d hstem3\n", ++ g->hstems[i].value, ++ g->hstems[i + 1].value - g->hstems[i].value, ++ g->hstems[i + 2].value, ++ g->hstems[i + 3].value - g->hstems[i + 2].value, ++ g->hstems[i + 4].value, ++ g->hstems[i + 5].value - g->hstems[i + 4].value ++ ); ++ i += 4; ++ } else { ++ fprintf(pfa_file, "%d %d hstem\n", g->hstems[i].value, ++ g->hstems[i + 1].value - g->hstems[i].value); ++ } ++ } ++ ++ if (g->vstems) ++ for (i = 0; i < g->nvs; i += 2) { ++ if (g->vstems[i].flags & ST_3) { ++ fprintf(pfa_file, "%d %d %d %d %d %d vstem3\n", ++ g->vstems[i].value, ++ g->vstems[i + 1].value - g->vstems[i].value, ++ g->vstems[i + 2].value, ++ g->vstems[i + 3].value - g->vstems[i + 2].value, ++ g->vstems[i + 4].value, ++ g->vstems[i + 5].value - g->vstems[i + 4].value ++ ); ++ i += 4; ++ } else { ++ fprintf(pfa_file, "%d %d vstem\n", g->vstems[i].value, ++ g->vstems[i + 1].value - g->vstems[i].value); ++ } ++ } ++ ++ for (ge = g->entries; ge != 0; ge = ge->next) { ++ if(g->nsg>0) { ++ grp=ge->stemid; ++ if(grp >= 0 && grp != lastgrp) { ++ fprintf(pfa_file, "%d 4 callsubr\n", grp+g->firstsubr); ++ lastgrp=grp; ++ } ++ } ++ ++ switch (ge->type) { ++ case GE_MOVE: ++ if (absolute) ++ fprintf(pfa_file, "%d %d amoveto\n", ge->ix3, ge->iy3); ++ else ++ rmoveto(ge->ix3 - x, ge->iy3 - y); ++ if (0) ++ fprintf(stderr, "Glyph %s: print moveto(%d, %d)\n", ++ g->name, ge->ix3, ge->iy3); ++ x = ge->ix3; ++ y = ge->iy3; ++ break; ++ case GE_LINE: ++ if (absolute) ++ fprintf(pfa_file, "%d %d alineto\n", ge->ix3, ge->iy3); ++ else ++ rlineto(ge->ix3 - x, ge->iy3 - y); ++ x = ge->ix3; ++ y = ge->iy3; ++ break; ++ case GE_CURVE: ++ if (absolute) ++ fprintf(pfa_file, "%d %d %d %d %d %d arcurveto\n", ++ ge->ix1, ge->iy1, ge->ix2, ge->iy2, ge->ix3, ge->iy3); ++ else ++ rrcurveto(ge->ix1 - x, ge->iy1 - y, ++ ge->ix2 - ge->ix1, ge->iy2 - ge->iy1, ++ ge->ix3 - ge->ix2, ge->iy3 - ge->iy2); ++ x = ge->ix3; ++ y = ge->iy3; ++ break; ++ case GE_PATH: ++ closepath(); ++ break; ++ default: ++ WARNING_1 fprintf(stderr, "**** Glyph %s: unknown entry type '%c'\n", ++ g->name, ge->type); ++ break; ++ } ++ } ++ ++ fprintf(pfa_file, "endchar } ND\n"); ++} ++ ++/* print the subroutines for this glyph, returns the number of them */ ++int ++print_glyph_subs( ++ int glyphno, ++ int startid /* start numbering subroutines from this id */ ++) ++{ ++ GLYPH *g; ++ int i, grp; ++ ++ g = &glyph_list[glyphno]; ++ ++ if(!hints || !subhints || g->nsg<1) ++ return 0; ++ ++ g->firstsubr=startid; ++ ++#if 0 ++ fprintf(pfa_file, "%% %s %d\n", g->name, g->nsg); ++#endif ++ for(grp=0; grpnsg; grp++) { ++ fprintf(pfa_file, "dup %d {\n", startid++); ++ for(i= (grp==0)? 0 : g->nsbs[grp-1]; insbs[grp]; i++) ++ fprintf(pfa_file, "\t%d %d %cstem\n", g->sbstems[i].low, ++ g->sbstems[i].high-g->sbstems[i].low, ++ g->sbstems[i].isvert ? 'v' : 'h'); ++ fprintf(pfa_file, "\treturn\n\t} NP\n"); ++ } ++ ++ return g->nsg; ++} ++ ++void ++print_glyph_metrics( ++ int code, ++ int glyphno ++) ++{ ++ GLYPH *g; ++ ++ g = &glyph_list[glyphno]; ++ ++ if(transform) ++ fprintf(afm_file, "C %d ; WX %d ; N %s ; B %d %d %d %d ;\n", ++ code, g->scaledwidth, g->name, ++ iscale(g->xMin), iscale(g->yMin), iscale(g->xMax), iscale(g->yMax)); ++ else ++ fprintf(afm_file, "C %d ; WX %d ; N %s ; B %d %d %d %d ;\n", ++ code, g->scaledwidth, g->name, ++ g->xMin, g->yMin, g->xMax, g->yMax); ++} ++ ++/* ++ SB: ++ An important note about the BlueValues. ++ ++ The Adobe documentation says that the maximal width of a Blue zone ++ is connected to the value of BlueScale, which is by default 0.039625. ++ The BlueScale value defines, at which point size the overshoot ++ suppression be disabled. ++ ++ The formula for it that is given in the manual is: ++ ++ BlueScale=point_size/240, for a 300dpi device ++ ++ that makes us wonder what is this 240 standing for. Incidentally ++ 240=72*1000/300, where 72 is the relation between inches and points, ++ 1000 is the size of the glyph matrix, and 300dpi is the resolution of ++ the output device. Knowing that we can recalculate the formula for ++ the font size in pixels rather than points: ++ ++ BlueScale=pixel_size/1000 ++ ++ That looks a lot simpler than the original formula, does not it ? ++ And the limitation about the maximal width of zone also looks ++ a lot simpler after the transformation: ++ ++ max_width < 1000/pixel_size ++ ++ that ensures that even at the maximal pixel size when the overshoot ++ suppression is disabled the zone width will be less than one pixel. ++ This is important, failure to comply to this limit will result in ++ really ugly fonts (been there, done that). But knowing the formula ++ for the pixel width, we see that in fact we can use the maximal width ++ of 24, not 23 as specified in the manual. ++ ++*/ ++ ++#define MAXBLUEWIDTH (24) ++ ++/* ++ * Find the indexes of the most frequent values ++ * in the hystogram, sort them in ascending order, and save which one ++ * was the best one (if asked). ++ * Returns the number of values found (may be less than maximal because ++ * we ignore the zero values) ++ */ ++ ++#define MAXHYST (2000) /* size of the hystogram */ ++#define HYSTBASE 500 ++ ++static int ++besthyst( ++ int *hyst, /* the hystogram */ ++ int base, /* the base point of the hystogram */ ++ int *best, /* the array for indexes of best values */ ++ int nbest, /* its allocated size */ ++ int width, /* minimal difference between indexes */ ++ int *bestindp /* returned top point */ ++) ++{ ++ unsigned char hused[MAXHYST / 8 + 1]; ++ int i, max, j, w, last = 0; ++ int nf = 0; ++ ++ width--; ++ ++ memset(hused, 0 , sizeof hused); ++ ++ max = 1; ++ for (i = 0; i < nbest && max != 0; i++) { ++ best[i] = 0; ++ max = 0; ++ for (j = 1; j < MAXHYST - 1; j++) { ++ w = hyst[j]; ++ ++ if (w > max && (hused[j>>3] & (1 << (j & 0x07))) == 0) { ++ best[i] = j; ++ max = w; ++ } ++ } ++ if (max != 0) { ++ if (max < last/2) { ++ /* do not pick the too low values */ ++ break; ++ } ++ for (j = best[i] - width; j <= best[i] + width; j++) { ++ if (j >= 0 && j < MAXHYST) ++ hused[j >> 3] |= (1 << (j & 0x07)); ++ } ++ last = max; ++ best[i] -= base; ++ nf = i + 1; ++ } ++ } ++ ++ if (bestindp) ++ *bestindp = best[0]; ++ ++ /* sort the indexes in ascending order */ ++ for (i = 0; i < nf; i++) { ++ for (j = i + 1; j < nf; j++) ++ if (best[j] < best[i]) { ++ w = best[i]; ++ best[i] = best[j]; ++ best[j] = w; ++ } ++ } ++ ++ return nf; ++} ++ ++/* ++ * Find the next best Blue zone in the hystogram. ++ * Return the weight of the found zone. ++ */ ++ ++static int ++bestblue( ++ short *zhyst, /* the zones hystogram */ ++ short *physt, /* the points hystogram */ ++ short *ozhyst, /* the other zones hystogram */ ++ int *bluetab /* where to put the found zone */ ++) ++{ ++ int i, j, w, max, ind, first, last; ++ ++ /* find the highest point in the zones hystogram */ ++ /* if we have a plateau, take its center */ ++ /* if we have multiple peaks, take the first one */ ++ ++ max = -1; ++ first = last = -10; ++ for (i = 0; i <= MAXHYST - MAXBLUEWIDTH; i++) { ++ w = zhyst[i]; ++ if (w > max) { ++ first = last = i; ++ max = w; ++ } else if (w == max) { ++ if (last == i - 1) ++ last = i; ++ } ++ } ++ ind = (first + last) / 2; ++ ++ if (max == 0) /* no zones left */ ++ return 0; ++ ++ /* now we reuse `first' and `last' as inclusive borders of the zone */ ++ first = ind; ++ last = ind + (MAXBLUEWIDTH - 1); ++ ++ /* our maximal width is far too big, so we try to make it narrower */ ++ w = max; ++ j = (w & 1); /* a pseudo-random bit */ ++ while (1) { ++ while (physt[first] == 0) ++ first++; ++ while (physt[last] == 0) ++ last--; ++ if (last - first < (MAXBLUEWIDTH * 2 / 3) || (max - w) * 10 > max) ++ break; ++ ++ if (physt[first] < physt[last] ++ || (physt[first] == physt[last] && j)) { ++ if (physt[first] * 20 > w) /* if weight is >5%, ++ * stop */ ++ break; ++ w -= physt[first]; ++ first++; ++ j = 0; ++ } else { ++ if (physt[last] * 20 > w) /* if weight is >5%, ++ * stop */ ++ break; ++ w -= physt[last]; ++ last--; ++ j = 1; ++ } ++ } ++ ++ /* save our zone */ ++ bluetab[0] = first - HYSTBASE; ++ bluetab[1] = last - HYSTBASE; ++ ++ /* invalidate all the zones overlapping with this one */ ++ /* the constant of 2 is determined by the default value of BlueFuzz */ ++ for (i = first - (MAXBLUEWIDTH - 1) - 2; i <= last + 2; i++) ++ if (i >= 0 && i < MAXHYST) { ++ zhyst[i] = 0; ++ ozhyst[i] = 0; ++ } ++ return w; ++} ++ ++/* ++ * Try to find the Blue Values, bounding box and italic angle ++ */ ++ ++void ++findblues(void) ++{ ++ /* hystograms for upper and lower zones */ ++ short hystl[MAXHYST]; ++ short hystu[MAXHYST]; ++ short zuhyst[MAXHYST]; ++ short zlhyst[MAXHYST]; ++ int nchars; ++ int i, j, k, w, max; ++ GENTRY *ge; ++ GLYPH *g; ++ double ang; ++ ++ /* find the lowest and highest points of glyphs */ ++ /* and by the way build the values for FontBBox */ ++ /* and build the hystogram for the ItalicAngle */ ++ ++ /* re-use hystl for the hystogram of italic angle */ ++ ++ bbox[0] = bbox[1] = 5000; ++ bbox[2] = bbox[3] = -5000; ++ ++ for (i = 0; i < MAXHYST; i++) ++ hystl[i] = 0; ++ ++ nchars = 0; ++ ++ for (i = 0, g = glyph_list; i < numglyphs; i++, g++) { ++ if (g->flags & GF_USED) { ++ nchars++; ++ ++ g->rymin = 5000; ++ g->rymax = -5000; ++ for (ge = g->entries; ge != 0; ge = ge->next) { ++ if (ge->type == GE_LINE) { ++ ++ j = ge->iy3 - ge->prev->iy3; ++ k = ge->ix3 - ge->prev->ix3; ++ if (j > 0) ++ ang = atan2(-k, j) * 180.0 / M_PI; ++ else ++ ang = atan2(k, -j) * 180.0 / M_PI; ++ ++ k /= 100; ++ j /= 100; ++ if (ang > -45.0 && ang < 45.0) { ++ /* ++ * be careful to not overflow ++ * the counter ++ */ ++ hystl[HYSTBASE + (int) (ang * 10.0)] += (k * k + j * j) / 4; ++ } ++ if (ge->iy3 == ge->prev->iy3) { ++ if (ge->iy3 <= g->rymin) { ++ g->rymin = ge->iy3; ++ g->flatymin = 1; ++ } ++ if (ge->iy3 >= g->rymax) { ++ g->rymax = ge->iy3; ++ g->flatymax = 1; ++ } ++ } else { ++ if (ge->iy3 < g->rymin) { ++ g->rymin = ge->iy3; ++ g->flatymin = 0; ++ } ++ if (ge->iy3 > g->rymax) { ++ g->rymax = ge->iy3; ++ g->flatymax = 0; ++ } ++ } ++ } else if (ge->type == GE_CURVE) { ++ if (ge->iy3 < g->rymin) { ++ g->rymin = ge->iy3; ++ g->flatymin = 0; ++ } ++ if (ge->iy3 > g->rymax) { ++ g->rymax = ge->iy3; ++ g->flatymax = 0; ++ } ++ } ++ if (ge->type == GE_LINE || ge->type == GE_CURVE) { ++ if (ge->ix3 < bbox[0]) ++ bbox[0] = ge->ix3; ++ if (ge->ix3 > bbox[2]) ++ bbox[2] = ge->ix3; ++ if (ge->iy3 < bbox[1]) ++ bbox[1] = ge->iy3; ++ if (ge->iy3 > bbox[3]) ++ bbox[3] = ge->iy3; ++ } ++ } ++ } ++ } ++ ++ /* get the most popular angle */ ++ max = 0; ++ w = 0; ++ for (i = 0; i < MAXHYST; i++) { ++ if (hystl[i] > w) { ++ w = hystl[i]; ++ max = i; ++ } ++ } ++ ang = (double) (max - HYSTBASE) / 10.0; ++ WARNING_2 fprintf(stderr, "Guessed italic angle: %f\n", ang); ++ if (italic_angle == 0.0) ++ italic_angle = ang; ++ ++ /* build the hystogram of the lower points */ ++ for (i = 0; i < MAXHYST; i++) ++ hystl[i] = 0; ++ ++ for (i = 0, g = glyph_list; i < numglyphs; i++, g++) { ++ if ((g->flags & GF_USED) ++ && g->rymin + HYSTBASE >= 0 && g->rymin < MAXHYST - HYSTBASE) { ++ hystl[g->rymin + HYSTBASE]++; ++ } ++ } ++ ++ /* build the hystogram of the upper points */ ++ for (i = 0; i < MAXHYST; i++) ++ hystu[i] = 0; ++ ++ for (i = 0, g = glyph_list; i < numglyphs; i++, g++) { ++ if ((g->flags & GF_USED) ++ && g->rymax + HYSTBASE >= 0 && g->rymax < MAXHYST - HYSTBASE) { ++ hystu[g->rymax + HYSTBASE]++; ++ } ++ } ++ ++ /* build the hystogram of all the possible lower zones with max width */ ++ for (i = 0; i < MAXHYST; i++) ++ zlhyst[i] = 0; ++ ++ for (i = 0; i <= MAXHYST - MAXBLUEWIDTH; i++) { ++ for (j = 0; j < MAXBLUEWIDTH; j++) ++ zlhyst[i] += hystl[i + j]; ++ } ++ ++ /* build the hystogram of all the possible upper zones with max width */ ++ for (i = 0; i < MAXHYST; i++) ++ zuhyst[i] = 0; ++ ++ for (i = 0; i <= MAXHYST - MAXBLUEWIDTH; i++) { ++ for (j = 0; j < MAXBLUEWIDTH; j++) ++ zuhyst[i] += hystu[i + j]; ++ } ++ ++ /* find the baseline */ ++ w = bestblue(zlhyst, hystl, zuhyst, &bluevalues[0]); ++ if (0) ++ fprintf(stderr, "BaselineBlue zone %d%% %d...%d\n", w * 100 / nchars, ++ bluevalues[0], bluevalues[1]); ++ ++ if (w == 0) /* no baseline, something weird */ ++ return; ++ ++ /* find the upper zones */ ++ for (nblues = 2; nblues < 14; nblues += 2) { ++ w = bestblue(zuhyst, hystu, zlhyst, &bluevalues[nblues]); ++ ++ if (0) ++ fprintf(stderr, "Blue zone %d%% %d...%d\n", w * 100 / nchars, ++ bluevalues[nblues], bluevalues[nblues+1]); ++ ++ if (w * 20 < nchars) ++ break; /* don't save this zone */ ++ } ++ ++ /* find the lower zones */ ++ for (notherb = 0; notherb < 10; notherb += 2) { ++ w = bestblue(zlhyst, hystl, zuhyst, &otherblues[notherb]); ++ ++ if (0) ++ fprintf(stderr, "OtherBlue zone %d%% %d...%d\n", w * 100 / nchars, ++ otherblues[notherb], otherblues[notherb+1]); ++ ++ ++ if (w * 20 < nchars) ++ break; /* don't save this zone */ ++ } ++ ++} ++ ++/* ++ * Find the actual width of the glyph and modify the ++ * description to reflect it. Not guaranteed to do ++ * any good, may make character spacing too wide. ++ */ ++ ++void ++docorrectwidth(void) ++{ ++ int i; ++ GENTRY *ge; ++ GLYPH *g; ++ int xmin, xmax; ++ int maxwidth, minsp; ++ ++ /* enforce this minimal spacing, ++ * we limit the amount of the enforced spacing to avoid ++ * spacing the bold wonts too widely ++ */ ++ minsp = (stdhw>60 || stdhw<10)? 60 : stdhw; ++ ++ for (i = 0, g = glyph_list; i < numglyphs; i++, g++) { ++ g->oldwidth=g->scaledwidth; /* save the old width, will need for AFM */ ++ ++ if (correctwidth && g->flags & GF_USED) { ++ xmin = 5000; ++ xmax = -5000; ++ for (ge = g->entries; ge != 0; ge = ge->next) { ++ if (ge->type != GE_LINE && ge->type != GE_CURVE) ++ continue; ++ ++ if (ge->ix3 <= xmin) { ++ xmin = ge->ix3; ++ } ++ if (ge->ix3 >= xmax) { ++ xmax = ge->ix3; ++ } ++ } ++ ++ maxwidth=xmax+minsp; ++ if( g->scaledwidth < maxwidth ) { ++ g->scaledwidth = maxwidth; ++ WARNING_3 fprintf(stderr, "glyph %s: extended from %d to %d\n", ++ g->name, g->oldwidth, g->scaledwidth ); ++ } ++ } ++ } ++ ++} ++ ++/* ++ * Try to find the typical stem widths ++ */ ++ ++void ++stemstatistics(void) ++{ ++#define MINDIST 10 /* minimal distance between the widths */ ++ int hyst[MAXHYST+MINDIST*2]; ++ int best[12]; ++ int i, j, k, w; ++ int nchars; ++ int ns; ++ STEM *s; ++ GLYPH *g; ++ ++ /* start with typical stem width */ ++ ++ nchars=0; ++ ++ /* build the hystogram of horizontal stem widths */ ++ memset(hyst, 0, sizeof hyst); ++ ++ for (i = 0, g = glyph_list; i < numglyphs; i++, g++) { ++ if (g->flags & GF_USED) { ++ nchars++; ++ s = g->hstems; ++ for (j = 0; j < g->nhs; j += 2) { ++ if ((s[j].flags | s[j + 1].flags) & ST_END) ++ continue; ++ w = s[j + 1].value - s[j].value+1; ++ if(w==20) /* split stems should not be counted */ ++ continue; ++ if (w > 0 && w < MAXHYST - 1) { ++ /* ++ * handle some fuzz present in ++ * converted fonts ++ */ ++ hyst[w+MINDIST] += MINDIST-1; ++ for(k=1; kflags & GF_USED) { ++ s = g->vstems; ++ for (j = 0; j < g->nvs; j += 2) { ++ if ((s[j].flags | s[j + 1].flags) & ST_END) ++ continue; ++ w = s[j + 1].value - s[j].value+1; ++ if (w > 0 && w < MAXHYST - 1) { ++ /* ++ * handle some fuzz present in ++ * converted fonts ++ */ ++ hyst[w+MINDIST] += MINDIST-1; ++ for(k=1; knext) { ++ if(ge->type == GE_LINE || ge->type == GE_CURVE) { ++ if (ISDBG(REVERSAL)) ++ fprintf(stderr, "reverse path 0x%x <- 0x%x, 0x%x\n", ge, ge->prev, ge->bkwd); ++ ++ /* cut out the path itself */ ++ pge = ge->prev; /* GE_MOVE */ ++ if (pge == 0) { ++ fprintf(stderr, "**! No MOVE before line !!! Fatal. ****\n"); ++ exit(1); ++ } ++ nge = ge->bkwd->next; /* GE_PATH */ ++ pge->next = nge; ++ nge->prev = pge; ++ ge->bkwd->next = 0; /* mark end of chain */ ++ ++ /* remember the starting point */ ++ if(ge->flags & GEF_FLOAT) { ++ flast[0] = pge->fx3; ++ flast[1] = pge->fy3; ++ } else { ++ ilast[0] = pge->ix3; ++ ilast[1] = pge->iy3; ++ } ++ ++ /* then reinsert them in backwards order */ ++ for(cur = ge; cur != 0; cur = next ) { ++ next = cur->next; /* or addgeafter() will screw it up */ ++ if(cur->flags & GEF_FLOAT) { ++ for(i=0; i<2; i++) { ++ /* reverse the direction of path element */ ++ f = cur->fpoints[i][0]; ++ cur->fpoints[i][0] = cur->fpoints[i][1]; ++ cur->fpoints[i][1] = f; ++ f = flast[i]; ++ flast[i] = cur->fpoints[i][2]; ++ cur->fpoints[i][2] = f; ++ } ++ } else { ++ for(i=0; i<2; i++) { ++ /* reverse the direction of path element */ ++ n = cur->ipoints[i][0]; ++ cur->ipoints[i][0] = cur->ipoints[i][1]; ++ cur->ipoints[i][1] = n; ++ n = ilast[i]; ++ ilast[i] = cur->ipoints[i][2]; ++ cur->ipoints[i][2] = n; ++ } ++ } ++ addgeafter(pge, cur); ++ } ++ ++ /* restore the starting point */ ++ if(ge->flags & GEF_FLOAT) { ++ pge->fx3 = flast[0]; ++ pge->fy3 = flast[1]; ++ } else { ++ pge->ix3 = ilast[0]; ++ pge->iy3 = ilast[1]; ++ } ++ ++ ge = nge; ++ } ++ ++ } ++} ++ ++void ++reversepaths( ++ GLYPH * g ++) ++{ ++ reversepathsfromto(g->entries, NULL); ++} ++ ++/* add a kerning pair information, scales the value */ ++ ++void ++addkernpair( ++ unsigned id1, ++ unsigned id2, ++ int unscval ++) ++{ ++ static unsigned char *bits = 0; ++ static int lastid; ++ GLYPH *g = &glyph_list[id1]; ++ int i, n; ++ struct kern *p; ++ ++ if(unscval == 0 || id1 >= numglyphs || id2 >= numglyphs) ++ return; ++ ++ if( (glyph_list[id1].flags & GF_USED)==0 ++ || (glyph_list[id2].flags & GF_USED)==0 ) ++ return; ++ ++ if(bits == 0) { ++ bits = calloc( BITMAP_BYTES(numglyphs), 1); ++ if (bits == NULL) { ++ fprintf (stderr, "****malloc failed %s line %d\n", __FILE__, __LINE__); ++ exit(255); ++ } ++ lastid = id1; ++ } ++ ++ if(lastid != id1) { ++ /* refill the bitmap cache */ ++ memset(bits, 0,BITMAP_BYTES(numglyphs)); ++ p = g->kern; ++ for(i=g->kerncount; i>0; i--) { ++ n = (p++)->id; ++ SET_BITMAP(bits, n); ++ } ++ lastid = id1; ++ } ++ ++ if(IS_BITMAP(bits, id2)) ++ return; /* duplicate */ ++ ++ if(g->kerncount <= g->kernalloc) { ++ g->kernalloc += 8; ++ p = realloc(g->kern, sizeof(struct kern) * g->kernalloc); ++ if(p == 0) { ++ fprintf (stderr, "** realloc failed, kerning data will be incomplete\n"); ++ } ++ g->kern = p; ++ } ++ ++ SET_BITMAP(bits, id2); ++ p = &g->kern[g->kerncount]; ++ p->id = id2; ++ p->val = iscale(unscval) - (g->scaledwidth - g->oldwidth); ++ g->kerncount++; ++ kerning_pairs++; ++} ++ ++/* print out the kerning information */ ++ ++void ++print_kerning( ++ FILE *afm_file ++) ++{ ++ int i, j, n; ++ GLYPH *g; ++ struct kern *p; ++ ++ if( kerning_pairs == 0 ) ++ return; ++ ++ fprintf(afm_file, "StartKernData\n"); ++ fprintf(afm_file, "StartKernPairs %hd\n", kerning_pairs); ++ ++ for(i=0; iflags & GF_USED) ==0) ++ continue; ++ p = g->kern; ++ for(j=g->kerncount; j>0; j--, p++) { ++ fprintf(afm_file, "KPX %s %s %d\n", g->name, ++ glyph_list[ p->id ].name, p->val ); ++ } ++ } ++ ++ fprintf(afm_file, "EndKernPairs\n"); ++ fprintf(afm_file, "EndKernData\n"); ++} ++ ++ ++#if 0 ++ ++/* ++** This function is commented out because the information ++** collected by it is not used anywhere else yet. Now ++** it only collects the directions of contours. And the ++** direction of contours gets fixed already in draw_glyf(). ++** ++*********************************************** ++** ++** Here we expect that the paths are already closed. ++** We also expect that the contours do not intersect ++** and that curves doesn't cross any border of quadrant. ++** ++** Find which contours go inside which and what is ++** their proper direction. Then fix the direction ++** to make it right. ++** ++*/ ++ ++#define MAXCONT 1000 ++ ++void ++fixcontours( ++ GLYPH * g ++) ++{ ++ CONTOUR cont[MAXCONT]; ++ short ymax[MAXCONT]; /* the highest point */ ++ short xofmax[MAXCONT]; /* X-coordinate of any point ++ * at ymax */ ++ short ymin[MAXCONT]; /* the lowest point */ ++ short xofmin[MAXCONT]; /* X-coordinate of any point ++ * at ymin */ ++ short count[MAXCONT]; /* count of lines */ ++ char dir[MAXCONT]; /* in which direction they must go */ ++ GENTRY *start[MAXCONT], *minptr[MAXCONT], *maxptr[MAXCONT]; ++ int ncont; ++ int i; ++ int dx1, dy1, dx2, dy2; ++ GENTRY *ge, *nge; ++ ++ /* find the contours and their most upper/lower points */ ++ ncont = 0; ++ ymax[0] = -5000; ++ ymin[0] = 5000; ++ for (ge = g->entries; ge != 0; ge = ge->next) { ++ if (ge->type == GE_LINE || ge->type == GE_CURVE) { ++ if (ge->iy3 > ymax[ncont]) { ++ ymax[ncont] = ge->iy3; ++ xofmax[ncont] = ge->ix3; ++ maxptr[ncont] = ge; ++ } ++ if (ge->iy3 < ymin[ncont]) { ++ ymin[ncont] = ge->iy3; ++ xofmin[ncont] = ge->ix3; ++ minptr[ncont] = ge; ++ } ++ } ++ if (ge->frwd != ge->next) { ++ start[ncont++] = ge->frwd; ++ ymax[ncont] = -5000; ++ ymin[ncont] = 5000; ++ } ++ } ++ ++ /* determine the directions of contours */ ++ for (i = 0; i < ncont; i++) { ++ ge = minptr[i]; ++ nge = ge->frwd; ++ ++ if (ge->type == GE_CURVE) { ++ dx1 = ge->ix3 - ge->ix2; ++ dy1 = ge->iy3 - ge->iy2; ++ ++ if (dx1 == 0 && dy1 == 0) { /* a pathological case */ ++ dx1 = ge->ix3 - ge->ix1; ++ dy1 = ge->iy3 - ge->iy1; ++ } ++ if (dx1 == 0 && dy1 == 0) { /* a more pathological ++ * case */ ++ dx1 = ge->ix3 - ge->prev->ix3; ++ dy1 = ge->iy3 - ge->prev->iy3; ++ } ++ } else { ++ dx1 = ge->ix3 - ge->prev->ix3; ++ dy1 = ge->iy3 - ge->prev->iy3; ++ } ++ if (nge->type == GE_CURVE) { ++ dx2 = ge->ix3 - nge->ix1; ++ dy2 = ge->iy3 - nge->iy1; ++ if (dx1 == 0 && dy1 == 0) { /* a pathological case */ ++ dx2 = ge->ix3 - nge->ix2; ++ dy2 = ge->iy3 - nge->iy2; ++ } ++ if (dx1 == 0 && dy1 == 0) { /* a more pathological ++ * case */ ++ dx2 = ge->ix3 - nge->ix3; ++ dy2 = ge->iy3 - nge->iy3; ++ } ++ } else { ++ dx2 = ge->ix3 - nge->ix3; ++ dy2 = ge->iy3 - nge->iy3; ++ } ++ ++ /* compare angles */ ++ cont[i].direction = DIR_INNER; ++ if (dy1 == 0) { ++ if (dx1 < 0) ++ cont[i].direction = DIR_OUTER; ++ } else if (dy2 == 0) { ++ if (dx2 > 0) ++ cont[i].direction = DIR_OUTER; ++ } else if (dx2 * dy1 < dx1 * dy2) ++ cont[i].direction = DIR_OUTER; ++ ++ cont[i].ymin = ymin[i]; ++ cont[i].xofmin = xofmin[i]; ++ } ++ ++ /* save the information that may be needed further */ ++ g->ncontours = ncont; ++ if (ncont > 0) { ++ g->contours = malloc(sizeof(CONTOUR) * ncont); ++ if (g->contours == 0) { ++ fprintf(stderr, "***** Memory allocation error *****\n"); ++ exit(255); ++ } ++ memcpy(g->contours, cont, sizeof(CONTOUR) * ncont); ++ } ++} ++ ++#endif ++ ++/* ++ * ++ */ ++ +diff -ruN xserver-old/hw/xprint/extras/ttf2pt1/pt1.h xserver/hw/xprint/extras/ttf2pt1/pt1.h +--- xserver-old/hw/xprint/extras/ttf2pt1/pt1.h 1970-01-01 10:00:00.000000000 +1000 ++++ xserver/hw/xprint/extras/ttf2pt1/pt1.h 2006-06-27 13:10:26.000000000 +1000 +@@ -0,0 +1,257 @@ ++/* ++ * see COPYRIGHT ++ */ ++ ++ ++/* glyph entry, one drawing command */ ++typedef struct gentry { ++ /* this list links all GENTRYs of a GLYPH sequentially */ ++ struct gentry *next; /* double linked list */ ++ struct gentry *prev; ++ ++ /* this list links all GENTRYs of one contour - ++ * of types GE_LINE and GE_CURVE only ++ * bkwd is also reused: in the very first entry (normally ++ * of type GE_MOVE) it points to g->entries ++ */ ++ struct gentry *cntr[2]; /* double-linked circular list */ ++/* convenience handles */ ++#define bkwd cntr[0] ++#define frwd cntr[1] ++ ++ /* various extended structures used at some stage of transformation */ ++ void *ext; ++ ++ union { ++ struct { ++ int val[2][3]; /* integer values */ ++ } i; ++ struct { ++ double val[2][3]; /* floating values */ ++ } f; ++ } points; /* absolute values, NOT deltas */ ++/* convenience handles */ ++#define ipoints points.i.val ++#define fpoints points.f.val ++#define ixn ipoints[0] ++#define iyn ipoints[1] ++#define fxn fpoints[0] ++#define fyn fpoints[1] ++#define ix1 ixn[0] ++#define ix2 ixn[1] ++#define ix3 ixn[2] ++#define iy1 iyn[0] ++#define iy2 iyn[1] ++#define iy3 iyn[2] ++#define fx1 fxn[0] ++#define fx2 fxn[1] ++#define fx3 fxn[2] ++#define fy1 fyn[0] ++#define fy2 fyn[1] ++#define fy3 fyn[2] ++ ++ char flags; ++#define GEF_FLOAT 0x02 /* entry contains floating point data */ ++#define GEF_LINE 0x04 /* entry looks like a line even if it's a curve */ ++ ++ unsigned char dir; /* used to temporarily store the values for ++ * the directions of the ends of curves */ ++/* front end */ ++#define CVDIR_FUP 0x02 /* goes over the line connecting the ends */ ++#define CVDIR_FEQUAL 0x01 /* coincides with the line connecting the ++ * ends */ ++#define CVDIR_FDOWN 0x00 /* goes under the line connecting the ends */ ++#define CVDIR_FRONT 0x0F /* mask of all front directions */ ++/* rear end */ ++#define CVDIR_RSAME 0x30 /* is the same as for the front end */ ++#define CVDIR_RUP 0x20 /* goes over the line connecting the ends */ ++#define CVDIR_REQUAL 0x10 /* coincides with the line connecting the ++ * ends */ ++#define CVDIR_RDOWN 0x00 /* goes under the line connecting the ends */ ++#define CVDIR_REAR 0xF0 /* mask of all rear directions */ ++ ++ signed char stemid; /* connection to the substituted stem group */ ++ char type; ++#define GE_HSBW 'B' ++#define GE_MOVE 'M' ++#define GE_LINE 'L' ++#define GE_CURVE 'C' ++#define GE_PATH 'P' ++ ++ /* indexes of the points to be used for calculation of the tangents */ ++ signed char ftg; /* front tangent */ ++ signed char rtg; /* rear tangent, -1 means "idx 2 of the previous entry" */ ++} GENTRY; ++ ++/* stem structure, describes one [hv]stem */ ++/* acually, it describes one border of a stem */ ++/* the whole stem is a pair of these structures */ ++ ++typedef struct stem { ++ short value; /* value of X or Y coordinate */ ++ short origin; /* point of origin for curve stems */ ++ GENTRY *ge; /* entry that has (value, origin) as its first dot */ ++ /* also for all the stems the couple (value, origin) ++ * is used to determine whether a stem is relevant for a ++ * line, it's considered revelant if this tuple is ++ * equal to any of the ends of the line. ++ * ge is also used to resolve ambiguity if there is more than ++ * one line going through certain pointi, it is used to ++ * distinguish these lines. ++ */ ++ ++ short from, to; /* values of other coordinate between ++ * which this stem is valid */ ++ ++ short flags; ++ /* ordering of ST_END, ST_FLAT, ST_ZONE is IMPORTANT for sorting */ ++#define ST_END 0x01 /* end of line, lowest priority */ ++#define ST_FLAT 0x02 /* stem is defined by a flat line, not a ++ * curve */ ++#define ST_ZONE 0x04 /* pseudo-stem, the limit of a blue zone */ ++#define ST_UP 0x08 /* the black area is to up or right from ++ * value */ ++#define ST_3 0x20 /* first stem of [hv]stem3 */ ++#define ST_BLUE 0x40 /* stem is in blue zone */ ++#define ST_TOPZONE 0x80 /* 1 - top zone, 0 - bottom zone */ ++#define ST_VERT 0x100 /* vertical stem (used in substitutions) */ ++} STEM; ++ ++#define MAX_STEMS 2000 /* we can't have more stems than path ++ * elements (or hope so) */ ++#define NSTEMGRP 50 /* maximal number of the substituted stem groups */ ++ ++/* structure for economical representation of the ++ * substituted stems ++ */ ++ ++typedef struct stembounds { ++ short low; /* low bound */ ++ short high; /* high bound */ ++ char isvert; /* 1 - vertical, 0 - horizontal */ ++ char already; /* temp. flag: is aleready included */ ++} STEMBOUNDS; ++ ++struct kern { ++ unsigned id; /* ID of the second glyph */ ++ int val; /* kerning value */ ++}; ++ ++typedef struct contour { ++ short ymin, xofmin; ++ short inside; /* inside which contour */ ++ char direction; ++#define DIR_OUTER 1 ++#define DIR_INNER 0 ++} CONTOUR; ++ ++typedef struct glyph { ++ int char_no;/* Encoding of glyph */ ++ int orig_code;/* code of glyph in the font's original encoding */ ++ char *name; /* Postscript name of glyph */ ++ int xMin, yMin, xMax, yMax; /* values from TTF dictionary */ ++ int lsb; /* left sidebearing */ ++ int ttf_pathlen; /* total length of TTF paths */ ++ short width; ++ short flags; ++#define GF_USED 0x0001 /* whether is this glyph used in T1 font */ ++#define GF_FLOAT 0x0002 /* thys glyph contains floating point entries */ ++ ++ GENTRY *entries;/* doube linked list of entries */ ++ GENTRY *lastentry; /* the last inserted entry */ ++ GENTRY *path; /* beggining of the last path */ ++ int oldwidth; /* actually also scaled */ ++ int scaledwidth; ++#define MAXLEGALWIDTH 10000 ++ ++ struct kern *kern; /* kerning data */ ++ int kerncount; /* number of kerning pairs */ ++ int kernalloc; /* for how many pairs we have space */ ++ ++ STEM *hstems; /* global horiz. and vert. stems */ ++ STEM *vstems; ++ int nhs, nvs; /* numbers of stems */ ++ ++ STEMBOUNDS *sbstems; /* substituted stems for all the groups */ ++ short *nsbs; /* indexes of the group ends in the common array */ ++ int nsg; /* actual number of the stem groups */ ++ int firstsubr; /* first substistuted stems subroutine number */ ++ ++ CONTOUR *contours; /* it is not used now */ ++ int ncontours; ++ ++ int rymin, rymax; /* real values */ ++ /* do we have flat surfaces on top/bottom */ ++ char flatymin, flatymax; ++ ++} GLYPH; ++ ++/* description of a dot for calculation of its distance to a curve */ ++ ++struct dot_dist { ++ double p[2 /*X,Y*/]; /* coordinates of a dot */ ++ double dist2; /* squared distance from the dot to the curve */ ++ short seg; /* the closest segment of the curve */ ++}; ++ ++extern int stdhw, stdvw; /* dominant stems widths */ ++extern int stemsnaph[12], stemsnapv[12]; /* most typical stem width */ ++ ++extern int bluevalues[14]; ++extern int nblues; ++extern int otherblues[10]; ++extern int notherb; ++extern int bbox[4]; /* the FontBBox array */ ++extern double italic_angle; ++ ++extern GLYPH *glyph_list; ++extern int encoding[]; /* inverse of glyph[].char_no */ ++ ++/* prototypes of functions */ ++void rmoveto( int dx, int dy); ++void rlineto( int dx, int dy); ++void rrcurveto( int dx1, int dy1, int dx2, int dy2, int dx3, int dy3); ++void assertpath( GENTRY * from, char *file, int line, char *name); ++ ++void fg_rmoveto( GLYPH * g, double x, double y); ++void ig_rmoveto( GLYPH * g, int x, int y); ++void fg_rlineto( GLYPH * g, double x, double y); ++void ig_rlineto( GLYPH * g, int x, int y); ++void fg_rrcurveto( GLYPH * g, double x1, double y1, ++ double x2, double y2, double x3, double y3); ++void ig_rrcurveto( GLYPH * g, int x1, int y1, ++ int x2, int y2, int x3, int y3); ++void g_closepath( GLYPH * g); ++ ++void pathtoint( GLYPH *g); ++void ffixquadrants( GLYPH *g); ++void flattencurves( GLYPH * g); ++int checkcv( GENTRY * ge, int dx, int dy); ++void iclosepaths( GLYPH * g); ++void fclosepaths( GLYPH * g); ++void smoothjoints( GLYPH * g); ++void buildstems( GLYPH * g); ++void fstraighten( GLYPH * g); ++void istraighten( GLYPH * g, int zigonly); ++void isplitzigzags( GLYPH * g); ++void fsplitzigzags( GLYPH * g); ++void fforceconcise( GLYPH * g); ++void iforceconcise( GLYPH * g); ++void reversepathsfromto( GENTRY * from, GENTRY * to); ++void reversepaths( GLYPH * g); ++void dumppaths( GLYPH * g, GENTRY *start, GENTRY *end); ++void print_glyph( int glyphno); ++int print_glyph_subs( int glyphno, int startid); ++void print_glyph_metrics( int code, int glyphno); ++void findblues(void); ++void stemstatistics(void); ++void docorrectwidth(void); ++void addkernpair( unsigned id1, unsigned id2, int unscval); ++void print_kerning( FILE *afm_file); ++ ++int fcrossrayscv( double curve[4][2], double *max1, double *max2); ++int fcrossraysge( GENTRY *ge1, GENTRY *ge2, double *max1, double *max2, ++ double crossdot[2][2]); ++double fdotsegdist2( double seg[2][2], double dot[2]); ++double fdotcurvdist2( double curve[4][2], struct dot_dist *dots, int ndots, double *maxp); ++void fapproxcurve( double cv[4][2], struct dot_dist *dots, int ndots); +diff -ruN xserver-old/hw/xprint/extras/ttf2pt1/README.FIRST xserver/hw/xprint/extras/ttf2pt1/README.FIRST +--- xserver-old/hw/xprint/extras/ttf2pt1/README.FIRST 1970-01-01 10:00:00.000000000 +1000 ++++ xserver/hw/xprint/extras/ttf2pt1/README.FIRST 2006-06-27 13:10:26.000000000 +1000 +@@ -0,0 +1,4 @@ ++To get the plain-text README and installation guides run: ++ ++ make docs ++ +diff -ruN xserver-old/hw/xprint/extras/ttf2pt1/README.html xserver/hw/xprint/extras/ttf2pt1/README.html +--- xserver-old/hw/xprint/extras/ttf2pt1/README.html 1970-01-01 10:00:00.000000000 +1000 ++++ xserver/hw/xprint/extras/ttf2pt1/README.html 2006-06-27 13:10:26.000000000 +1000 +@@ -0,0 +1,1182 @@ ++ ++ ++ ++TTF2PT1 - A True Type to PostScript Type 1 Converter ++ ++ ++ ++ ++

++ ++TTF2PT1 - A True Type to PostScript Type 1 Font Converter ++ ++

++ ++ ++ ++[ ++
++ ++ Based on ttf2pfa by Andrew Weeks, and help from Frank Siegert. ++
++ Modification by Mark Heath. ++
++ Further modification by Sergey Babkin. ++
++ The Type1 assembler by I. Lee Hetherington with modifications by ++ Kai-Uwe Herbing. ++ ++
++] ++
++

++ ++Ever wanted to install a particular font on your XServer but only could find ++the font you are after in True Type Format? ++

++ ++Ever asked comp.fonts for a True Type to Type 1 converter and got a List ++of Commercial software that doesn't run on your Operating System? ++

++ ++Well, this program should be the answer. This program is written in C (so it ++should be portable) and therefore should run on any OS. The only limitation ++is that the program requires some method of converting Big endian integers into ++local host integers so the network functions ntohs and ntohl are used. These ++can be replaced by macros if your platform doesn't have them. ++Of course the target platform requires a C compiler and command line ability. ++

++ ++ ++Ttf2pt1 is a font converter from the True Type format (and some other formats ++supported by the FreeType library as well) to the Adobe Type1 format. ++

++ ++The versions 3.0 and later got rather extensive post-processing algorithm that ++brings the converted fonts to the requirements of the Type1 standard, tries to ++correct the rounding errors introduced during conversions and some simple ++kinds of bugs that are typical for the public domain TTF fonts. It ++also generates the hints that enable much better rendering of fonts in ++small sizes that are typical for the computer displays. But everything ++has its price, and some of the optimizations may not work well for certain ++fonts. That's why the options were added to the converter, to control ++the performed optimizations. ++

++ ++ ++The converter is simple to run, just: ++

++ ++ ++

++ ttf2pt1 [-options] ttffont.ttf [Fontname] ++
++or ++
++ ttf2pt1 [-options] ttffont.ttf - ++
++ ++

++ ++ ++The first variant creates the file Fontname.pfa (or Fontname.pfb if the ++option '-b' was used) with the converted font and Fontname.afm with the ++font metrics, the second one prints the font or another file (if the option ++'-G' was used) on the standard output from where it can be immediately ++piped through some filter. If no Fontname is specified for the first ++variant, the name is generated from ttffont by replacing the .ttf ++filename suffix. ++

++ ++Most of the time no options are neccessary (with a possible exception ++of '-e'). But if there are some troubles with the resulting font, they ++may be used to control the conversion. ++The options are: ++

++ ++ ++ ++-a - Include all the glyphs from the source file into the converted ++ file. If this option is not specified then only the glyphs that have ++ been assigned some encoding are included, because the rest of glyphs ++ would be inaccessible anyway and would only consume the disk space. ++ But some applications are clever enough to change the encoding on ++ the fly and thus use the other glyphs, in this case they could ++ benefit from using this option. But there is a catch: the X11 library ++ has rather low limit for the font size. Including more glyphs increases ++ the file size and thus increases the chance of hitting this limit. ++ See app/X11/README for the description of a ++ patch to X11 which fixes this problem. ++

++ ++ ++-b - Encode the resulting font to produce a ready .pfb file. ++

++ ++ ++-d suboptions - Debugging options. The suboptions are: ++

++ ++

++ a - Print out the absolute coordinates of dots in outlines. Such ++ a font can not be used by any program (that's why this option is ++ incompatible with '-e') but it has proven to be a valuable debuging ++ information. ++

++ ++ r - Do not reverse the direction of outlines. The TTF fonts have ++ the standard direction of outlines opposite to the Type1 fonts. So ++ they should be reversed during proper conversion. This option ++ may be used for debugging or to handle a TTF font with wrong ++ direction of outlines (possibly, converted in a broken way from ++ a Type1 font). The first signs of the wrong direction are the ++ letters like "P" or "B" without the unpainted "holes" inside. ++

++

++ ++ ++-e - Assemble the resulting font to produce a ready .pfa file. ++ ++ [ S.B.: Personally I don't think that this option is particularly useful. ++ The same result may be achieved by piping the unassembled data ++ through t1asm, the Type 1 assembler. And, anyways, it's good to ++ have the t1utils package handy. But Mark and many users think that ++ this functionality is good and it took not much time to add this option. ] ++ ++

++ ++ ++-F - Force the Unicode encoding: any type of MS encoding specified ++ in the font is ignored and the font is treated like it has Unicode ++ encoding. WARNING: this option is intended for buggy fonts ++ which actually are in Unicode but are marked as something else. The ++ effect on the other fonts is unpredictable. ++

++ ++ ++-G suboptions - File generation options. The suboptions may be lowercase ++ or uppercase, the lowercase ones disable the generation of particular ++ files, the corresponding uppercase suboptions enable the generation of the ++ same kind of files. If the result of ttf2pt1 is requested to be printed on ++ the standard output, the last enabling suboption of -G determines ++ which file will be written to the standard output and the rest of files ++ will be discarded. For example, -G A will request the AFM file. ++ The suboptions to disable/enable the generation of the files are: ++

++ ++

++ f/F - The font file. Depending on the other options this file ++ will have one of the suffixes .t1a, .pfa or .pfb. If the conversion result ++ is requested on the standard output ('-' is used as the output file name) ++ then the font file will also be written there by default, if not overwritten ++ by another suboption of -G. ++ Default: enabled ++

++ ++ a/A - The Adobe font metrics file (.afm). ++ Default: enabled ++

++ ++ e/E - The dvips encoding file (.enc). ++ Default: disabled ++

++ ++

++ ++ ++-l language[+argument] - Extract the fonts for the specified language from a ++ multi-language Unicode font. If this option is not used the converter ++ tries to guess the language by the values of the shell variable LANG. ++ If it is not able to guess the language by LANG it tries all the ++ languages in the order they are listed. ++

++ ++ After the plus sign an optional argument for the language extractor ++ may be specified. The format of the argument is absolutely up to ++ the particular language converter. The primary purpose of the ++ argument is to support selection of planes for the multi-plane ++ Eastern encodings but it can also be used in any other way. The ++ language extractor may decide to add the plane name in some form ++ to the name of the resulting font. None of the currently supported ++ languages make any use of the argument yet. ++

++ ++ As of now the following languages are supported: ++
++   latin1 - for all the languages using the Latin-1 encoding ++
++   latin2 - for the Central European languages ++
++   latin4 - for the Baltic languages ++
++   latin5 - for the Turkish language ++
++   cyrillic - for the languages with Cyrillic alphabet ++
++   russian - historic synonym for cyrillic ++
++   bulgarian - historic synonym for cyrillic ++
++   adobestd - for the AdobeStandard encoding used by TeX ++
++   plane+argument - to select one plane from a multi-byte encoding ++

++ ++ The argument of the "plane" language may be in one of three forms: ++

++   plane+pid=<pid>,eid=<eid> ++
++   plane+pid=<pid>,eid=<eid>,<plane_number> ++
++   plane+<plane_number> ++

++ ++ Pid (TTF platform id) and eid (TTF encoding id) select a particular ++ TTF encoding table in the original font. They are specified as decimal ++ numbers. If this particular encoding table is not present in the font ++ file then the conversion fails. The native ("ttf") front-end parser supports ++ only pid=3 (Windows platform), the FreeType-based ("ft") front-end supports ++ any platform. If pid/eid is not specified then the TTF encoding table is ++ determined as usual: Unicode encoding if it's first or an 8-bit encoding ++ if not (and for an 8-bit encoding the plane number is silently ignored). ++ To prevent the converter from falling back to an 8-bit encoding, specify ++ the Unicode pid/eid value explicitly. ++

++ ++ Plane_number is a hexadecimal (if starts with "0x") or decimal number. ++ It gives the values of upper bytes for which 256 characters will be ++ selected. If not specified, defaults to 0. It is also used as a font ++ name suffix (the leading "0x" is not included into the suffix). ++

++ ++ ++ NOTE: ++ ++ It seems that many Eastern fonts use features of the TTF format that are ++ not supported by the ttf2pt1's built-in front-end parser. Because of ++ this for now we recommend using the FreeType-based parser (option ++ '-p ft') with the "plane" language. ++

++ ++ ++ ++ ++ NOTE: ++ You may notice that the language names are not uniform: some are the ++ names of particular languages and some are names of encodings. This ++ is because of the different approaches. The original idea was to ++ implement a conversion from Unicode to the appropriate Windows ++ encoding for a given language. And then use the translation tables ++ to generate the fonts in whatever final encodings are needed. This ++ would allow to pile together the Unicode fonts and the non-Unicode ++ Windows fonts for that language and let the program to sort them out ++ automatically. And then generate fonts in all the possible encodings ++ for that language. An example of this approach is the Russian language ++ support. But if there is no multiplicity of encodings used for some ++ languages and if the non-Unicode fonts are not considered important ++ by the users, another way would be simpler to implement: just provide ++ only one table for extraction of the target encoding from Unicode ++ and don't bother with the translation tables. The latin* "languages" ++ are examples of this approach. If somebody feels that he needs the ++ Type1 fonts both in Latin-* and Windows encodings he or she is absolutely ++ welcome to submit the code to implement it. ++

++ ++ WARNING: ++ Some of the glyphs included into the AdobeStandard encoding are not ++ included into the Unicode standard. The most typical examples of such ++ glyphs are ligatures like 'fi', 'fl' etc. Because of this the font ++ designers may place them at various places. The converter tries to ++ do its best, if the glyphs have honest Adobe names and/or are ++ placed at the same codes as in the Microsoft fonts they will be ++ picked up. Otherwise a possible solution is to use the option '-L' ++ with an external map. ++

++ ++ ++-L file[+[pid=<pid>,eid=<eid>,][plane]] - Extract the fonts for the specified ++ language from a multi-language font using the map from this file. This is ++ rather like the option '-l' but the encoding map is not ++ compiled into the program, it's taken from that file, so it's ++ easy to edit. Examples of such files are provided in ++ maps/adobe-standard-encoding.map, CP1250.map. (NOTE: ++ the 'standard encoding' map does not include all the glyphs of the ++ AdobeStandard encoding, it's provided only as an example.) The ++ description of the supported map formats is in the file ++ maps/unicode-sample.map. ++

++ ++ Likewise to '-l', an argument may be specified after the map file ++ name. But in this case the argument has fixed meaning: it selects the ++ original TTF encoding table (the syntax is the same as in '-l plane') ++ and/or a plane of the map file. The plane name also gets added after dash ++ to the font name. The plane is a concept used in the Eastern fonts with big ++ number of glyphs: one TTF font gets divided into multiple Type1 fonts, ++ each containing one plane of up to 256 glyphs. But with a little ++ creativity this concept may be used for other purposes of combining ++ multiple translation maps into one file. To extract multiple planes ++ from a TTF font ttf2pt1 must be run multiple times, each time with ++ a different plane name specified. ++

++ ++ The default original TTF encoding table used for the option '-L' is ++ Unicode. The map files may include directives to specify different original ++ TTF encodings. However if the pid/eid pair is specified with ++ it overrides any original encoding specified in the map file. ++

++ ++ ++-m type=value - Set maximal or minimal limits of resources. ++ These limits control the the font generation by limiting the resources ++ that the font is permitted to require from the PostScript interpreter. ++ The currently supported types of limits are: ++

++ ++

++ h - the maximal hint stack depth for the substituted hints. ++ The default value is 128, according to the limitation in X11. This seems to ++ be the lowest (and thus the safest) widespread value. To display the ++ hint stack depth required by each glyph in a .t1a file use the script ++ scripts/cntstems.pl. ++

++

++ ++ ++-O suboptions - Outline processing options. The suboptions ++ may be lowercase or uppercase, the lowercase ones disable the features, ++ the corresponding uppercase suboptions enable the same features. ++ The suboptions to disable/enable features are: ++

++ ++

++ b/B - Guessing of the ForceBold parameter. This parameter helps ++ the Type1 engine to rasterize the bold fonts properly at small sizes. ++ But the algorithm used to guess the proper value of this flag makes ++ that guess based solely on the font name. In rare cases that may cause ++ errors, in these cases you may want to disable this guessing. ++ Default: enabled ++

++ ++ h/H - Autogeneration of hints. The really complex outlines ++ may confuse the algorithm, so theoretically it may be useful ++ sometimes to disable them. Although up to now it seems that ++ even bad hints are better than no hints at all. ++ Default: enabled ++

++ ++ u/U - Hint substitution. Hint substitution is a technique ++ permitting generation of more detailed hints for the rasterizer. It allows ++ to use different sets of hints for different parts of a glyph and change ++ these sets as neccessary during rasterization (that's why "substituted"). ++ So it should improve the quality of the fonts rendered at small sizes. ++ But there are two catches: First, the X11 library has rather low limit for ++ the font size. More detailed hints increase the file size and thus increase ++ the chance of hitting this limit (that does not mean that you shall hit it ++ but you may if your fonts are particularly big). This is especially ++ probable for Unicode fonts converted with option '-a', so you may want to ++ use '-a' together with '-Ou'. See app/X11/README for the description of ++ a patch to X11 which fixes this problem. Second, some rasterizers (again, ++ X11 is the typical example) have a limitation for total number of hints ++ used when drawing a glyph (also known as the hint stack depth). If that ++ stack overflows the glyph is ignored. Starting from version 3.22 ttf2pt1 ++ uses algorithms to minimizing this depth, with the trade-off of slightly ++ bigger font files. The glyphs which still exceed the limit set by option ++ '-mh' have all the substituted hints removed and only base hints left. ++ The algorithms seem to have been refined far enough to make the fonts with ++ substituted hints look better than the fonts without them or at least the ++ same. Still if the original fonts are not well-designed the detailed ++ hinting may emphasize the defects of the design, such as non-even thickness ++ of lines. So provided that you are not afraid of the X11 bug the best idea ++ would be to generate a font with this feature and without it, then compare ++ the results using the program other/cmpf (see the description ++ in other/README) and decide which one looks better. ++ Default: enabled ++

++ ++ o/O - Space optimization of the outlines' code. This kind of optimization ++ never hurts, and the only reason to disable this feature is for comparison ++ of the generated fonts with the fonts generated by the previous versions of ++ converter. Well, it _almost_ never hurts. As it turned out there exist ++ some brain-damaged printers which don't understand it. Actually this ++ feature does not change the outlines at all. The Type 1 font manual ++ provides a set of redundant operators that make font description shorter, ++ such as '10 hlineto' instead of '0 10 rlineto' to describe a horizontal ++ line. This feature enables use of these operators. ++ Default: enabled ++

++ ++ s/S - Smoothing of outlines. If the font is broken in some ++ way (even the ones that are not easily noticeable), such smoothing ++ may break it further. So disabling this feature is the first thing to be ++ tried if some font looks odd. But with smoothing off the hint generation ++ algorithms may not work properly too. ++ Default: enabled ++

++ ++ t/T - Auto-scaling to the 1000x1000 Type1 standard matrix. The ++ TTF fonts are described in terms of an arbitrary matrix up to ++ 4000x4000. The converted fonts must be scaled to conform to ++ the Type1 standard. But the scaling introduces additional rounding ++ errors, so it may be curious sometimes to look at the font in its ++ original scale. ++ Default: enabled ++

++ ++ v/V - Do vectorization on the bitmap fonts. Functionally ++ "vectorization" is the same thing as "autotracing", a different word is ++ used purely to differentiate it from the Autotrace library. It tries to ++ produce nice smooth outlines from bitmaps. This feature is still a work ++ in progress though the results are already mostly decent. ++ Default: disabled ++

++ ++ w/W - Glyphs' width corection. This option is designed to be ++ used on broken fonts which specify too narrow widths for the ++ letters. You can tell that a font can benefit from this option ++ if you see that the characters are smashed together without ++ any whitespace between them. This option causes the converter ++ to set the character widths to the actual width of this character ++ plus the width of a typical vertical stem. But on the other hand ++ the well-designed fonts may have characters that look better if ++ their widths are set slightly narrower. Such well-designed fonts ++ will benefit from disabling this feature. You may want to convert ++ a font with and without this feature, compare the results and ++ select the better one. This feature may be used only on proportional ++ fonts, it has no effect on the fixed-width fonts. ++ Default: disabled ++

++ ++ z/Z - Use the Autotrace library on the bitmap fonts. The results ++ are horrible and the use of this option is not recommended. This option is ++ present for experimental purposes. It may change or be removed in the ++ future. The working tracing can be achieved with option -OV. ++ Default: disabled ++

++

++ ++ ++-p parser_name - Use the specified front-end parser to read the font file. ++ If this option is not used, ttf2pt1 selects the parser automatically based ++ on the suffix of the font file name, it uses the first parser in its ++ list that supports this font type. Now two parsers are supported: ++

++ ++   ttf - built-in parser for the ttf files (suffix .ttf) ++
++   bdf - built-in parser for the BDF files (suffix .bdf) ++
++   ft - parser based on the FreeType-2 library (suffixes .ttf, ++ .otf, .pfa, .pfb) ++

++ ++ The parser ft is NOT linked in by default. See Makefile ++ for instructions how to enable it. We do no support this parser on ++ Windows: probably it will work but nobody tried and nobody knows how ++ to build it. ++

++ ++ The conversion of the bitmap fonts (such as BDF) is simplistic yet, ++ producing jagged outlines. When converting such fonts, it might be ++ a good idea to turn off the hint substitution (using option -Ou) ++ because the hints produced will be huge but not adding much to the ++ quality of the fonts. ++

++ ++ ++-u number - Mark the font with this value as its ++ UniqueID. The UniqueID is used by the printers with the hard disks ++ to cache the rasterized characters and thus significantly ++ speed-up the printing. Some of those printers just can't ++ store the fonts without UniqueID on their disk.The problem ++ is that the ID is supposed to be unique, as it name says. And ++ there is no easy way to create a guaranteed unique ID. Adobe specifies ++ the range 4000000-4999999 for private IDs but still it's difficult ++ to guarantee the uniqueness within it. So if you don't really need the ++ UniqueID don't use it, it's optional. Luckily there are a few millions of ++ possible IDs, so the chances of collision are rather low. ++ If instead of the number a special value 'A' is given ++ then the converter generates the value of UniqueID automatically, ++ as a hash of the font name. (NOTE: in the version 3.22 the ++ algorithm for autogeneration of UniqueID was changed to fit the values ++ into the Adobe-spacified range. This means that if UniqueIDs were used ++ then the printer's cache may need to be flushed before replacing the ++ fonts converted by an old version with fonts converted by a newer version). ++ A simple way to find if any of the fonts in a given directory have ++ duplicated UniqueIDs is to use the command: ++

++ ++   cat *.pf[ab] | grep UniqueID | sort | uniq -c | grep -v ' 1 ' ++

++ ++ Or if you use scripts/convert it will do that for you automatically ++ plus it will also give the exact list of files with duplicate UIDs. ++

++ ++ ++-v size - Re-scale the font to get the size of a typical uppercase ++ letter somewhere around the specified size. Actually, it re-scales ++ the whole font to get the size of one language-dependent letter to be ++ at least of the specified size. Now this letter is "A" in all the ++ supported languages. The size is specified in the points of the ++ Type 1 coordinate grids, the maximal value is 1000. This is an ++ experimental option and should be used with caution. It tries to ++ increase the visible font size for a given point size and thus make ++ the font more readable. But if overused it may cause the fonts to ++ look out of scale. As of now the interesting values of size for ++ this option seem to be located mostly between 600 and 850. This ++ re-scaling may be quite useful but needs more experience to ++ understand the balance of its effects. ++

++ ++ ++-W level - Select the verbosity level of the warnings. ++ Currently the levels from 0 to 4 are supported. Level 0 means no warnings ++ at all, level 4 means all the possible warnings. The default level is 3. ++ Other levels may be added in the future, so using the level number 99 is ++ recommended to get all the possible warnings. Going below level 2 is ++ not generally recommended because you may miss valuable information about ++ the problems with the fonts being converted. ++

++ ++ ++Obsolete option: ++-A - Print the font metrics (.afm file) instead of the font on STDOUT. ++ Use -GA instead. ++

++ ++ ++Very obsolete option: ++
++ The algorithm that implemented the forced fixed width had major ++ flaws, so it was disabled. The code is still in the program and ++ some day it will be refined and returned back. Meanwhile the ++ option name '-f' was reused for another option. The old version was: ++
++-f - Don't try to force the fixed width of font. Normally the converter ++ considers the fonts in which the glyph width deviates by not more ++ than 5% as buggy fixed width fonts and forces them to have really ++ fixed width. If this is undesirable, it can be disabled by this option. ++

++ ++ ++The .pfa font format supposes that the description of the characters ++is binary encoded and encrypted. This converter does not encode or ++encrypt the data by default, you have to specify the option '-e' ++or use the t1asm program to assemble (that means, encode and ++encrypt) the font program. The t1asm program that is included with ++the converter is actually a part of the t1utils package, rather old ++version of which may be obtained from ++

++ ++

++ ++ http://ttf2pt1.sourceforge.net/t1utils.tar.gz ++ ++
++

++ ++Note that t1asm from the old version of that package won't work properly ++with the files generated by ttf2pt1 version 3.20 and later. Please use ++t1asm packaged with ttf2pt1 or from the new version t1utils ++instead. For a newer version of t1utils please look at ++

++ ++

++ ++ http://www.lcdf.org/~eddietwo/type/ ++ ++
++

++ ++ ++ ++So, the following command lines: ++

++ ++

++ ttf2pt1 -e ttffont.ttf t1font ++
++ ttf2pt1 ttffont.ttf - | t1asm >t1font.pfa ++
++

++ ++represent two ways to get a working font. The benefit of the second form ++is that other filters may be applied to the font between the converter ++and assembler. ++

++ ++ ++

++Installation and deinstallation of the converter ++

++ ++ ++The converter may be easily installed systemwide with ++ ++
++ make install ++
++ ++and uninstalled with ++ ++
++ make uninstall ++
++ ++By default the Makefile is configured to install in the hierarchy ++of directory /usr/local. This destination directory as well as ++the structure of the hierarchy may be changed by editing the Makefile. ++ ++

++Installation of the fonts ++

++ ++ ++Running the converter manually becomes somewhat boring if it has to ++be applied to a few hundreds of fonts and then you have to generate the ++fonts.scale and/or Fontmap files. The FONTS file describes how to use ++the supplied scripts to handle such cases easily. It also discusses ++the installation of the fonts for a few widespread programs. ++

++ ++

++Other utilities ++

++ ++ ++A few other small interesting programs that allow a cloase look at ++the fonts are located in the subdirectory 'other'. They ++are described shortly in others/README. ++

++ ++

++Optional packages ++

++ ++ ++Some auxiliary files are not needed by everyone and are big enough that ++moving them to a separate package speeds up the downloads of the main ++package significantly. As of now we have one such optional package: ++

++ ++  ttf2pt1-chinese - contains the Chinese conversion maps ++

++ ++The general versioning policy for the optional packages is the following: ++These packages may have no direct dependency on the ttf2pt1 version. ++But they may be updated in future, as well as some versions of optional ++packages may have dependencies on certain versions of ttf2pt1. ++To avoid unneccessary extra releases on one hand and keep the updates in ++sync with the ttf2pt1 itself on the other hand, a new version of an optional ++package will be released only if there are any changes to it and it will be ++given the same version number as ttf2pt1 released at the same time. So not ++every release of ttf2pt1 would have a corresponding release of all optional ++packages. For example, to get the correct version of optional packages for an ++imaginary release 8.3.4 of ttf2pt1 you would need to look for optional ++packages of the highest version not higher than (but possibly equal to) 8.3.4. ++

++ ++

++TO DO: ++

++ ++ ++
    ++
  • Improve hinting. ++
  • Improve the auto-tracing of bitmaps. ++
  • Implement the family-level hints. ++
  • Add generation of CID-fonts. ++
  • Handle the composite glyphs with relative base points. ++
  • Preserve the relative width of stems during scaling to 1000x1000 matrix. ++
  • Add support for bitmap TTF fonts. ++
  • Implement better support of Asian encodings. ++
  • Implement automatic creation of ligatures. ++
++ ++

++TROUBLESHOOTING AND BUG REPORTS ++

++ ++ ++ ++ ++Have problems with conversion of some font ? The converter dumps core ? Or your ++printer refuses to understand the converted fonts ? Or some characters are ++missing ? Or some characters look strange ? ++

++ ++Send the bug reports to the ttf2pt1 development mailing list at ++ttf2pt1-devel@lists.sourceforge.net. ++

++ ++Try to collect more information about the problem and include it into ++the bug report. (Of course, even better if you would provide a ready ++fix, but just a detailed bug report is also good). Provide detailed ++information about your problem, this will speed up the response greatly. ++Don't just write "this font looks strange after conversion" but describe ++what's exactly wrong with it: for example, what characters look wrong ++and what exactly is wrong about their look. Providing a link to the ++original font file would be also a good idea. Try to do a little ++troublehooting and report its result. This not only would help with ++the fix but may also give you a temporary work-around for the bug. ++

++ ++First, enable full warnings with option '-W99', save them to ++a file and read carefully. Sometimes the prolem is with a not implemented ++feature which is reported in the warnings. Still, reporting about such ++problems may be a good idea: some features were missed to cut corners, ++in hope that no real font is using them. So a report about a font using ++such a feature may motivate someone to implement it. Of course, you ++may be the most motivated person: after all, you are the one wishing ++to convert that font. ;-) Seriously, the philosophy "scrath your own itch" ++seems to be the strongest moving force behind the Open Source software. ++

++ ++The next step is playing with the options. This serves a dual purpose: ++on one hand, it helps to localize the bug, on the other hand you may be ++able to get a working version of the font for the meantime while the ++bug is being fixed. The typical options to try out are: first '-Ou', if ++it does not help then '-Os', then '-Oh', then '-Oo'. ++They are described in a bit more detail above. Try them one by one ++and in combinations. See if with them the resulting fonts look better. ++

++ ++On some fonts ttf2pt1 just crashes. Commonly that happens because the ++font being converted is highly defective (although sometimes the bug ++is in ttf2pt1 itself). In any case it should not crash, so the reports ++about such cases will help to handle these defects properly in future. ++

++ ++We try to respond to the bug reports in a timely fashion but alas, this ++may not always be possible, especially if the problem is complex. ++This is a volunteer project and its resources are limited. Because ++of this we would appreciate bug reports as detailed as possible, ++and we would appreciate the ready fixes and contributions even more. ++

++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++

++CONTACTS ++

++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ttf2pt1-announce@lists.sourceforge.net ++
++ The mailing list with announcements about ttf2pt1. It is a moderated mailing ++ with extremely low traffic. Everyone is encouraged to subscribe to keep in ++ touch with the current status of project. To subscribe use the Web interface ++ at http://lists.sourceforge.net/mailman/listinfo/ttf2pt1-announce. ++ If you have only e-mail access to the Net then send a subscribe request to ++ the development mailing list ttf2pt1-devel@lists.sourceforge.net and somebody ++ will help you with subscription. ++

++ ++ ++ ++ttf2pt1-devel@lists.sourceforge.net ++
++ ++ttf2pt1-users@lists.sourceforge.net ++
++ The ttf2pt1 mailing lists for development and users issues. They have not ++ that much traffic either. To subscribe use the Web interface at ++ http://lists.sourceforge.net/mailman/listinfo/ttf2pt1-devel ++ and http://lists.sourceforge.net/mailman/listinfo/ttf2pt1-users. ++ If you have only e-mail access to the Net then send a subscribe request to ++ the development mailing list ttf2pt1-devel@lists.sourceforge.net and somebody ++ will help you with subscription. ++

++ ++ ++ ++mheath@netspace.net.au ++
++ Mark Heath ++

++ ++ ++A.Weeks@mcc.ac.uk ++
++ Andrew Weeks ++

++ ++ ++babkin@users.sourceforge.net (preferred)
++ ++sab123@hotmail.com ++
++ ++http://members.bellatlantic.net/~babkin ++
++ Sergey Babkin ++

++ ++

++SEE ALSO ++

++ ++ ++ ++ ++ ++http://ttf2pt1.sourceforge.net ++
++ The main page of the project. ++

++ ++ ++http://www.netspace.net.au/~mheath/ttf2pt1/ ++
++ The old main page of the project. ++

++ ++ ++ ++ ++http://sourceforge.net/projects/gnuwin32 ++
++ Precompiled binaries for Windows. ++

++ ++ ++http://www.lcdf.org/~eddietwo/type/ ++
++ The home page of the Type 1 utilities package. ++

++ ++ ++http://www.rightbrain.com/pages/books.html ++
++ The first book about PostScript on the Web, "Thinking in PostScript". ++

++ ++ ++http://fonts.apple.com/TTRefMan/index.html ++
++ The True Type reference manual. ++

++ ++ ++http://partners.adobe.com/asn/developer/PDFS/TN/PLRM.pdf ++
++ Adobe PostScript reference manual. ++

++ ++ ++http://partners.adobe.com/asn/developer/PDFS/TN/T1_SPEC.PDF ++
++ Specification of the Type 1 font format. ++

++ ++ ++http://partners.adobe.com/asn/developer/PDFS/TN/5015.Type1_Supp.pdf ++
++ The Type 1 font format supplement. ++

++ ++ ++http://partners.adobe.com/asn/developer/PDFS/TN/5004.AFM_Spec.pdf ++
++ Specification of the Adobe font metrics file format. ++

++ ++ ++http://www.cs.wpi.edu/~matt/courses/cs563/talks/surface/bez_surf.html ++
++ ++http://www.cs.wpi.edu/~matt/courses/cs563/talks/curves.html ++
++ Information about the Bezier curves. ++

++ ++ ++http://www.neuroinformatik.ruhr-uni-bochum.de/ini/PEOPLE/rmz/t1lib/t1lib.html ++
++ A stand-alone library supporting the Type1 fonts. Is neccessary ++ to compile the programs other/cmpf and other/dmpf. ++

++ ++ ++http://www.freetype.org ++
++ A library supporting the TTF fonts. Also many useful TTF programs ++ are included with it. ++

++ ++ ++http://heliotrope.homestead.com/files/printsoft.html ++
++ Moses Gold's collection of links to printing software. ++

++ ++ ++http://linuxartist.org/fonts/ ++
++ Collection of font-related links. ++

++ ++


++
++ ++ ++Following is the Readme of ttf2pfa (true type to type 3 font converter) It ++covers other issues regarding the use of this software. Please note that ++although ttf2pfa is a public domain software, ttf2pt1 ++is instead covered by an Open Source license. See the COPYRIGHT ++file for details. ++

++ ++Please note also that ttf2pfa has not been maintained for a long time. ++All of its functionality has been integrated into ttf2pt1 and all the ++development moved to ttf2pt1, including Andrew Weeks, the author of ++ttf2pfa. Ttf2pfa is provided for historical reasons only. Please use ++ttf2pt1 instead. ++ ++


++ ++ ++

++True Type to Postscript Font converter ++

++ ++ ++My mind is still reeling from the discovery that I was able to write ++this program. What it does is it reads a Microsoft TrueType font and ++creates a Postscript font. '_A_ postscript font', that is, not necessarily ++the same font, you understand, but a fair imitation. ++

++ ++Run it like this: ++

++ ++

++ ttf2pfa fontfile.ttf fontname ++
++

++ ++The first parameter is the truetype filename, the second is a stem for ++the output file names. The program will create a fontname.pfa containing ++the Postscript font and a fontname.afm containing the metrics. ++

++ ++The motivation behind this is that in Linux if you do not have a ++Postscript printer, but only some other printer, you can only print ++Postscript by using Ghostscript. But the fonts that come with ++Ghostscript are very poor (they are converted from bitmaps and look ++rather lumpy). This is rather frustrating as the PC running Linux ++probably has MS-Windows as well and will therefore have truetype fonts, ++but which are quite useless with Linux, X or Ghostscript. ++

++ ++The program has been tested on over a hundred different TrueType fonts ++from various sources, and seems to work fairly well. The converted ++characters look OK, and the program doesn't seem to crash any more. I'm ++not sure about the AFM files though, as I have no means to test them. ++

++ ++The fonts generated will not work with X, as the font rasterizer that ++comes with X only copes with Type 1 fonts. If I have the time I may ++modify ttf2pfa to generate Type 1s. ++

++ ++

++Copyright issues ++

++ ++ ++I am putting this program into the public domain, so don't bother ++sending me any money, I'd only have to declare it for income tax. ++

++ ++Copyright on fonts, however, is a difficult legal question. Any ++copyright statements found in a font will be preserved in the output. ++Whether you are entitled to translate them at all I don't know. ++

++ ++If you have a license to run a software package, like say MS-Windows, on ++your PC, then you probably have a right to use any part of it, including ++fonts, on that PC, even if not using that package for its intended ++purpose. ++

++ ++I am not a lawyer, however, so this is not a legal opinion, and may be ++garbage. ++

++ ++There shouldn't be a any problem with public domain fonts. ++

++ ++

++About the Program ++

++ ++ ++It was written in C on a IBM PC running Linux. ++

++ ++The TrueType format was originally developed by Apple for the MAC, which ++has opposite endianness to the PC, so to ensure compatibility 16 and 32 ++bit fields are the wrong way round from the PC's point of view. This is ++the reason for all the 'ntohs' and 'ntohl' calls. Doing it this way ++means the program will also work on big-endian machines like Suns. ++

++ ++I doubt whether it will work on a DOS-based PC though. ++

++ ++The program produces what technically are Type 3 rather than Type 1 ++fonts. They are not compressed or encrypted and are plain text. This is ++so I (and you) can see what's going on, and (if you're a Postscript guru ++and really want to) can alter the outlines. ++

++ ++I only translate the outlines, not the 'instructions' that come with ++them. This latter task is probably virtually impossible anyway. TrueType ++outlines are B-splines rather than the Bezier curves that Postscript ++uses. I believe that my conversion algorithm is reasonably correct, if ++nothing else because the characters look right. ++

++ ++

++Problems that may occur ++

++ ++ ++Most seriously, very complex characters (with lots of outline segments) ++can make Ghostscript releases 2.x.x fail with a 'limitcheck' error. It ++is possible that this may happen with some older Postscript printers as ++well. Such characters will be flagged by the program and there are ++basically two things you can do. First is to edit the .pfa file to ++simplify or remove the offending character. This is not really ++recommended. The second is to use Ghostscript release 3, if you can get ++it. This has much larger limits and does not seem to have any problems ++with complex characters. ++

++ ++Then there are buggy fonts (yes, a font can have bugs). I try to deal ++with these in as sane a manner as possible, but it's not always ++possible. ++

++ ++

++Encodings ++

++ ++ ++A postscript font must have a 256 element array, called an encoding, ++each element of which is a name, which is also the name of a procedure ++contained within the font. The 'BuildChar' command takes a byte and uses ++it to index the encoding array to find a character name, and then looks ++that up in the font's procedure table find the commands to draw the ++glyph. However, not all characters need be in the encoding array. Those ++that are not cannot be drawn (at least not using 'show'), however it is ++possible to 're-encode' the font to enable these characters. There are ++several standard encodings: Adobe's original, ISO-Latin1 and Symbol ++being the most commonly encountered. ++

++ ++TrueType fonts are organised differently. As well as the glyph ++descriptions there are a number of tables. One of these is a mapping ++from a character set into the glyph array, and another is a mapping from ++the glyph array into a set of Postscript character names. The problems ++are: ++

++ 1) Microsoft uses Unicode, a 16-bit system, to encode the font. ++
++ 2) that more than one glyph is given the same Postscript name. ++

++ ++I deal with (1) by assuming a Latin1 encoding. The MS-Windows and ++Unicode character sets are both supersets of ISO-8859-1. This usually ++means that most characters will be properly encoded, but you should be ++warned that some software may assume that fonts have an Adobe encoding. ++Symbol, or Dingbat, fonts are in fact less of a problem, as they have ++private encodings starting at 0xF000. It is easy to just lose the top ++byte. ++

++ ++Postscript fonts can be re-encoded, either manually, or by software. ++Groff, for example, generates postscript that re-encodes fonts with the ++Adobe encoding. The problem here is that not all characters in the Adobe ++set are in the MS-Windows set. In particular there are no fi and fl ++ligatures. This means that conversions of the versions of ++Times-New-Roman and Arial that come with MS-Windows cannot be used ++blindly as replacements for Adobe Times-Roman and Helvetica. You can get ++expanded versions of MS fonts from Microsoft's web site which do contain ++these ligatures (and a lot else besides). ++

++ ++I deal with (2) by creating new character names. This can be error-prone ++because I do not know which of them is the correct glyph to give the ++name to. Some (buggy) fonts have large numbers of blank glyphs, all with ++the same name. ++

++ ++(almost every TrueType font has three glyphs called .notdef, one of them ++is usually an empty square shape, one has no outline and has zero width, ++and one has no outline and a positive width. This example is not really ++a problem with well formed fonts since the .notdef characters are only ++used for unprintable characters, which shouldn't occur in your documents ++anyway). ++

++ ++ +diff -ruN xserver-old/hw/xprint/extras/ttf2pt1/runt1asm.c xserver/hw/xprint/extras/ttf2pt1/runt1asm.c +--- xserver-old/hw/xprint/extras/ttf2pt1/runt1asm.c 1970-01-01 10:00:00.000000000 +1000 ++++ xserver/hw/xprint/extras/ttf2pt1/runt1asm.c 2006-06-27 13:10:26.000000000 +1000 +@@ -0,0 +1,61 @@ ++/* ++ * Wrap-around code to either compile in t1asm or call it externally ++ * ++ * Copyright (C) 2000 by Sergey Babkin ++ * Copyright (C) 2000 by The TTF2PT1 Project ++ * ++ * See COPYRIGHT for full license ++ */ ++ ++#ifdef EXTERNAL_T1ASM ++ ++#include ++#include ++ ++FILE *ifp; ++FILE *ofp; ++ ++int ++runt1asm( ++ int pfbflag ++) ++{ ++ char *cmd; ++ int id, od; ++ int error; ++ ++ /* first make a copy in case some of then is already stdin/stdout */ ++ if(( id = dup(fileno(ifp)) )<0) { ++ perror("** Re-opening input file for t1asm"); ++ exit(1); ++ } ++ if(( od = dup(fileno(ofp)) )<0) { ++ perror("** Re-opening output file for t1asm"); ++ exit(1); ++ } ++ fclose(ifp); fclose(ofp); ++ close(0); ++ if(( dup(id) )!=0) { ++ perror("** Re-directing input file for t1asm"); ++ exit(1); ++ } ++ close(1); ++ if(( dup(od) )!=1) { ++ perror("** Re-directing output file for t1asm"); ++ exit(1); ++ } ++ close(id); close(od); ++ ++ if(pfbflag) ++ error = execlp("t1asm", "t1asm", "-b", NULL); ++ else ++ error = execlp("t1asm", "t1asm", NULL); ++ ++ perror("** Calling t1asm"); ++ ++ exit(1); ++} ++ ++#else ++# include "t1asm.c" ++#endif +diff -ruN xserver-old/hw/xprint/extras/ttf2pt1/t1asm.c xserver/hw/xprint/extras/ttf2pt1/t1asm.c +--- xserver-old/hw/xprint/extras/ttf2pt1/t1asm.c 1970-01-01 10:00:00.000000000 +1000 ++++ xserver/hw/xprint/extras/ttf2pt1/t1asm.c 2006-06-27 13:10:26.000000000 +1000 +@@ -0,0 +1,606 @@ ++/* t1asm ++ * ++ * This program `assembles' Adobe Type-1 font programs in pseudo-PostScript ++ * form into either PFB or PFA format. The human readable/editable input is ++ * charstring- and eexec-encrypted as specified in the `Adobe Type 1 Font ++ * Format' version 1.1 (the `black book'). There is a companion program, ++ * t1disasm, which `disassembles' PFB and PFA files into a pseudo-PostScript ++ * file. ++ * ++ * Copyright (c) 1992 by I. Lee Hetherington, all rights reserved. ++ * ++ * Permission is hereby granted to use, modify, and distribute this program ++ * for any purpose provided this copyright notice and the one below remain ++ * intact. ++ * ++ * I. Lee Hetherington (ilh@lcs.mit.edu) ++ * ++ * Revision 1.2 92/05/22 11:54:45 ilh ++ * Fixed bug where integers larger than 32000 could not be encoded in ++ * charstrings. Now integer range is correct for four-byte ++ * twos-complement integers: -(1<<31) <= i <= (1<<31)-1. Bug detected by ++ * Piet Tutelaers (rcpt@urc.tue.nl). ++ * ++ * Revision 1.1 92/05/22 11:48:46 ilh ++ * initial version ++ * ++ * Ported to Microsoft C/C++ Compiler and MS-DOS operating system by ++ * Kai-Uwe Herbing (herbing@netmbx.netmbx.de) on June 12, 1992. Code ++ * specific to the MS-DOS version is encapsulated with #ifdef _MSDOS ++ * ... #endif, where _MSDOS is an identifier, which is automatically ++ * defined, if you compile with the Microsoft C/C++ Compiler. ++ * ++ */ ++ ++#ifndef lint ++static char copyright[] = ++ "@(#) Copyright (c) 1992 by I. Lee Hetherington, all rights reserved."; ++#ifdef _MSDOS ++static char portnotice[] = ++ "@(#) Ported to MS-DOS by Kai-Uwe Herbing (herbing@netmbx.netmbx.de)."; ++#endif ++#endif ++ ++/* Note: this is ANSI C. */ ++ ++#ifdef _MSDOS ++ #include ++ #include ++ #include ++#endif ++#include ++#include ++#include ++#include ++#include ++ ++#ifdef WINDOWS ++# ifdef STANDALONE ++# define WINDOWS_FUNCTIONS ++# include "windows.h" ++# endif ++#endif ++ ++/* int32 must be at least 32-bit and uint16 must be at least 16-bit */ ++#ifndef AIXV3 ++#if INT_MAX >= 0x7FFFFFFFUL ++typedef int int32; ++#else ++typedef long int32; ++#endif ++#endif /* !AIXV3 */ ++#if USHRT_MAX >= 0xFFFFUL ++typedef unsigned short uint16; ++#else ++typedef unsigned int uint16; ++#endif ++ ++#define LINESIZE 256 ++ ++#define MAXBLOCKLEN ((1L<<17)-6) ++#define MINBLOCKLEN ((1L<<8)-6) ++ ++#define MARKER 128 ++#define ASCII 1 ++#define BINARY 2 ++#define DONE 3 ++ ++typedef unsigned char byte; ++ ++/* must be visible from outside */ ++FILE *ifp; ++FILE *ofp; ++ ++/* flags */ ++static int pfb = 0; ++static int active = 0; ++static int start_charstring = 0; ++static int in_eexec = 0; ++ ++static char line[LINESIZE]; ++ ++/* lenIV and charstring start command */ ++static int lenIV = 4; ++static char cs_start[10]; ++ ++/* for charstring buffering */ ++static byte charstring_buf[65535]; ++static byte *charstring_bp; ++ ++/* for PFB block buffering */ ++static byte blockbuf[MAXBLOCKLEN]; ++static int32 blocklen = MAXBLOCKLEN; ++static int32 blockpos = -1; ++static int blocktyp = ASCII; ++ ++/* decryption stuff */ ++static uint16 er, cr; ++static uint16 c1 = 52845, c2 = 22719; ++ ++/* table of charstring commands */ ++static struct command { ++ char *name; ++ int one, two; ++} command_table[] = { ++ { "callothersubr", 12, 16 }, ++ { "callsubr", 10, -1 }, ++ { "closepath", 9, -1 }, ++ { "div", 12, 12 }, ++ { "dotsection", 12, 0 }, ++ { "endchar", 14, -1 }, ++ { "hlineto", 6, -1 }, ++ { "hmoveto", 22, -1 }, ++ { "hsbw", 13, -1 }, ++ { "hstem", 1, -1 }, ++ { "hstem3", 12, 2 }, ++ { "hvcurveto", 31, -1 }, ++ { "pop", 12, 17 }, ++ { "return", 11, -1 }, ++ { "rlineto", 5, -1 }, ++ { "rmoveto", 21, -1 }, ++ { "rrcurveto", 8, -1 }, ++ { "sbw", 12, 7 }, ++ { "seac", 12, 6 }, ++ { "setcurrentpoint", 12, 33 }, ++ { "vhcurveto", 30, -1 }, ++ { "vlineto", 7, -1 }, ++ { "vmoveto", 4, -1 }, ++ { "vstem", 3, -1 }, ++ { "vstem3", 12, 1 }, ++}; /* alphabetical */ ++ ++/* Two separate encryption functions because eexec and charstring encryption ++ must proceed in parallel. */ ++ ++static byte eencrypt(byte plain) ++{ ++ byte cipher; ++ ++ cipher = (byte) (plain ^ (er >> 8)); ++ er = (uint16) ((cipher + er) * c1 + c2); ++ return cipher; ++} ++ ++static byte cencrypt(byte plain) ++{ ++ byte cipher; ++ ++ cipher = (byte) (plain ^ (cr >> 8)); ++ cr = (uint16) ((cipher + cr) * c1 + c2); ++ return cipher; ++} ++ ++/* This function flushes a buffered PFB block. */ ++ ++static void output_block() ++{ ++ int32 i; ++ ++ /* output four-byte block length */ ++ fputc((int) (blockpos & 0xff), ofp); ++ fputc((int) ((blockpos >> 8) & 0xff), ofp); ++ fputc((int) ((blockpos >> 16) & 0xff), ofp); ++ fputc((int) ((blockpos >> 24) & 0xff), ofp); ++ ++ /* output block data */ ++ for (i = 0; i < blockpos; i++) ++ fputc(blockbuf[i], ofp); ++ ++ /* mark block buffer empty and uninitialized */ ++ blockpos = -1; ++} ++ ++/* This function outputs a single byte. If output is in PFB format then output ++ is buffered through blockbuf[]. If output is in PFA format, then output ++ will be hexadecimal if in_eexec is set, ASCII otherwise. */ ++ ++static void output_byte(byte b) ++{ ++ static char *hexchar = "0123456789ABCDEF"; ++ static int hexcol = 0; ++ ++ if (pfb) { ++ /* PFB */ ++ if (blockpos < 0) { ++ fputc(MARKER, ofp); ++ fputc(blocktyp, ofp); ++ blockpos = 0; ++ } ++ blockbuf[blockpos++] = b; ++ if (blockpos == blocklen) ++ output_block(); ++ } else { ++ /* PFA */ ++ if (in_eexec) { ++ /* trim hexadecimal lines to 64 columns */ ++ if (hexcol >= 64) { ++ fputc('\n', ofp); ++ hexcol = 0; ++ } ++ fputc(hexchar[(b >> 4) & 0xf], ofp); ++ fputc(hexchar[b & 0xf], ofp); ++ hexcol += 2; ++ } else { ++ fputc(b, ofp); ++ } ++ } ++} ++ ++/* This function outputs a byte through possible eexec encryption. */ ++ ++static void eexec_byte(byte b) ++{ ++ if (in_eexec) ++ output_byte(eencrypt(b)); ++ else ++ output_byte(b); ++} ++ ++/* This function outputs a null-terminated string through possible eexec ++ encryption. */ ++ ++static void eexec_string(char *string) ++{ ++ while (*string) ++ eexec_byte((byte) *string++); ++} ++ ++/* This function gets ready for the eexec-encrypted data. If output is in ++ PFB format then flush current ASCII block and get ready for binary block. ++ We start encryption with four random (zero) bytes. */ ++ ++static void eexec_start() ++{ ++ eexec_string(line); ++ if (pfb) { ++ output_block(); ++ blocktyp = BINARY; ++ } ++ ++ in_eexec = 1; ++ er = 55665; ++ eexec_byte(0); ++ eexec_byte(0); ++ eexec_byte(0); ++ eexec_byte(0); ++} ++ ++/* This function wraps-up the eexec-encrypted data. ++ If output is in PFB format then this entails flushing binary block and ++ starting an ASCII block. */ ++ ++static void eexec_end() ++{ ++ int i, j; ++ ++ if (pfb) { ++ output_block(); ++ blocktyp = ASCII; ++ } else { ++ fputc('\n', ofp); ++ } ++ in_eexec = 0; ++ for (i = 0; i < 8; i++) { ++ for (j = 0; j < 64; j++) ++ eexec_byte('0'); ++ eexec_byte('\n'); ++ } ++#if 0 ++ eexec_string("cleartomark\n"); ++#endif ++} ++ ++/* This function writes ASCII trailer. ++ If output is in PFB format then this entails flushing binary block and ++ starting an ASCII block. */ ++ ++static void file_end() ++{ ++ if (pfb) { ++ output_block(); ++ fputc(MARKER, ofp); ++ fputc(DONE, ofp); ++ } ++} ++/* This function returns an input line of characters. A line is terminated by ++ length (including terminating null) greater than LINESIZE, a newline \n, or ++ when active (looking for charstrings) by '{'. When terminated by a newline ++ the newline is put into line[]. When terminated by '{', the '{' is not put ++ into line[], and the flag start_charstring is set to 1. */ ++ ++static void t1asm_getline() ++{ ++ int c; ++ char *p = line; ++ int comment = 0; ++ ++ start_charstring = 0; ++ while (p < line + LINESIZE) { ++ c = fgetc(ifp); ++ if (c == EOF) ++ break; ++ if (c == '%') ++ comment = 1; ++ if (active && !comment && c == '{') { ++ start_charstring = 1; ++ break; ++ } ++ *p++ = (char) c; ++ if (c == '\n') ++ break; ++ } ++ *p = '\0'; ++} ++ ++/* This function is used by the binary search, bsearch(), for command names in ++ the command table. */ ++ ++static int command_compare(const void *key, const void *item) ++{ ++ return strcmp((char *) key, ((struct command *) item)->name); ++} ++ ++/* This function returns 1 if the string is an integer and 0 otherwise. */ ++ ++static int is_integer(char *string) ++{ ++ if (isdigit(string[0]) || string[0] == '-' || string[0] == '+') { ++ while (*++string && isdigit(*string)) ++ ; /* deliberately empty */ ++ if (!*string) ++ return 1; ++ } ++ return 0; ++} ++ ++/* This function initializes charstring encryption. Note that this is called ++ at the beginning of every charstring. */ ++ ++static void charstring_start() ++{ ++ int i; ++ ++ charstring_bp = charstring_buf; ++ cr = 4330; ++ for (i = 0; i < lenIV; i++) ++ *charstring_bp++ = cencrypt((byte) 0); ++} ++ ++/* This function encrypts and buffers a single byte of charstring data. */ ++ ++static void charstring_byte(int v) ++{ ++ byte b = (byte) (v & 0xff); ++ ++ if (charstring_bp - charstring_buf > sizeof(charstring_buf)) { ++ fprintf(stderr, "error: charstring_buf full (%d bytes)\n", ++ sizeof(charstring_buf)); ++ exit(1); ++ } ++ *charstring_bp++ = cencrypt(b); ++} ++ ++/* This function outputs buffered, encrypted charstring data through possible ++ eexec encryption. */ ++ ++static void charstring_end() ++{ ++ byte *bp; ++ ++ sprintf(line, "%d ", charstring_bp - charstring_buf); ++ eexec_string(line); ++ sprintf(line, "%s ", cs_start); ++ eexec_string(line); ++ for (bp = charstring_buf; bp < charstring_bp; bp++) ++ eexec_byte(*bp); ++} ++ ++/* This function generates the charstring representation of an integer. */ ++ ++static void charstring_int(int num) ++{ ++ int x; ++ ++ if (num >= -107 && num <= 107) { ++ charstring_byte(num + 139); ++ } else if (num >= 108 && num <= 1131) { ++ x = num - 108; ++ charstring_byte(x / 256 + 247); ++ charstring_byte(x % 256); ++ } else if (num >= -1131 && num <= -108) { ++ x = abs(num) - 108; ++ charstring_byte(x / 256 + 251); ++ charstring_byte(x % 256); ++ } else if (num >= (-2147483647-1) && num <= 2147483647) { ++ charstring_byte(255); ++ charstring_byte(num >> 24); ++ charstring_byte(num >> 16); ++ charstring_byte(num >> 8); ++ charstring_byte(num); ++ } else { ++ fprintf(stderr, ++ "error: cannot format the integer %d, too large\n", num); ++ exit(1); ++ } ++} ++ ++/* This function parses an entire charstring into integers and commands, ++ outputting bytes through the charstring buffer. */ ++ ++static void parse_charstring() ++{ ++ struct command *cp; ++ ++ charstring_start(); ++ while (fscanf(ifp, "%s", line) == 1) { ++ if (line[0] == '%') { ++ /* eat comment to end of line */ ++ while (fgetc(ifp) != '\n' && !feof(ifp)) ++ ; /* deliberately empty */ ++ continue; ++ } ++ if (line[0] == '}') ++ break; ++ if (is_integer(line)) { ++ charstring_int(atoi(line)); ++ } else { ++ cp = (struct command *) ++ bsearch((void *) line, (void *) command_table, ++ sizeof(command_table) / sizeof(struct command), ++ sizeof(struct command), ++ command_compare); ++ if (cp) { ++ charstring_byte(cp->one); ++ if (cp->two >= 0) ++ charstring_byte(cp->two); ++ } else { ++ fprintf(stderr, "error: cannot use `%s' in charstring\n",line); ++ exit(1); ++ } ++ } ++ } ++ charstring_end(); ++} ++ ++static void usage() ++{ ++ fprintf(stderr, ++ "usage: t1asm [-b] [-l block-length] [input [output]]\n"); ++ fprintf(stderr, ++ "\n-b means output in PFB format, otherwise PFA format.\n"); ++ fprintf(stderr, ++ "The block length applies to the length of blocks in the\n"); ++ fprintf(stderr, ++ "PFB output file; the default is to use the largest possible.\n"); ++ exit(1); ++} ++ ++static void print_banner() ++{ ++ static char rcs_revision[] = ""; /* removed RCS */ ++ static char revision[20]; ++ ++ if (sscanf(rcs_revision, "$Revision: %19s", revision) != 1) ++ revision[0] = '\0'; ++ fprintf(stderr, "This is t1asm %s.\n", revision); ++} ++ ++#ifdef STANDALONE ++int main(int argc, char **argv) ++{ ++ char *p, *q, *r; ++ int c; ++ ++ extern char *optarg; ++ extern int optind; ++ ++ ifp = stdin; ++ ofp = stdout; ++ ++ print_banner(); ++ ++ /* interpret command line arguments using getopt */ ++ while ((c = getopt(argc, argv, "bl:")) != -1) ++ switch (c) { ++ case 'b': ++ pfb = 1; ++ break; ++ case 'l': ++ blocklen = atoi(optarg); ++ if (blocklen < MINBLOCKLEN) { ++ blocklen = MINBLOCKLEN; ++ fprintf(stderr, ++ "warning: using minimum block length of %d\n", ++ blocklen); ++ } else if (blocklen > MAXBLOCKLEN) { ++ blocklen = MAXBLOCKLEN; ++ fprintf(stderr, ++ "warning: using maximum block length of %d\n", ++ blocklen); ++ } ++ break; ++ default: ++ usage(); ++ break; ++ } ++ if (argc - optind > 2) ++ usage(); ++ ++ /* possibly open input & output files */ ++ if (argc - optind >= 1) { ++ ifp = fopen(argv[optind], "r"); ++ if (!ifp) { ++ fprintf(stderr, "error: cannot open %s for reading\n", argv[1]); ++ exit(1); ++ } ++ } ++ if (argc - optind >= 2) { ++ ofp = fopen(argv[optind + 1], "w"); ++ if (!ofp) { ++ fprintf(stderr, "error: cannot open %s for writing\n", argv[2]); ++ exit(1); ++ } ++ } ++ ++#else ++int runt1asm(int pfbflag) ++{ ++ char *p, *q, *r; ++ ++ pfb = pfbflag; ++#endif ++ ++ #ifdef _MSDOS ++ /* If we are processing a PFB (binary) output */ ++ /* file, we must set its file mode to binary. */ ++ if (pfb) ++ _setmode(_fileno(ofp), _O_BINARY); ++ #endif ++ ++ /* Finally, we loop until no more input. Some special things to look for ++ are the `currentfile eexec' line, the beginning of the `/Subrs' ++ definition, the definition of `/lenIV', and the definition of the ++ charstring start command which has `...string currentfile...' in it. */ ++ ++ while (!feof(ifp) && !ferror(ifp)) { ++ t1asm_getline(); ++ if (strcmp(line, "currentfile eexec\n") == 0) { ++ eexec_start(); ++ continue; ++ } else if (strstr(line, "/Subrs") && isspace(line[6])) { ++ active = 1; ++ } else if ((p = strstr(line, "/lenIV"))) { ++ sscanf(p, "%*s %d", &lenIV); ++ } else if ((p = strstr(line, "string currentfile"))) { ++ /* locate the name of the charstring start command */ ++ *p = '\0'; /* damage line[] */ ++ q = strrchr(line, '/'); ++ if (q) { ++ r = cs_start; ++ ++q; ++ while (!isspace(*q) && *q != '{') ++ *r++ = *q++; ++ *r = '\0'; ++ } ++ *p = 's'; /* repair line[] */ ++ } ++ /* output line data */ ++ eexec_string(line); ++ if ((p = strstr(line, "currentfile closefile"))) { ++ eexec_end(); ++ } ++ if (start_charstring) { ++ if (!cs_start[0]) { ++ fprintf(stderr, "error: couldn't find charstring start command\n"); ++ exit(1); ++ } ++ parse_charstring(); ++ } ++ } ++ file_end(); ++ ++ fclose(ifp); ++ fclose(ofp); ++ ++ return 0; ++} +diff -ruN xserver-old/hw/xprint/extras/ttf2pt1/ttf2pt1.1 xserver/hw/xprint/extras/ttf2pt1/ttf2pt1.1 +--- xserver-old/hw/xprint/extras/ttf2pt1/ttf2pt1.1 1970-01-01 10:00:00.000000000 +1000 ++++ xserver/hw/xprint/extras/ttf2pt1/ttf2pt1.1 2006-06-27 13:10:26.000000000 +1000 +@@ -0,0 +1,828 @@ ++.rn '' }` ++''' $RCSfile$$Revision$$Date$ ++''' ++''' $Log$ ++''' Revision 1.1.4.1 2004/04/21 10:03:13 gisburn ++''' Fix for http://pdx.freedesktop.org/cgi-bin/bugzilla/show_bug.cgi?id=530 - Land XPRINT branch on XORG-CURRENT ++''' ++''' Revision 1.1 2003/06/04 00:33:54 roland ++''' Fix for http://xprint.mozdev.org/bugs/show_bug.cgi?id=3846 - RFE: Upload Freetype --> PS Type1 font converter "ttf2pt1" ... ++''' ++''' ++.de Sh ++.br ++.if t .Sp ++.ne 5 ++.PP ++\fB\\$1\fR ++.PP ++.. ++.de Sp ++.if t .sp .5v ++.if n .sp ++.. ++.de Ip ++.br ++.ie \\n(.$>=3 .ne \\$3 ++.el .ne 3 ++.IP "\\$1" \\$2 ++.. ++.de Vb ++.ft CW ++.nf ++.ne \\$1 ++.. ++.de Ve ++.ft R ++ ++.fi ++.. ++''' ++''' ++''' Set up \*(-- to give an unbreakable dash; ++''' string Tr holds user defined translation string. ++''' Bell System Logo is used as a dummy character. ++''' ++.tr \(*W-|\(bv\*(Tr ++.ie n \{\ ++.ds -- \(*W- ++.ds PI pi ++.if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch ++.if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch ++.ds L" "" ++.ds R" "" ++''' \*(M", \*(S", \*(N" and \*(T" are the equivalent of ++''' \*(L" and \*(R", except that they are used on ".xx" lines, ++''' such as .IP and .SH, which do another additional levels of ++''' double-quote interpretation ++.ds M" """ ++.ds S" """ ++.ds N" """"" ++.ds T" """"" ++.ds L' ' ++.ds R' ' ++.ds M' ' ++.ds S' ' ++.ds N' ' ++.ds T' ' ++'br\} ++.el\{\ ++.ds -- \(em\| ++.tr \*(Tr ++.ds L" `` ++.ds R" '' ++.ds M" `` ++.ds S" '' ++.ds N" `` ++.ds T" '' ++.ds L' ` ++.ds R' ' ++.ds M' ` ++.ds S' ' ++.ds N' ` ++.ds T' ' ++.ds PI \(*p ++'br\} ++.\" If the F register is turned on, we'll generate ++.\" index entries out stderr for the following things: ++.\" TH Title ++.\" SH Header ++.\" Sh Subsection ++.\" Ip Item ++.\" X<> Xref (embedded ++.\" Of course, you have to process the output yourself ++.\" in some meaninful fashion. ++.if \nF \{ ++.de IX ++.tm Index:\\$1\t\\n%\t"\\$2" ++.. ++.nr % 0 ++.rr F ++.\} ++.TH TTF2PT1 1 "version 3.4.4-SNAP-030526" "May 26, 2003" "TTF2PT1 Font Converter" ++.UC ++.if n .hy 0 ++.if n .na ++.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' ++.de CQ \" put $1 in typewriter font ++.ft CW ++'if n "\c ++'if t \\&\\$1\c ++'if n \\&\\$1\c ++'if n \&" ++\\&\\$2 \\$3 \\$4 \\$5 \\$6 \\$7 ++'.ft R ++.. ++.\" @(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2 ++. \" AM - accent mark definitions ++.bd B 3 ++. \" fudge factors for nroff and troff ++.if n \{\ ++. ds #H 0 ++. ds #V .8m ++. ds #F .3m ++. ds #[ \f1 ++. ds #] \fP ++.\} ++.if t \{\ ++. ds #H ((1u-(\\\\n(.fu%2u))*.13m) ++. ds #V .6m ++. ds #F 0 ++. ds #[ \& ++. ds #] \& ++.\} ++. \" simple accents for nroff and troff ++.if n \{\ ++. ds ' \& ++. ds ` \& ++. ds ^ \& ++. ds , \& ++. ds ~ ~ ++. ds ? ? ++. ds ! ! ++. ds / ++. ds q ++.\} ++.if t \{\ ++. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" ++. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' ++. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' ++. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' ++. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' ++. ds ? \s-2c\h'-\w'c'u*7/10'\u\h'\*(#H'\zi\d\s+2\h'\w'c'u*8/10' ++. ds ! \s-2\(or\s+2\h'-\w'\(or'u'\v'-.8m'.\v'.8m' ++. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' ++. ds q o\h'-\w'o'u*8/10'\s-4\v'.4m'\z\(*i\v'-.4m'\s+4\h'\w'o'u*8/10' ++.\} ++. \" troff and (daisy-wheel) nroff accents ++.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' ++.ds 8 \h'\*(#H'\(*b\h'-\*(#H' ++.ds v \\k:\h'-(\\n(.wu*9/10-\*(#H)'\v'-\*(#V'\*(#[\s-4v\s0\v'\*(#V'\h'|\\n:u'\*(#] ++.ds _ \\k:\h'-(\\n(.wu*9/10-\*(#H+(\*(#F*2/3))'\v'-.4m'\z\(hy\v'.4m'\h'|\\n:u' ++.ds . \\k:\h'-(\\n(.wu*8/10)'\v'\*(#V*4/10'\z.\v'-\*(#V*4/10'\h'|\\n:u' ++.ds 3 \*(#[\v'.2m'\s-2\&3\s0\v'-.2m'\*(#] ++.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] ++.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' ++.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' ++.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] ++.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] ++.ds ae a\h'-(\w'a'u*4/10)'e ++.ds Ae A\h'-(\w'A'u*4/10)'E ++.ds oe o\h'-(\w'o'u*4/10)'e ++.ds Oe O\h'-(\w'O'u*4/10)'E ++. \" corrections for vroff ++.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' ++.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' ++. \" for low resolution devices (crt and lpr) ++.if \n(.H>23 .if \n(.V>19 \ ++\{\ ++. ds : e ++. ds 8 ss ++. ds v \h'-1'\o'\(aa\(ga' ++. ds _ \h'-1'^ ++. ds . \h'-1'. ++. ds 3 3 ++. ds o a ++. ds d- d\h'-1'\(ga ++. ds D- D\h'-1'\(hy ++. ds th \o'bp' ++. ds Th \o'LP' ++. ds ae ae ++. ds Ae AE ++. ds oe oe ++. ds Oe OE ++.\} ++.rm #[ #] #H #V #F C ++.SH "NAME" ++TTF2PT1 \- A True Type to PostScript Type 1 Font Converter ++.SH "SYNOPSIS" ++\f(CWttf2pt1 \fI[-options] ttffont.ttf [Fontname]\fR\fR ++.PP ++or ++.PP ++\f(CWttf2pt1 \fI[-options] ttffont.ttf -\fR\fR ++.SH "DESCRIPTION" ++Ttf2pt1 is a font converter from the True Type format (and some other formats ++supported by the FreeType library as well) to the Adobe Type1 format. ++.PP ++The versions 3.0 and later got rather extensive post-processing algorithm that ++brings the converted fonts to the requirements of the Type1 standard, tries to ++correct the rounding errors introduced during conversions and some simple ++kinds of bugs that are typical for the public domain TTF fonts. It ++also generates the hints that enable much better rendering of fonts in ++small sizes that are typical for the computer displays. But everything ++has its price, and some of the optimizations may not work well for certain ++fonts. That's why the options were added to the converter, to control ++the performed optimizations. ++.SH "OPTIONS" ++The first variant creates the file \f(CWFontname.pfa\fR (or \f(CWFontname.pfb\fR if the ++option \*(L'\fB\-b\fR\*(R' was used) with the converted font and \f(CWFontname.afm\fR with the ++font metrics, the second one prints the font or another file (if the option ++\&\*(R'\fB\-G\fR\*(R' was used) on the standard output from where it can be immediately ++piped through some filter. If no \f(CWFontname\fR is specified for the first ++variant, the name is generated from \f(CWttffont\fR by replacing the \f(CW.ttf\fR ++filename suffix. ++.PP ++Most of the time no options are neccessary (with a possible exception ++of \*(L'\fB\-e\fR'). But if there are some troubles with the resulting font, they ++may be used to control the conversion. ++The \fBoptions\fR are: ++.Ip "\(bu" 2 ++\f(CW\fB-a\fR\fR \- Include all the glyphs from the source file into the converted ++file. If this option is not specified then only the glyphs that have ++been assigned some encoding are included, because the rest of glyphs ++would be inaccessible anyway and would only consume the disk space. ++But some applications are clever enough to change the encoding on ++the fly and thus use the other glyphs, in this case they could ++benefit from using this option. But there is a catch: the X11 library ++has rather low limit for the font size. Including more glyphs increases ++the file size and thus increases the chance of hitting this limit. ++See \f(CWapp/X11/README\fR for the description of a ++patch to X11 which fixes this problem. ++.Ip "\(bu" 2 ++\f(CW\fB-b\fR\fR \- Encode the resulting font to produce a ready \f(CW.pfb\fR file. ++.Ip "\(bu" 2 ++\f(CW\fB-d \fIsuboptions\fR\fR\fR \- Debugging options. The suboptions are: ++.Sp ++\f(CW\fBa\fR\fR \- Print out the absolute coordinates of dots in outlines. Such ++a font can not be used by any program (that's why this option is ++incompatible with \*(L'\fB\-e\fR') but it has proven to be a valuable debuging ++information. ++.Sp ++\f(CW\fBr\fR\fR \- Do not reverse the direction of outlines. The \s-1TTF\s0 fonts have ++the standard direction of outlines opposite to the Type1 fonts. So ++they should be reversed during proper conversion. This option ++may be used for debugging or to handle a \s-1TTF\s0 font with wrong ++direction of outlines (possibly, converted in a broken way from ++a Type1 font). The first signs of the wrong direction are the ++letters like \*(L"P\*(R" or \*(L"B\*(R" without the unpainted \*(L"holes\*(R" inside. ++.Ip "\(bu" 2 ++\f(CW\fB-e\fR\fR \- Assemble the resulting font to produce a ready \f(CW.pfa\fR file. ++.Sp ++[ S.B.: Personally I don't think that this option is particularly useful. ++The same result may be achieved by piping the unassembled data ++through t1asm, the Type 1 assembler. And, anyways, it's good to ++have the t1utils package handy. But Mark and many users think that ++this functionality is good and it took not much time to add this option. ] ++.Ip "\(bu" 2 ++\f(CW\fB-F\fR\fR \- Force the Unicode encoding: any type of \s-1MS\s0 encoding specified ++in the font is ignored and the font is treated like it has Unicode ++encoding. \fB\s-1WARNING\s0:\fR this option is intended for buggy fonts ++which actually are in Unicode but are marked as something else. The ++effect on the other fonts is unpredictable. ++.Ip "\(bu" 2 ++\f(CW\fB-G \fIsuboptions\fR\fR\fR \- File generation options. The suboptions may be lowercase ++or uppercase, the lowercase ones disable the generation of particular ++files, the corresponding uppercase suboptions enable the generation of the ++same kind of files. If the result of ttf2pt1 is requested to be printed on ++the standard output, the last enabling suboption of \fB\-G\fR determines ++which file will be written to the standard output and the rest of files ++will be discarded. For example, \fB\-G A\fR will request the \s-1AFM\s0 file. ++The suboptions to disable/enable the generation of the files are: ++.Sp ++\f(CW\fBf/F\fR\fR \- The font file. Depending on the other options this file ++will have one of the suffixes \f(CW.t1a\fR, \f(CW.pfa\fR or \f(CW.pfb\fR. If the conversion result ++is requested on the standard output ('\f(CW-\fR\*(R' is used as the output file name) ++then the font file will also be written there by default, if not overwritten ++by another suboption of \fB\-G\fR. ++\fBDefault: enabled\fR ++.Sp ++\f(CW\fBa/A\fR\fR \- The Adobe font metrics file (\f(CW.afm\fR). ++\fBDefault: enabled\fR ++.Sp ++\f(CW\fBe/E\fR\fR \- The dvips encoding file (\f(CW.enc\fR). ++\fBDefault: disabled\fR ++.Ip "\(bu" 2 ++\f(CW\fB-l \fIlanguage\fR[+\fIargument\fR]\fR\fR \- Extract the fonts for the specified language from a ++multi-language Unicode font. If this option is not used the converter ++tries to guess the language by the values of the shell variable \s-1LANG\s0. ++If it is not able to guess the language by \s-1LANG\s0 it tries all the ++languages in the order they are listed. ++.Sp ++After the plus sign an optional argument for the language extractor ++may be specified. The format of the argument is absolutely up to ++the particular language converter. The primary purpose of the ++argument is to support selection of planes for the multi-plane ++Eastern encodings but it can also be used in any other way. The ++language extractor may decide to add the plane name in some form ++to the name of the resulting font. None of the currently supported ++languages make any use of the argument yet. ++.Sp ++As of now the following languages are supported: ++.Sp ++\ \ \f(CWlatin1\fR \- for all the languages using the Latin-1 encoding ++.Sp ++\ \ \f(CWlatin2\fR \- for the Central European languages ++.Sp ++\ \ \f(CWlatin4\fR \- for the Baltic languages ++.Sp ++\ \ \f(CWlatin5\fR \- for the Turkish language ++.Sp ++\ \ \f(CWcyrillic\fR \- for the languages with Cyrillic alphabet ++.Sp ++\ \ \f(CWrussian\fR \- historic synonym for cyrillic ++.Sp ++\ \ \f(CWbulgarian\fR \- historic synonym for cyrillic ++.Sp ++\ \ \f(CWadobestd\fR \- for the AdobeStandard encoding used by TeX ++.Sp ++\ \ \f(CWplane+\fIargument\fR\fR \- to select one plane from a multi-byte encoding ++.Sp ++The argument of the \*(L"\f(CWplane\fR\*(R" language may be in one of three forms: ++.Sp ++\ \ \f(CWplane+\fBpid=\fR\fI\fR\fB,eid=\fR\fI\fR\fR ++.Sp ++\ \ \f(CWplane+\fBpid=\fR\fI\fR\fB,eid=\fR\fI\fR\fB,\fR\fI\fR\fR ++.Sp ++\ \ \f(CWplane+\fI\fR\fR ++.Sp ++Pid (\s-1TTF\s0 platform id) and eid (\s-1TTF\s0 encoding id) select a particular ++\s-1TTF\s0 encoding table in the original font. They are specified as decimal ++numbers. If this particular encoding table is not present in the font ++file then the conversion fails. The native ("ttf") front-end parser supports ++only pid=3 (Windows platform), the FreeType-based ("ft") front-end supports ++any platform. If pid/eid is not specified then the \s-1TTF\s0 encoding table is ++determined as usual: Unicode encoding if it's first or an 8-bit encoding ++if not (and for an 8-bit encoding the plane number is silently ignored). ++To prevent the converter from falling back to an 8-bit encoding, specify ++the Unicode pid/eid value explicitly. ++.Sp ++Plane_number is a hexadecimal (if starts with \*(L"\fB0x\fR") or decimal number. ++It gives the values of upper bytes for which 256 characters will be ++selected. If not specified, defaults to 0. It is also used as a font ++name suffix (the leading \*(L"0x\*(R" is not included into the suffix). ++.Sp ++\fB\s-1NOTE\s0:\fR ++You may notice that the language names are not uniform: some are the ++names of particular languages and some are names of encodings. This ++is because of the different approaches. The original idea was to ++implement a conversion from Unicode to the appropriate Windows ++encoding for a given language. And then use the translation tables ++to generate the fonts in whatever final encodings are needed. This ++would allow to pile together the Unicode fonts and the non-Unicode ++Windows fonts for that language and let the program to sort them out ++automatically. And then generate fonts in all the possible encodings ++for that language. An example of this approach is the Russian language ++support. But if there is no multiplicity of encodings used for some ++languages and if the non-Unicode fonts are not considered important ++by the users, another way would be simpler to implement: just provide ++only one table for extraction of the target encoding from Unicode ++and don't bother with the translation tables. The latin* \*(L"languages\*(R" ++are examples of this approach. If somebody feels that he needs the ++Type1 fonts both in Latin-* and Windows encodings he or she is absolutely ++welcome to submit the code to implement it. ++.Sp ++\fB\s-1WARNING\s0:\fR ++Some of the glyphs included into the AdobeStandard encoding are not ++included into the Unicode standard. The most typical examples of such ++glyphs are ligatures like \*(L'fi\*(R', \*(L'fl\*(R' etc. Because of this the font ++designers may place them at various places. The converter tries to ++do its best, if the glyphs have honest Adobe names and/or are ++placed at the same codes as in the Microsoft fonts they will be ++picked up. Otherwise a possible solution is to use the option \*(L'\fB\-L\fR\*(R' ++with an external map. ++.Ip "\(bu" 2 ++\f(CW\fB-L \fIfile\fR[+[pid=\fI\fR,eid=\fI\fR,][\fIplane\fR]]\fR\fR \- Extract the fonts for the specified ++language from a multi-language font using the map from this file. This is ++rather like the option \*(L'\fB\-l\fR\*(R' but the encoding map is not ++compiled into the program, it's taken from that file, so it's ++easy to edit. Examples of such files are provided in ++\f(CWmaps/adobe-standard-encoding.map\fR, \f(CWCP1250.map\fR. (\fB\s-1NOTE\s0:\fR ++the \*(L'standard encoding\*(R' map does not include all the glyphs of the ++AdobeStandard encoding, it's provided only as an example.) The ++description of the supported map formats is in the file ++\f(CWmaps/unicode-sample.map\fR. ++.Sp ++Likewise to \*(L'\fB\-l\fR\*(R', an argument may be specified after the map file ++name. But in this case the argument has fixed meaning: it selects the ++original \s-1TTF\s0 encoding table (the syntax is the same as in \*(L'\fB\-l plane\fR') ++and/or a plane of the map file. The plane name also gets added after dash ++to the font name. The plane is a concept used in the Eastern fonts with big ++number of glyphs: one \s-1TTF\s0 font gets divided into multiple Type1 fonts, ++each containing one plane of up to 256 glyphs. But with a little ++creativity this concept may be used for other purposes of combining ++multiple translation maps into one file. To extract multiple planes ++from a \s-1TTF\s0 font \f(CWttf2pt1\fR must be run multiple times, each time with ++a different plane name specified. ++.Sp ++The default original \s-1TTF\s0 encoding table used for the option \*(L'\fB\-L\fR\*(R' is ++Unicode. The map files may include directives to specify different original ++\s-1TTF\s0 encodings. However if the pid/eid pair is specified with ++it overrides any original encoding specified in the map file. ++.Ip "\(bu" 2 ++\f(CW\fB-m \fItype\fR=\fIvalue\fR\fR\fR \- Set maximal or minimal limits of resources. ++These limits control the the font generation by limiting the resources ++that the font is permitted to require from the PostScript interpreter. ++The currently supported types of limits are: ++.Sp ++\f(CW\fBh\fR\fR \- the maximal hint stack depth for the substituted hints. ++The default value is 128, according to the limitation in X11. This seems to ++be the lowest (and thus the safest) widespread value. To display the ++hint stack depth required by each glyph in a \f(CW.t1a\fR file use the script ++\f(CWscripts/cntstems.pl\fR. ++.Ip "\(bu" 2 ++\f(CW\fB-O \fIsuboptions\fR\fR\fR \- Outline processing options. The suboptions ++may be lowercase or uppercase, the lowercase ones disable the features, ++the corresponding uppercase suboptions enable the same features. ++The suboptions to disable/enable features are: ++.Sp ++\f(CW\fBb/B\fR\fR \- Guessing of the ForceBold parameter. This parameter helps ++the Type1 engine to rasterize the bold fonts properly at small sizes. ++But the algorithm used to guess the proper value of this flag makes ++that guess based solely on the font name. In rare cases that may cause ++errors, in these cases you may want to disable this guessing. ++\fBDefault: enabled\fR ++.Sp ++\f(CW\fBh/H\fR\fR \- Autogeneration of hints. The really complex outlines ++may confuse the algorithm, so theoretically it may be useful ++sometimes to disable them. Although up to now it seems that ++even bad hints are better than no hints at all. ++\fBDefault: enabled\fR ++.Sp ++\f(CW\fBu/U\fR\fR \- Hint substitution. Hint substitution is a technique ++permitting generation of more detailed hints for the rasterizer. It allows ++to use different sets of hints for different parts of a glyph and change ++these sets as neccessary during rasterization (that's why \*(L"substituted"). ++So it should improve the quality of the fonts rendered at small sizes. ++But there are two catches: First, the X11 library has rather low limit for ++the font size. More detailed hints increase the file size and thus increase ++the chance of hitting this limit (that does not mean that you shall hit it ++but you may if your fonts are particularly big). This is especially ++probable for Unicode fonts converted with option \*(L'\fB\-a\fR\*(R', so you may want to ++use \*(L'\fB\-a\fR\*(R' together with \*(L'\fB\-Ou\fR\*(R'. See \f(CWapp/X11/README\fR for the description of ++a patch to X11 which fixes this problem. Second, some rasterizers (again, ++X11 is the typical example) have a limitation for total number of hints ++used when drawing a glyph (also known as the hint stack depth). If that ++stack overflows the glyph is ignored. Starting from version 3.22 \f(CWttf2pt1\fR ++uses algorithms to minimizing this depth, with the trade-off of slightly ++bigger font files. The glyphs which still exceed the limit set by option ++\&\*(R'\fB\-mh\fR\*(R' have all the substituted hints removed and only base hints left. ++The algorithms seem to have been refined far enough to make the fonts with ++substituted hints look better than the fonts without them or at least the ++same. Still if the original fonts are not well-designed the detailed ++hinting may emphasize the defects of the design, such as non-even thickness ++of lines. So provided that you are not afraid of the X11 bug the best idea ++would be to generate a font with this feature and without it, then compare ++the results using the program \f(CWother/cmpf\fR (see the description ++in \f(CWother/README\fR) and decide which one looks better. ++\fBDefault: enabled\fR ++.Sp ++\f(CW\fBo/O\fR\fR \- Space optimization of the outlines\*(R' code. This kind of optimization ++never hurts, and the only reason to disable this feature is for comparison ++of the generated fonts with the fonts generated by the previous versions of ++converter. Well, it _almost_ never hurts. As it turned out there exist ++some brain-damaged printers which don't understand it. Actually this ++feature does not change the outlines at all. The Type 1 font manual ++provides a set of redundant operators that make font description shorter, ++such as \*(L'10 hlineto\*(R' instead of \*(L'0 10 rlineto\*(R' to describe a horizontal ++line. This feature enables use of these operators. ++\fBDefault: enabled\fR ++.Sp ++\f(CW\fBs/S\fR\fR \- Smoothing of outlines. If the font is broken in some ++way (even the ones that are not easily noticeable), such smoothing ++may break it further. So disabling this feature is the first thing to be ++tried if some font looks odd. But with smoothing off the hint generation ++algorithms may not work properly too. ++\fBDefault: enabled\fR ++.Sp ++\f(CW\fBt/T\fR\fR \- Auto-scaling to the 1000x1000 Type1 standard matrix. The ++\s-1TTF\s0 fonts are described in terms of an arbitrary matrix up to ++4000x4000. The converted fonts must be scaled to conform to ++the Type1 standard. But the scaling introduces additional rounding ++errors, so it may be curious sometimes to look at the font in its ++original scale. ++\fBDefault: enabled\fR ++.Sp ++\f(CW\fBv/V\fR\fR \- Do vectorization on the bitmap fonts. Functionally ++\*(L"vectorization\*(R" is the same thing as \*(L"autotracing\*(R", a different word is ++used purely to differentiate it from the Autotrace library. It tries to ++produce nice smooth outlines from bitmaps. This feature is still a work ++in progress though the results are already mostly decent. ++\fBDefault: disabled\fR ++.Sp ++\f(CW\fBw/W\fR\fR \- Glyphs\*(R' width corection. This option is designed to be ++used on broken fonts which specify too narrow widths for the ++letters. You can tell that a font can benefit from this option ++if you see that the characters are smashed together without ++any whitespace between them. This option causes the converter ++to set the character widths to the actual width of this character ++plus the width of a typical vertical stem. But on the other hand ++the well-designed fonts may have characters that look better if ++their widths are set slightly narrower. Such well-designed fonts ++will benefit from disabling this feature. You may want to convert ++a font with and without this feature, compare the results and ++select the better one. This feature may be used only on proportional ++fonts, it has no effect on the fixed-width fonts. ++\fBDefault: disabled\fR ++.Sp ++\f(CW\fBz/Z\fR\fR \- Use the Autotrace library on the bitmap fonts. The results ++are horrible and \fBthe use of this option is not recommended\fR. This option is ++present for experimental purposes. It may change or be removed in the ++future. The working tracing can be achieved with option \f(CW\fB-OV\fR\fR. ++\fBDefault: disabled\fR ++.Ip "\(bu" 2 ++\f(CW\fB-p \fIparser_name\fR\fR\fR \- Use the specified front-end parser to read the font file. ++If this option is not used, ttf2pt1 selects the parser automatically based ++on the suffix of the font file name, it uses the first parser in its ++list that supports this font type. Now two parsers are supported: ++.Sp ++\ \ \f(CWttf\fR \- built-in parser for the ttf files (suffix \f(CW.ttf\fR) ++.Sp ++\ \ \f(CWbdf\fR \- built-in parser for the \s-1BDF\s0 files (suffix \f(CW.bdf\fR) ++.Sp ++\ \ \f(CWft\fR \- parser based on the FreeType-2 library (suffixes \f(CW.ttf\fR, ++\&\f(CW.otf\fR, \f(CW.pfa\fR, \f(CW.pfb\fR) ++.Sp ++The parser \f(CWft\fR is \fB\s-1NOT\s0\fR linked in by default. See \f(CWMakefile\fR ++for instructions how to enable it. We do no support this parser on ++Windows: probably it will work but nobody tried and nobody knows how ++to build it. ++.Sp ++The conversion of the bitmap fonts (such as \s-1BDF\s0) is simplistic yet, ++producing jagged outlines. When converting such fonts, it might be ++a good idea to turn off the hint substitution (using option \fB\-Ou\fR) ++because the hints produced will be huge but not adding much to the ++quality of the fonts. ++.Ip "\(bu" 2 ++\f(CW\fB-u \fInumber\fR\fR\fR \- Mark the font with this value as its ++UniqueID. The UniqueID is used by the printers with the hard disks ++to cache the rasterized characters and thus significantly ++speed-up the printing. Some of those printers just can't ++store the fonts without UniqueID on their disk.The problem ++is that the \s-1ID\s0 is supposed to be unique, as it name says. And ++there is no easy way to create a guaranteed unique \s-1ID\s0. Adobe specifies ++the range 4000000-4999999 for private IDs but still it's difficult ++to guarantee the uniqueness within it. So if you don't really need the ++UniqueID don't use it, it's optional. Luckily there are a few millions of ++possible IDs, so the chances of collision are rather low. ++If instead of the number a special value \*(L'\f(CW\fBA\fR\fR\*(R' is given ++then the converter generates the value of UniqueID automatically, ++as a hash of the font name. (\fB\s-1NOTE\s0:\fR in the version 3.22 the ++algorithm for autogeneration of UniqueID was changed to fit the values ++into the Adobe-spacified range. This means that if UniqueIDs were used ++then the printer's cache may need to be flushed before replacing the ++fonts converted by an old version with fonts converted by a newer version). ++A simple way to find if any of the fonts in a given directory have ++duplicated UniqueIDs is to use the command: ++.Sp ++\f(CW\ \ cat *.pf[ab] | grep UniqueID | sort | uniq -c | grep -v ' 1 '\fR ++.Sp ++Or if you use \f(CWscripts/convert\fR it will do that for you automatically ++plus it will also give the exact list of files with duplicate UIDs. ++.Ip "\(bu" 2 ++\f(CW\fB-v \fIsize\fR\fR\fR \- Re-scale the font to get the size of a typical uppercase ++letter somewhere around the specified size. Actually, it re-scales ++the whole font to get the size of one language-dependent letter to be ++at least of the specified size. Now this letter is \*(L"A\*(R" in all the ++supported languages. The size is specified in the points of the ++Type 1 coordinate grids, the maximal value is 1000. This is an ++experimental option and should be used with caution. It tries to ++increase the visible font size for a given point size and thus make ++the font more readable. But if overused it may cause the fonts to ++look out of scale. As of now the interesting values of size for ++this option seem to be located mostly between 600 and 850. This ++re-scaling may be quite useful but needs more experience to ++understand the balance of its effects. ++.Ip "\(bu" 2 ++\f(CW\fB-W \fIlevel\fR\fR\fR \- Select the verbosity level of the warnings. ++Currently the levels from 0 to 4 are supported. Level 0 means no warnings ++at all, level 4 means all the possible warnings. The default level is 3. ++Other levels may be added in the future, so using the level number 99 is ++recommended to get all the possible warnings. Going below level 2 is ++not generally recommended because you may miss valuable information about ++the problems with the fonts being converted. ++.Ip "\(bu" 2 ++\fBObsolete option:\fR ++\f(CW\fB-A\fR\fR \- Print the font metrics (.afm file) instead of the font on \s-1STDOUT\s0. ++Use \fB\-\s-1GA\s0\fR instead. ++.Ip "\(bu" 2 ++\fBVery obsolete option:\fR ++.Sp ++The algorithm that implemented the forced fixed width had major ++flaws, so it was disabled. The code is still in the program and ++some day it will be refined and returned back. Meanwhile the ++option name \*(L'\fB\-f\fR\*(R' was reused for another option. The old version was: ++.Sp ++\f(CW\fB-f\fR\fR \- Don't try to force the fixed width of font. Normally the converter ++considers the fonts in which the glyph width deviates by not more ++than 5% as buggy fixed width fonts and forces them to have really ++fixed width. If this is undesirable, it can be disabled by this option. ++.PP ++The \f(CW.pfa\fR font format supposes that the description of the characters ++is binary encoded and encrypted. This converter does not encode or ++encrypt the data by default, you have to specify the option \*(L'\fB\-e\fR\*(R' ++or use the \f(CWt1asm\fR program to assemble (that means, encode and ++encrypt) the font program. The \f(CWt1asm\fR program that is included with ++the converter is actually a part of the \f(CWt1utils\fR package, rather old ++version of which may be obtained from ++.PP ++http://ttf2pt1.sourceforge.net/t1utils.tar.gz ++.PP ++Note that \f(CWt1asm\fR from the old version of that package won't work properly ++with the files generated by \f(CWttf2pt1\fR version 3.20 and later. Please use ++\f(CWt1asm\fR packaged with \f(CWttf2pt1\fR or from the new version \f(CWt1utils\fR ++instead. For a newer version of \f(CWt1utils\fR please look at ++.PP ++http://www.lcdf.org/~eddietwo/type/ ++.SH "EXAMPLES" ++So, the following command lines: ++.PP ++\f(CWttf2pt1 -e ttffont.ttf t1font\fR ++.PP ++\f(CWttf2pt1 ttffont.ttf - | t1asm >t1font.pfa\fR ++.PP ++represent two ways to get a working font. The benefit of the second form ++is that other filters may be applied to the font between the converter ++and assembler. ++.SH "FILES" ++.Ip "\(bu" 2 ++\s-1TTF2PT1_LIBXDIR/\s0t1asm ++.Ip "\(bu" 2 ++\s-1TTF2PT1_SHAREDIR\s0/* ++.Ip "\(bu" 2 ++\s-1TTF2PT1_SHAREDIR/\s0scripts/* ++.Ip "\(bu" 2 ++\s-1TTF2PT1_SHAREDIR/\s0other/* ++.Ip "\(bu" 2 ++\s-1TTF2PT1_SHAREDIR/README\s0 ++.Ip "\(bu" 2 ++\s-1TTF2PT1_SHAREDIR/FONTS\s0 ++.SH "SEE ALSO" ++.Ip "\(bu" 4 ++the \fIttf2pt1_convert(1)\fR manpage ++.Ip "\(bu" 4 ++the \fIttf2pt1_x2gs(1)\fR manpage ++.Ip "\(bu" 4 ++the \fIt1asm(1)\fR manpage ++.Ip "\(bu" 4 ++ttf2pt1-announce@lists.sourceforge.net ++.Sp ++The mailing list with announcements about ttf2pt1. It is a moderated mailing ++with extremely low traffic. Everyone is encouraged to subscribe to keep in ++touch with the current status of project. To subscribe use the Web interface ++at http://lists.sourceforge.net/mailman/listinfo/ttf2pt1-announce. ++If you have only e-mail access to the Net then send a subscribe request to ++the development mailing list ttf2pt1-devel@lists.sourceforge.net and somebody ++will help you with subscription. ++.Ip "\(bu" 4 ++ttf2pt1-devel@lists.sourceforge.net ++.Sp ++ttf2pt1-users@lists.sourceforge.net ++.Sp ++The ttf2pt1 mailing lists for development and users issues. They have not ++that much traffic either. To subscribe use the Web interface at ++http://lists.sourceforge.net/mailman/listinfo/ttf2pt1-devel ++and http://lists.sourceforge.net/mailman/listinfo/ttf2pt1-users. ++If you have only e-mail access to the Net then send a subscribe request to ++the development mailing list ttf2pt1-devel@lists.sourceforge.net and somebody ++will help you with subscription. ++.Ip "\(bu" 4 ++http://ttf2pt1.sourceforge.net ++.Sp ++The main page of the project. ++.Sp ++http://www.netspace.net.au/~mheath/ttf2pt1/ ++.Sp ++The old main page of the project. ++.SH "BUGS" ++It seems that many Eastern fonts use features of the TTF format that are ++not supported by the ttf2pt1's built-in front-end parser. Because of ++this for now we recommend using the FreeType-based parser (option ++\&\*(R'\fB\-p ft\fR') with the \*(L"\f(CWplane\fR\*(R" language. ++.Sh "Troubleshooting and bug reports" ++Have problems with conversion of some font ? The converter dumps core ? Or your ++printer refuses to understand the converted fonts ? Or some characters are ++missing ? Or some characters look strange ? ++.PP ++Send the bug reports to the ttf2pt1 development mailing list at ++ttf2pt1-devel@lists.sourceforge.net. ++.PP ++Try to collect more information about the problem and include it into ++the bug report. (Of course, even better if you would provide a ready ++fix, but just a detailed bug report is also good). Provide detailed ++information about your problem, this will speed up the response greatly. ++Don't just write \*(L"this font looks strange after conversion\*(R" but describe ++what's exactly wrong with it: for example, what characters look wrong ++and what exactly is wrong about their look. Providing a link to the ++original font file would be also a good idea. Try to do a little ++troublehooting and report its result. This not only would help with ++the fix but may also give you a temporary work-around for the bug. ++.PP ++First, enable full warnings with option \*(L'\fB\-W99\fR\*(R', save them to ++a file and read carefully. Sometimes the prolem is with a not implemented ++feature which is reported in the warnings. Still, reporting about such ++problems may be a good idea: some features were missed to cut corners, ++in hope that no real font is using them. So a report about a font using ++such a feature may motivate someone to implement it. Of course, you ++may be the most motivated person: after all, you are the one wishing ++to convert that font. ;\-) Seriously, the philosophy \*(L"scrath your own itch\*(R" ++seems to be the strongest moving force behind the Open Source software. ++.PP ++The next step is playing with the options. This serves a dual purpose: ++on one hand, it helps to localize the bug, on the other hand you may be ++able to get a working version of the font for the meantime while the ++bug is being fixed. The typical options to try out are: first \*(L'\fB\-Ou\fR\*(R', if ++it does not help then \*(L'\fB\-Os\fR\*(R', then \*(L'\fB\-Oh\fR\*(R', then \*(L'\fB\-Oo\fR\*(R'. ++They are described in a bit more detail above. Try them one by one ++and in combinations. See if with them the resulting fonts look better. ++.PP ++On some fonts ttf2pt1 just crashes. Commonly that happens because the ++font being converted is highly defective (although sometimes the bug ++is in ttf2pt1 itself). In any case it should not crash, so the reports ++about such cases will help to handle these defects properly in future. ++.PP ++We try to respond to the bug reports in a timely fashion but alas, this ++may not always be possible, especially if the problem is complex. ++This is a volunteer project and its resources are limited. Because ++of this we would appreciate bug reports as detailed as possible, ++and we would appreciate the ready fixes and contributions even more. ++.SH "HISTORY" ++Based on ttf2pfa by Andrew Weeks, and help from Frank Siegert. ++.PP ++Modification by Mark Heath. ++.PP ++Further modification by Sergey Babkin. ++.PP ++The Type1 assembler by I. Lee Hetherington with modifications by ++Kai-Uwe Herbing. ++ ++.rn }` '' ++.IX Title "TTF2PT1 1" ++.IX Name "TTF2PT1 - A True Type to PostScript Type 1 Font Converter" ++ ++.IX Header "NAME" ++ ++.IX Header "SYNOPSIS" ++ ++.IX Header "DESCRIPTION" ++ ++.IX Header "OPTIONS" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Header "EXAMPLES" ++ ++.IX Header "FILES" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Header "SEE ALSO" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Header "BUGS" ++ ++.IX Subsection "Troubleshooting and bug reports" ++ ++.IX Header "HISTORY" ++ +diff -ruN xserver-old/hw/xprint/extras/ttf2pt1/ttf2pt1.c xserver/hw/xprint/extras/ttf2pt1/ttf2pt1.c +--- xserver-old/hw/xprint/extras/ttf2pt1/ttf2pt1.c 1970-01-01 10:00:00.000000000 +1000 ++++ xserver/hw/xprint/extras/ttf2pt1/ttf2pt1.c 2006-06-27 13:10:26.000000000 +1000 +@@ -0,0 +1,2722 @@ ++/* ++ * True Type Font to Adobe Type 1 font converter ++ * By Mark Heath ++ * Based on ttf2pfa by Andrew Weeks ++ * With help from Frank M. Siegert ++ * ++ * see COPYRIGHT for full copyright notice ++ * ++*********************************************************************** ++ * ++ * Sergey Babkin , ++ * ++ * Added post-processing of resulting outline to correct the errors ++ * both introduced during conversion and present in the original font, ++ * autogeneration of hints (has yet to be improved though) and BlueValues, ++ * scaling to 1000x1000 matrix, option to print the result on STDOUT, ++ * support of Unicode to CP1251 conversion, optimization of the ++ * resulting font code by space (that improves the speed too). Excluded ++ * the glyphs that are unaccessible through the encoding table from ++ * the output file. Added the built-in Type1 assembler (taken from ++ * the `t1utils' package). ++ * ++*********************************************************************** ++ * ++ * Thomas Henlich ++ * ++ * Added generation of .afm file (font metrics) ++ * Read encoding information from encoding description file ++ * Fixed bug in error message about unknown language ('-l' option) ++ * Added `:' after %%!PS-AdobeFont-1.0 ++ * changed unused entries in ISOLatin1Encoding[] from .notdef to c127,c128... ++ * ++*********************************************************************** ++ * ++ * Thomas Henlich ++ * ++ * Added generation of .afm file (font metrics) ++ * ++*********************************************************************** ++ * ++ * Bug Fixes: ++************************************************************************ ++ * ++ * Sun, 21 Jun 1998 Thomas Henlich ++ * 1. "width" should be "short int" because otherwise: ++ * characters with negative widths (e.g. -4) become *very* wide (65532) ++ * 2. the number of /CharStrings is numglyphs and not numglyphs+1 ++ * ++*********************************************************************** ++ * ++ * ++ * ++ * The resultant font file produced by this program still needs to be ran ++ * through t1asm (from the t1utils archive) to produce a completely valid ++ * font. ++ * ++ */ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#ifdef _GNU_SOURCE ++#include ++#endif ++ ++#ifndef WINDOWS ++# include ++# include ++# define BITBUCKET "/dev/null" ++# include ++#else ++# define WINDOWS_FUNCTIONS /* ask to define functions - in one file only */ ++# include "windows.h" ++# define BITBUCKET "NUL" ++# define snprintf _snprintf ++#endif ++ ++#ifdef XP_PSTEXT ++#include ++#include FT_FREETYPE_H ++#include FT_TRUETYPE_TABLES_H ++#include FT_BBOX_H ++#include FT_GLYPH_H ++ ++#include FT_CONFIG_CONFIG_H ++#include FT_CONFIG_OPTIONS_H ++#include FT_ERRORS_H ++#include FT_SYSTEM_H ++#include FT_IMAGE_H ++#include FT_TYPES_H ++#include FT_OUTLINE_H ++#include FT_MODULE_H ++#include FT_RENDER_H ++#include FT_TYPE1_TABLES_H ++#include FT_TRUETYPE_IDS_H ++#include FT_TRUETYPE_TAGS_H ++#include FT_MULTIPLE_MASTERS_H ++#include FT_SFNT_NAMES_H ++ ++#include "os.h" ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#define NOT_IN_FTFUNCS ++#include ++#endif /* XP_PSTEXT */ ++ ++#include "pt1.h" ++#include "global.h" ++#include "version.h" ++ ++/* globals */ ++ ++/* table of front-ends */ ++ ++#ifdef USE_TTF ++extern struct frontsw ttf_sw; ++#endif /* USE_TTF */ ++#ifdef USE_BDF ++extern struct frontsw bdf_sw; ++#endif /* USE_BDF */ ++#if defined(USE_FREETYPE) ++ extern struct frontsw freetype_sw; ++#endif ++ ++struct frontsw *frontswtab[] = { ++#ifdef USE_BDF ++ &bdf_sw, ++#endif /* USE_BDF */ ++#if defined(USE_FREETYPE) && defined(PREFER_FREETYPE) ++ &freetype_sw, ++#endif ++#ifdef USE_TTF ++ &ttf_sw, ++#endif /* USE_TTF */ ++#if defined(USE_FREETYPE) && !defined(PREFER_FREETYPE) ++ &freetype_sw, ++#endif ++ NULL /* end of table */ ++}; ++ ++struct frontsw *cursw=0; /* the active front end */ ++char *front_arg=""; /* optional argument */ ++ ++/* options */ ++int encode = 0; /* encode the resulting file */ ++int pfbflag = 0; /* produce compressed file */ ++int wantafm=0; /* want to see .afm instead of .t1a on stdout */ ++int correctvsize=0; /* try to correct the vertical size of characters */ ++int wantuid = 0; /* user wants UniqueID entry in the font */ ++int allglyphs = 0; /* convert all glyphs, not only 256 of them */ ++int warnlevel = 3; /* the level of permitted warnings */ ++int forcemap = 0; /* do mapping even on non-Unicode fonts */ ++/* options - maximal limits */ ++int max_stemdepth = 128; /* maximal depth of stem stack in interpreter (128 - limit from X11) */ ++/* options - debugging */ ++int absolute = 0; /* print out in absolute values */ ++int reverse = 1; /* reverse font to Type1 path directions */ ++/* options - suboptions of Outline Processing, defaults are set in table */ ++int optimize; /* enables space optimization */ ++int smooth; /* enable smoothing of outlines */ ++int transform; /* enables transformation to 1000x1000 matrix */ ++int hints; /* enables autogeneration of hints */ ++int subhints; /* enables autogeneration of substituted hints */ ++int trybold; /* try to guess whether the font is bold */ ++int correctwidth; /* try to correct the character width */ ++int vectorize; /* vectorize the bitmaps */ ++int use_autotrace; /* use the autotrace library on bitmap */ ++/* options - suboptions of File Generation, defaults are set in table */ ++int gen_pfa; /* generate the font file */ ++int gen_afm; /* generate the metrics file */ ++int gen_dvienc; /* generate the dvips encoding file */ ++ ++/* not quite options to select a particular source encoding */ ++int force_pid = -1; /* specific platform id */ ++int force_eid = -1; /* specific encoding id */ ++ ++/* structure to define the sub-option lists controlled by the ++ * case: uppercase enables them, lowercase disables ++ */ ++struct subo_case { ++ char disbl; /* character to disable - enforced lowercase */ ++ char enbl; /* character to enable - auto-set as toupper(disbl) */ ++ int *valp; /* pointer to the actual variable containing value */ ++ int dflt; /* default value */ ++ char *descr; /* description */ ++}; ++ ++#ifdef DEBUG ++int debug = DEBUG; /* debugging flag */ ++#else ++int debug = 0; ++#endif /* DEBUG */ ++ ++FILE *null_file, *pfa_file, *afm_file, *dvienc_file; ++int numglyphs; ++struct font_metrics fontm; ++ ++/* non-globals */ ++static char *strUID = 0; /* user-supplied UniqueID */ ++static unsigned long numUID; /* auto-generated UniqueID */ ++ ++static int ps_fmt_3 = 0; ++static double scale_factor, original_scale_factor; ++ ++static char *glyph_rename[ENCTABSZ]; ++ ++/* the names assigned if the original font ++ * does not specify any ++ */ ++ ++static char *Fmt3Encoding[256] = { ++ "c0", "c1", "c2", "c3", ++ "c4", "c5", "c6", "c7", ++ "c8", "c9", "c10", "c11", ++ "c12", "CR", "c14", "c15", ++ "c16", "c17", "c18", "c19", ++ "c20", "c21", "c22", "c23", ++ "c24", "c25", "c26", "c27", ++ "c28", "c29", "c30", "c31", ++ "space", "exclam", "quotedbl", "numbersign", ++ "dollar", "percent", "ampersand", "quotesingle", ++ "parenleft", "parenright", "asterisk", "plus", ++ "comma", "hyphen", "period", "slash", ++ "zero", "one", "two", "three", ++ "four", "five", "six", "seven", ++ "eight", "nine", "colon", "semicolon", ++ "less", "equal", "greater", "question", ++ "at", "A", "B", "C", ++ "D", "E", "F", "G", ++ "H", "I", "J", "K", ++ "L", "M", "N", "O", ++ "P", "Q", "R", "S", ++ "T", "U", "V", "W", ++ "X", "Y", "Z", "bracketleft", ++ "backslash", "bracketright", "asciicircum", "underscore", ++ "grave", "a", "b", "c", ++ "d", "e", "f", "g", ++ "h", "i", "j", "k", ++ "l", "m", "n", "o", ++ "p", "q", "r", "s", ++ "t", "u", "v", "w", ++ "x", "y", "z", "braceleft", ++ "bar", "braceright", "asciitilde", "c127", ++ "c128", "c129", "quotesinglbase", "florin", ++ "quotedblbase", "ellipsis", "dagger", "daggerdbl", ++ "circumflex", "perthousand", "Scaron", "guilsinglleft", ++ "OE", "c141", "c142", "c143", ++ "c144", "quoteleft", "quoteright", "quotedblleft", ++ "quotedblright", "bullet", "endash", "emdash", ++ "tilde", "trademark", "scaron", "guilsinglright", ++ "oe", "c157", "c158", "Ydieresis", ++ "nbspace", "exclamdown", "cent", "sterling", ++ "currency", "yen", "brokenbar", "section", ++ "dieresis", "copyright", "ordfeminine", "guillemotleft", ++ "logicalnot", "sfthyphen", "registered", "macron", ++ "degree", "plusminus", "twosuperior", "threesuperior", ++ "acute", "mu", "paragraph", "periodcentered", ++ "cedilla", "onesuperior", "ordmasculine", "guillemotright", ++ "onequarter", "onehalf", "threequarters", "questiondown", ++ "Agrave", "Aacute", "Acircumflex", "Atilde", ++ "Adieresis", "Aring", "AE", "Ccedilla", ++ "Egrave", "Eacute", "Ecircumflex", "Edieresis", ++ "Igrave", "Iacute", "Icircumflex", "Idieresis", ++ "Eth", "Ntilde", "Ograve", "Oacute", ++ "Ocircumflex", "Otilde", "Odieresis", "multiply", ++ "Oslash", "Ugrave", "Uacute", "Ucircumflex", ++ "Udieresis", "Yacute", "Thorn", "germandbls", ++ "agrave", "aacute", "acircumflex", "atilde", ++ "adieresis", "aring", "ae", "ccedilla", ++ "egrave", "eacute", "ecircumflex", "edieresis", ++ "igrave", "iacute", "icircumflex", "idieresis", ++ "eth", "ntilde", "ograve", "oacute", ++ "ocircumflex", "otilde", "odieresis", "divide", ++ "oslash", "ugrave", "uacute", "ucircumflex", ++ "udieresis", "yacute", "thorn", "ydieresis" ++}; ++ ++#ifdef notdef /* { */ ++/* This table is not used anywhere in the code ++ * so it's ifdef-ed out by default but left in ++ * the source code for reference purposes (and ++ * possibly for future use) ++ */ ++ ++static char *ISOLatin1Encoding[256] = { ++ ".null", ".notdef", ".notdef", ".notdef", ++ ".notdef", ".notdef", ".notdef", ".notdef", ++ ".notdef", ".notdef", ".notdef", ".notdef", ++ ".notdef", "CR", ".notdef", ".notdef", ++ ".notdef", ".notdef", ".notdef", ".notdef", ++ ".notdef", ".notdef", ".notdef", ".notdef", ++ ".notdef", ".notdef", ".notdef", ".notdef", ++ ".notdef", ".notdef", ".notdef", ".notdef", ++ "space", "exclam", "quotedbl", "numbersign", ++ "dollar", "percent", "ampersand", "quoteright", ++ "parenleft", "parenright", "asterisk", "plus", ++ "comma", "hyphen", "period", "slash", ++ "zero", "one", "two", "three", ++ "four", "five", "six", "seven", ++ "eight", "nine", "colon", "semicolon", ++ "less", "equal", "greater", "question", ++ "at", "A", "B", "C", ++ "D", "E", "F", "G", ++ "H", "I", "J", "K", ++ "L", "M", "N", "O", ++ "P", "Q", "R", "S", ++ "T", "U", "V", "W", ++ "X", "Y", "Z", "bracketleft", ++ "backslash", "bracketright", "asciicircum", "underscore", ++ "grave", "a", "b", "c", ++ "d", "e", "f", "g", ++ "h", "i", "j", "k", ++ "l", "m", "n", "o", ++ "p", "q", "r", "s", ++ "t", "u", "v", "w", ++ "x", "y", "z", "braceleft", ++ "bar", "braceright", "asciitilde", "c127", ++ "c128", "c129", "quotesinglbase", "florin", ++ "quotedblbase", "ellipsis", "dagger", "daggerdbl", ++ "circumflex", "perthousand", "Scaron", "guilsinglleft", ++ "OE", "c141", "c142", "c143", ++ "c144", "quoteleft", "quoteright", "quotedblleft", ++ "quotedblright", "bullet", "endash", "emdash", ++ "tilde", "trademark", "scaron", "guilsinglright", ++ "oe", "c157", "c158", "Ydieresis", ++ "nbspace", "exclamdown", "cent", "sterling", ++ "currency", "yen", "brokenbar", "section", ++ "dieresis", "copyright", "ordfeminine", "guillemotleft", ++ "logicalnot", "sfthyphen", "registered", "macron", ++ "degree", "plusminus", "twosuperior", "threesuperior", ++ "acute", "mu", "paragraph", "periodcentered", ++ "cedilla", "onesuperior", "ordmasculine", "guillemotright", ++ "onequarter", "onehalf", "threequarters", "questiondown", ++ "Agrave", "Aacute", "Acircumflex", "Atilde", ++ "Adieresis", "Aring", "AE", "Ccedilla", ++ "Egrave", "Eacute", "Ecircumflex", "Edieresis", ++ "Igrave", "Iacute", "Icircumflex", "Idieresis", ++ "Eth", "Ntilde", "Ograve", "Oacute", ++ "Ocircumflex", "Otilde", "Odieresis", "multiply", ++ "Oslash", "Ugrave", "Uacute", "Ucircumflex", ++ "Udieresis", "Yacute", "Thorn", "germandbls", ++ "agrave", "aacute", "acircumflex", "atilde", ++ "adieresis", "aring", "ae", "ccedilla", ++ "egrave", "eacute", "ecircumflex", "edieresis", ++ "igrave", "iacute", "icircumflex", "idieresis", ++ "eth", "ntilde", "ograve", "oacute", ++ "ocircumflex", "otilde", "odieresis", "divide", ++ "oslash", "ugrave", "uacute", "ucircumflex", ++ "udieresis", "yacute", "thorn", "ydieresis" ++}; ++ ++#endif /* } notdef */ ++ ++static char *adobe_StandardEncoding[256] = { ++ ".notdef", ".notdef", ".notdef", ".notdef", ++ ".notdef", ".notdef", ".notdef", ".notdef", ++ ".notdef", ".notdef", ".notdef", ".notdef", ++ ".notdef", ".notdef", ".notdef", ".notdef", ++ ".notdef", ".notdef", ".notdef", ".notdef", ++ ".notdef", ".notdef", ".notdef", ".notdef", ++ ".notdef", ".notdef", ".notdef", ".notdef", ++ ".notdef", ".notdef", ".notdef", ".notdef", ++ "space", "exclam", "quotedbl", "numbersign", ++ "dollar", "percent", "ampersand", "quoteright", ++ "parenleft", "parenright", "asterisk", "plus", ++ "comma", "hyphen", "period", "slash", ++ "zero", "one", "two", "three", ++ "four", "five", "six", "seven", ++ "eight", "nine", "colon", "semicolon", ++ "less", "equal", "greater", "question", ++ "at", "A", "B", "C", "D", "E", "F", "G", ++ "H", "I", "J", "K", "L", "M", "N", "O", ++ "P", "Q", "R", "S", "T", "U", "V", "W", ++ "X", "Y", "Z", "bracketleft", ++ "backslash", "bracketright", "asciicircum", "underscore", ++ "quoteleft", "a", "b", "c", "d", "e", "f", "g", ++ "h", "i", "j", "k", "l", "m", "n", "o", ++ "p", "q", "r", "s", "t", "u", "v", "w", ++ "x", "y", "z", "braceleft", ++ "bar", "braceright", "asciitilde", ".notdef", ++ ".notdef", ".notdef", ".notdef", ".notdef", ++ ".notdef", ".notdef", ".notdef", ".notdef", ++ ".notdef", ".notdef", ".notdef", ".notdef", ++ ".notdef", ".notdef", ".notdef", ".notdef", ++ ".notdef", ".notdef", ".notdef", ".notdef", ++ ".notdef", ".notdef", ".notdef", ".notdef", ++ ".notdef", ".notdef", ".notdef", ".notdef", ++ ".notdef", ".notdef", ".notdef", ".notdef", ++ ".notdef", "exclamdown", "cent", "sterling", ++ "fraction", "yen", "florin", "section", ++ "currency", "quotesingle", "quotedblleft", "guillemotleft", ++ "guilsinglleft", "guilsinglright", "fi", "fl", ++ ".notdef", "endash", "dagger", "daggerdbl", ++ "periodcentered", ".notdef", "paragraph", "bullet", ++ "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", ++ "ellipsis", "perthousand", ".notdef", "questiondown", ++ ".notdef", "grave", "acute", "circumflex", ++ "tilde", "macron", "breve", "dotaccent", ++ "dieresis", ".notdef", "ring", "cedilla", ++ ".notdef", "hungarumlaut", "ogonek", "caron", ++ "emdash", ".notdef", ".notdef", ".notdef", ++ ".notdef", ".notdef", ".notdef", ".notdef", ++ ".notdef", ".notdef", ".notdef", ".notdef", ++ ".notdef", ".notdef", ".notdef", ".notdef", ++ ".notdef", "AE", ".notdef", "ordfeminine", ++ ".notdef", ".notdef", ".notdef", ".notdef", ++ "Lslash", "Oslash", "OE", "ordmasculine", ++ ".notdef", ".notdef", ".notdef", ".notdef", ++ ".notdef", "ae", ".notdef", ".notdef", ++ ".notdef", "dotlessi", ".notdef", ".notdef", ++ "lslash", "oslash", "oe", "germandbls", ++ ".notdef", ".notdef", ".notdef", ".notdef" ++}; ++ ++/* ++ * Decription of the supported conversions from Unicode ++ * ++ * SB ++ * Yes, I know that the compiled-in conversion is stupid but ++ * it is simple to implement and allows not to worry about the ++ * filesystem context. After all, the source is always available ++ * and adding another language to it is easy. ++ * ++ * The language name is expected to be the same as the subdirectory name ++ * in the `encodings' directory (for possible future extensions). ++ * The primary use of the aliases is for guessing based on the current ++ * locale. ++ */ ++ ++#define MAXUNIALIAS 10 ++#define MAXUNITABLES 3 ++ ++/* the character used as the language argument separator */ ++#define LANG_ARG_SEP '+' ++ ++ ++/* ++ * Types of language-related routines. Arguments are: ++ * name is the glyph name ++ * arg is the user-specified language-dependent argument ++ * which can for example select the subfont plane for Eastern fonts. ++ * If none is supplied by user then an empty string ("") is passed. ++ * If no language is specified by user and auto-guessing happens ++ * then NULL is passed. ++ * when shows if the conversion by name was called before conversion by ++ * map or after (it's called twice) ++ */ ++ ++/* type of the Unicode map initialization routine */ ++typedef void uni_init_t(char *arg); ++ ++/* type of Unicode converter-by-name function ++ * it's called for each glyph twice: one time for each glyph ++ * before doing conversion by map and one time after ++ */ ++typedef int uni_conv_t(char *name, char *arg, int when); ++#define UNICONV_BYNAME_BEFORE 0 ++#define UNICONV_BYNAME_AFTER 1 ++ ++struct uni_language { ++ uni_init_t *init[MAXUNITABLES]; /* map initialization routines */ ++ uni_conv_t *convbyname; /* the name-based conversion function */ ++ char *name; /* the language name */ ++ char *descr; /* description */ ++ char *alias[MAXUNIALIAS]; /* aliases of the language name */ ++ int sample_upper; /* code of some uppercase character for correctvsize() */ ++}; ++ ++/* the converter routines have an option of adding this suffix to the font name */ ++static char *uni_font_name_suffix = ""; /* empty by default */ ++/* this buffer may be used to store the suffix */ ++#define UNI_MAX_SUFFIX_LEN 100 ++static char uni_suffix_buf[UNI_MAX_SUFFIX_LEN+1]; ++ ++/* ++ * Prototypes of the conversion routines ++ */ ++ ++static uni_init_t unicode_latin1; ++static uni_init_t unicode_latin2; ++static uni_init_t unicode_latin4; ++static uni_init_t unicode_latin5; ++static uni_init_t unicode_cyrillic; ++static uni_init_t unicode_adobestd; ++static uni_init_t unicode_plane; ++static uni_conv_t unicode_adobestd_byname; ++ ++static uni_init_t unicode_init_user; ++ ++/* ++ * The order of descriptions is important: if we can't guess the ++ * language we just call all the conversion routines in order until ++ * we find one that understands this glyph. ++ */ ++static struct uni_language uni_lang[]= { ++ /* pseudo-language for all the languages using Latin1 */ ++ { ++ { unicode_latin1 }, ++ 0, /* no name-based mapping */ ++ "latin1", ++ "works for most of the Western languages", ++ { "en_", "de_", "fr_", "nl_", "no_", "da_", "it_" }, ++ 'A' ++ }, ++ { /* by Szalay Tamas */ ++ { unicode_latin2 }, ++ 0, /* no name-based mapping */ ++ "latin2", ++ "works for Central European languages", ++ { "hu_","pl_","cz_","si_","sk_" }, ++ 'A' ++ }, ++ { /* by Rièardas Èepas */ ++ { unicode_latin4 }, ++ 0, /* no name-based mapping */ ++ "latin4", ++ "works for Baltic languages", ++ { "lt_", "lv_" }, /* doubt about ee_ */ ++ 'A' ++ }, ++ { /* by Turgut Uyar */ ++ { unicode_latin5 }, ++ 0, /* no name-based mapping */ ++ "latin5", ++ "for Turkish", ++ { "tr_" }, ++ 'A' ++ }, ++ { /* by Zvezdan Petkovic */ ++ { unicode_cyrillic, unicode_latin1 }, ++ 0, /* no name-based mapping */ ++ "cyrillic", ++ "in Windows encoding", ++ { "bg_", "be_", "mk_", "ru_", "sr_", "su_", "uk_" }, ++ 'A' ++ }, ++ { ++ { unicode_cyrillic, unicode_latin1 }, ++ 0, /* no name-based mapping */ ++ "russian", ++ "obsolete, use cyrillic instead", ++ { 0 }, ++ 'A' ++ }, ++ { ++ { unicode_cyrillic, unicode_latin1 }, ++ 0, /* no name-based mapping */ ++ "bulgarian", ++ "obsolete, use cyrillic instead", ++ { 0 }, ++ 'A' ++ }, ++ { ++ { unicode_adobestd }, ++ unicode_adobestd_byname, ++ "adobestd", ++ "Adobe Standard, expected by TeX", ++ { NULL }, ++ 'A' ++ }, ++ { ++ { unicode_plane }, ++ 0, /* no name-based mapping */ ++ "plane", ++ "one plane of Unicode or other multi-byte encoding as is", ++ { NULL }, ++ 0 /* no easy way to predict the capital letters */ ++ }, ++}; ++ ++static struct uni_language uni_lang_user = { ++ { unicode_init_user }, ++ 0, /* no name-based mapping */ ++ 0, /* no name */ ++ 0, /* no description */ ++ { 0 }, ++ 0 /* no sample */ ++}; ++ ++static struct uni_language *uni_lang_selected=0; /* 0 means "unknown, try all" */ ++static int uni_sample='A'; /* sample of an uppercase character */ ++static char *uni_lang_arg=""; /* user-supplied language-dependent argument */ ++ ++extern int runt1asm(int); ++ ++/* ++ * user-defined loadable maps ++ */ ++ ++ ++/* The idea begind buckets is to avoid comparing every code with all ENCTABSZ codes in table. ++ * All the 16-bit unicode space is divided between a number of equal-sized buckets. ++ * Initially all the buckets are marked with 0. Then if any code in the bucket is ++ * used it's marked with 1. Later during translation we check the code's bucket first ++ * and it it's 0 then return failure right away. This may be useful for ++ * Chinese fonts with many thousands of glyphs. ++ */ ++ ++#define BUCKET_ID_BITS 11 ++#define MARK_UNI_BUCKET(unicode) SET_BITMAP(uni_user_buckets, (unicode)>>(16-BUCKET_ID_BITS)) ++#define IS_UNI_BUCKET(unicode) IS_BITMAP(uni_user_buckets, (unicode)>>(16-BUCKET_ID_BITS)) ++ ++static DEF_BITMAP(uni_user_buckets, 1< UNI_MAX_SUFFIX_LEN-1) ++ arg = NULL; ++ else { ++ sprintf(uni_suffix_buf, "-%s", arg); ++ uni_font_name_suffix = uni_suffix_buf; ++ } ++ } ++ ++ /* now read in the encoding description file, if requested */ ++ if ((unicode_map_file = fopen(path, "r")) == NULL) { ++ fprintf(stderr, "**** Cannot access map file '%s' ****\n", path); ++ exit(1); ++ } ++ ++ sawplane = 0; ++ if(arg==NULL) ++ enabled = found = 1; ++ else ++ enabled = found = 0; ++ ++ lineno=0; curpos=0; ++ while (fgets (buffer, UNIBFSZ, unicode_map_file) != NULL) { ++ char name[UNIBFSZ]; ++ ++ lineno++; ++ ++ if(sscanf(buffer, "plane %s", name)==1) { ++ sawplane = 1; ++ if(arg == 0) { ++ fprintf(stderr, "**** map file '%s' requires plane name\n", path); ++ fprintf(stderr, "for example:\n"); ++ fprintf(stderr, " ttf2pt1 -L %s%c[pid=N,eid=N,]%s ...\n", ++ path, LANG_ARG_SEP, name); ++ fprintf(stderr, "to select plane '%s'\n", name); ++ exit(1); ++ } ++ if( !strcmp(arg, name) ) { ++ enabled = found = 1; ++ curpos = 0; ++ } else { ++ enabled = 0; ++ if(found) /* no need to read further */ ++ break; ++ } ++ continue; ++ } ++ ++ if(sscanf(buffer, "id %d %d", &pid, &eid)==2) { ++ if( !overid /* only if the user has not overriden */ ++ && (enabled || !sawplane) ) { ++ force_pid = pid; force_eid = eid; ++ forcemap = 1; ++ } ++ continue; ++ } ++ ++ if( !enabled ) ++ continue; /* skip to the next plane */ ++ ++ if( sscanf(buffer, "at %i", &curpos) == 1 ) { ++ if(curpos > 255) { ++ fprintf(stderr, "**** map file '%s' line %d: code over 255\n", path, lineno); ++ exit(1); ++ } ++ if(ISDBG(EXTMAP)) fprintf(stderr, "=== at 0x%x\n", curpos); ++ continue; ++ } ++ ++ /* try the format of Roman Czyborra's files */ ++ if ( sscanf (buffer, " =%x U+%4x", &code, &unicode) == 2 ++ /* try the format of Linux locale charmap file */ ++ || sscanf (buffer, " <%*s /x%x ", &code, &unicode) == 2 ) { ++ if (code < ENCTABSZ) { ++ if(code >= enctabsz) enctabsz=code+1; ++ unicode_map[code] = unicode; ++ glyph_rename[code] = NULL; ++ } ++ } ++ /* try the format with glyph renaming */ ++ else if (sscanf (buffer, " !%x U+%4x %128s", &code, ++ &unicode, name) == 3) { ++ if (code < ENCTABSZ) { ++ if(code >= enctabsz) enctabsz=code+1; ++ unicode_map[code] = unicode; ++ glyph_rename[code] = strdup(name); ++ } ++ } ++ /* try the compact sequence format */ ++ else if( (n=sscanf(buffer, " %i%n", &unicode, &cnt)) == 1 ) { ++ p = buffer; ++ do { ++ if(curpos > 255) { ++ fprintf(stderr, "**** map file '%s' line %d: code over 255 for unicode 0x%x\n", ++ path, lineno, unicode); ++ exit(1); ++ } ++ if(ISDBG(EXTMAP)) fprintf(stderr, "=== 0x%d -> 0x%x\n", curpos, unicode); ++ unicode_map[curpos++] = unicode; ++ p += cnt; ++ if( sscanf(p, " %[,-]%n", &next,&cnt) == 1 ) { ++ if(ISDBG(EXTMAP)) fprintf(stderr, "=== next: '%c'\n", next); ++ p += cnt; ++ if( next == '-' ) { /* range */ ++ if ( sscanf(p, " %i%n", &unicode2, &cnt) != 1 ) { ++ fprintf(stderr, "**** map file '%s' line %d: missing end of range\n", path, lineno); ++ exit(1); ++ } ++ p += cnt; ++ if(ISDBG(EXTMAP)) fprintf(stderr, "=== range 0x%x to 0x%x\n", unicode, unicode2); ++ for(unicode++; unicode <= unicode2; unicode++) { ++ if(curpos > 255) { ++ fprintf(stderr, "**** map file '%s' line %d: code over 255 in unicode range ...-0x%x\n", ++ path, lineno, unicode2); ++ exit(1); ++ } ++ if(ISDBG(EXTMAP)) fprintf(stderr, "=== 0x%x -> 0x%x\n", curpos, unicode); ++ unicode_map[curpos++] = unicode; ++ } ++ } ++ } ++ } while ( sscanf(p, " %i%n", &unicode, &cnt) == 1 ); ++ } ++ ++ } ++ ++ fclose (unicode_map_file); ++ ++ if( !found ) { ++ fprintf(stderr, "**** map file '%s' has no plane '%s'\n", path, arg); ++ exit(1); ++ } ++ ++ if(unicode_map['A'] == 'A') ++ uni_sample = 'A'; /* seems to be compatible with Latin */ ++ else ++ uni_sample = 0; /* don't make any assumptions */ ++} ++ ++/* ++ * by Zvezdan Petkovic ++ */ ++static void ++unicode_cyrillic( ++ char *arg ++) ++{ ++ int i; ++ static unsigned int cyrillic_unicode_map[] = { ++ 0x0402, 0x0403, 0x201a, 0x0453, 0x201e, 0x2026, 0x2020, 0x2021, /* 80 */ ++ 0x20ac, 0x2030, 0x0409, 0x2039, 0x040a, 0x040c, 0x040b, 0x040f, /* 88 */ ++ 0x0452, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, /* 90 */ ++ 0x02dc, 0x2122, 0x0459, 0x203a, 0x045a, 0x045c, 0x045b, 0x045f, /* 98 */ ++ 0x00a0, 0x040e, 0x045e, 0x0408, 0x00a4, 0x0490, 0x00a6, 0x00a7, /* A0 */ ++ 0x0401, 0x00a9, 0x0404, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x0407, /* A8 */ ++ 0x00b0, 0x00b1, 0x0406, 0x0456, 0x0491, 0x00b5, 0x00b6, 0x00b7, /* B0 */ ++ 0x0451, 0x2116, 0x0454, 0x00bb, 0x0458, 0x0405, 0x0455, 0x0457, /* B8 */ ++ }; ++ ++ for(i=0; i<=0x7F; i++) ++ unicode_map[i] = i; ++ ++ for(i=0x80; i<=0xBF; i++) ++ unicode_map[i] = cyrillic_unicode_map[i-0x80]; ++ ++ for(i=0xC0; i<=0xFF; i++) ++ unicode_map[i] = i+0x350; ++ ++} ++ ++static void ++unicode_latin1( ++ char *arg ++) ++{ ++ int i; ++ static unsigned int latin1_unicode_map[] = { ++ 0x20ac, -1, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, /* 80 */ ++ 0x02c6, 0x2030, 0x0160, 0x2039, 0x0152, 0x008d, 0x017d, 0x008f, /* 88 */ ++ 0x0090, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, /* 90 */ ++ 0x02dc, 0x2122, 0x0161, 0x203a, 0x0153, 0x009d, 0x017e, 0x0178, /* 98 */ ++ }; ++ ++ for(i=0; i<=0x7F; i++) ++ unicode_map[i] = i; ++ ++ for(i=0x80; i<=0x9F; i++) ++ unicode_map[i] = latin1_unicode_map[i-0x80]; ++ ++ for(i=0xA0; i<=0xFF; i++) ++ unicode_map[i] = i; ++} ++ ++static void ++unicode_adobestd( ++ char *arg ++) ++{ ++ int i; ++ static unsigned int adobestd_unicode_map[] = { ++ -1, 0x00a1, 0x00a2, 0x00a3, 0x2215, 0x00a5, 0x0192, 0x00a7, /* A0 */ ++ 0x00a4, 0x0027, 0x201c, 0x00ab, 0x2039, 0x203a, 0xfb01, 0xfb02, /* A8 */ ++ -1, 0x2013, 0x2020, 0x2021, 0x2219, -1, 0x00b6, 0x2022, /* B0 */ ++ 0x201a, 0x201e, 0x201d, 0x00bb, 0x2026, 0x2030, -1, 0x00bf, /* B8 */ ++ -1, 0x0060, 0x00b4, 0x02c6, 0x02dc, 0x02c9, 0x02d8, 0x02d9, /* C0 */ ++ 0x00a8, -1, 0x02da, 0x00b8, -1, 0x02dd, 0x02db, 0x02c7, /* C8 */ ++ 0x2014, -1, -1, -1, -1, -1, -1, -1, /* D0 */ ++ -1, -1, -1, -1, -1, -1, -1, -1, /* D8 */ ++ -1, 0x00c6, -1, 0x00aa, -1, -1, -1, -1, /* E0 */ ++ 0x0141, 0x00d8, 0x0152, 0x00ba, -1, -1, -1, -1, /* E8 */ ++ -1, 0x00e6, -1, -1, -1, 0x0131, -1, -1, /* F0 */ ++ 0x0142, 0x00f8, 0x0153, 0x00df, -1, -1, -1, -1, /* F8 */ ++ }; ++ ++ for(i=0; i<=0x7F; i++) ++ unicode_map[i] = i; ++ ++ unicode_map[0x27] = 0x2019; ++ unicode_map[0x60] = -1; ++ ++ /* 0x80 to 0x9F is a hole */ ++ ++ for(i=0xA0; i<=0xFF; i++) ++ unicode_map[i] = adobestd_unicode_map[i-0xA0]; ++} ++ ++/* ++ * Not all of the Adobe glyphs are in the Unicode ++ * standard maps, so the font creators have ++ * different ideas about their codes. Because ++ * of this we try to map based on the glyph ++ * names instead of Unicode codes. If there are ++ * no glyph names (ps_fmt_3!=0) we fall back ++ * to the code-based scheme. ++ */ ++ ++static int ++unicode_adobestd_byname( ++ char *name, ++ char *arg, ++ int where ++) ++{ ++ int i; ++ ++ /* names always take precedence over codes */ ++ if(where == UNICONV_BYNAME_AFTER) ++ return -1; ++ ++ for(i=32; i<256; i++) { ++ if(!strcmp(name, adobe_StandardEncoding[i])) ++ return i; ++ } ++ return -1; ++ ++} ++ ++static void ++unicode_latin2( ++ char *arg ++) ++{ ++ int i; ++ static unsigned int latin2_unicode_map[] = { ++ 0x00a0, 0x0104, 0x02d8, 0x0141, 0x00a4, 0x013d, 0x015a, 0x00a7, /* A0 */ ++ 0x00a8, 0x0160, 0x015e, 0x0164, 0x0179, 0x00ad, 0x017d, 0x017b, /* A8 */ ++ 0x00b0, 0x0105, 0x02db, 0x0142, 0x00b4, 0x013e, 0x015b, 0x02c7, /* B0 */ ++ 0x00b8, 0x0161, 0x015f, 0x0165, 0x017a, 0x02dd, 0x017e, 0x017c, /* B8 */ ++ 0x0154, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0139, 0x0106, 0x00c7, /* C0 */ ++ 0x010c, 0x00c9, 0x0118, 0x00cb, 0x011a, 0x00cd, 0x00ce, 0x010e, /* C8 */ ++ 0x0110, 0x0143, 0x0147, 0x00d3, 0x00d4, 0x0150, 0x00d6, 0x00d7, /* D0 */ ++ 0x0158, 0x016e, 0x00da, 0x0170, 0x00dc, 0x00dd, 0x0162, 0x00df, /* D8 */ ++ 0x0155, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x013a, 0x0107, 0x00e7, /* E0 */ ++ 0x010d, 0x00e9, 0x0119, 0x00eb, 0x011b, 0x00ed, 0x00ee, 0x010f, /* E8 */ ++ 0x0111, 0x0144, 0x0148, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x00f7, /* F0 */ ++ 0x0159, 0x016f, 0x00fa, 0x0171, 0x00fc, 0x00fd, 0x0163, 0x02d9, /* F8 */ ++ }; ++ ++ for(i=0; i<=0x7E; i++) ++ unicode_map[i] = i; ++ ++ /* 7F-9F are unused */ ++ ++ for(i=0xA0; i<=0xFF; i++) ++ unicode_map[i] = latin2_unicode_map[i-0xA0]; ++} ++ ++static void ++unicode_latin4( ++ char *arg ++) ++{ ++ int i; ++ static unsigned int latin4_unicode_map[] = { ++ 0x0080, 0x0081, 0x201a, 0x0192, -1, 0x2026, 0x2020, 0x2021, /* 80 */ ++ 0x02c6, 0x2030, -1, 0x2039, 0x0152, 0x008d, 0x008e, 0x008f, /* 88 */ ++ 0x201e, 0x201c, 0x2019, -1, 0x201d, 0x2022, 0x2013, 0x2014, /* 90 */ ++ 0x02dc, 0x2122, -1, 0x203a, 0x0153, 0x009d, 0x009e, 0x0178, /* 98 */ ++ 0x00a0, 0x0104, 0x0138, 0x0156, 0x00a4, 0x0128, 0x013b, 0x00a7, /* A0 */ ++ 0x00a8, 0x0160, 0x0112, 0x0122, 0x0166, 0x00ad, 0x017d, 0x00af, /* A8 */ ++ 0x00b0, 0x0105, 0x02db, 0x0157, 0x00b4, 0x0129, 0x013c, 0x02c7, /* B0 */ ++ 0x00b8, 0x0161, 0x0113, 0x0123, 0x0167, 0x014a, 0x017e, 0x014b, /* B8 */ ++ 0x0100, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x012e, /* C0 */ ++ 0x010c, 0x00c9, 0x0118, 0x00cb, 0x0116, 0x00cd, 0x00ce, 0x012a, /* C8 */ ++ 0x0110, 0x0145, 0x014c, 0x0136, 0x00d4, 0x00d5, 0x00d6, 0x00d7, /* D0 */ ++ 0x00d8, 0x0172, 0x00da, 0x00db, 0x00dc, 0x0168, 0x016a, 0x00df, /* D8 */ ++ 0x0101, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x012f, /* E0 */ ++ 0x010d, 0x00e9, 0x0119, 0x00eb, 0x0117, 0x00ed, 0x00ee, 0x012b, /* E8 */ ++ 0x0111, 0x0146, 0x014d, 0x0137, 0x00f4, 0x00f5, 0x00f6, 0x00f7, /* F0 */ ++ 0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x0169, 0x016b, 0x02d9, /* F8 */ ++ }; ++ ++ for(i=0; i<=0x7F; i++) ++ unicode_map[i] = i; ++ ++ for(i=0x80; i<=0xFF; i++) ++ unicode_map[i] = latin4_unicode_map[i-0x80]; ++ ++#if 0 /* for documentation purposes only */ ++ case 0x201e: return 0x90; /* these two quotes are a hack only */ ++ case 0x201c: return 0x91; /* these two quotes are a hack only */ ++ case 0x00A0: return 0xA0; /* NO-BREAK SPACE */ ++ case 0x0104: return 0xA1; /* LATIN CAPITAL LETTER A WITH OGONEK */ ++ case 0x0138: return 0xA2; /* LATIN SMALL LETTER KRA */ ++ case 0x0156: return 0xA3; /* LATIN CAPITAL LETTER R WITH CEDILLA */ ++ case 0x00A4: return 0xA4; /* CURRENCY SIGN */ ++ case 0x0128: return 0xA5; /* LATIN CAPITAL LETTER I WITH TILDE */ ++ case 0x013B: return 0xA6; /* LATIN CAPITAL LETTER L WITH CEDILLA */ ++ case 0x00A7: return 0xA7; /* SECTION SIGN */ ++ case 0x00A8: return 0xA8; /* DIAERESIS */ ++ case 0x0160: return 0xA9; /* LATIN CAPITAL LETTER S WITH CARON */ ++ case 0x0112: return 0xAA; /* LATIN CAPITAL LETTER E WITH MACRON */ ++ case 0x0122: return 0xAB; /* LATIN CAPITAL LETTER G WITH CEDILLA */ ++ case 0x0166: return 0xAC; /* LATIN CAPITAL LETTER T WITH STROKE */ ++ case 0x00AD: return 0xAD; /* SOFT HYPHEN */ ++ case 0x017D: return 0xAE; /* LATIN CAPITAL LETTER Z WITH CARON */ ++ case 0x00AF: return 0xAF; /* MACRON */ ++ case 0x00B0: return 0xB0; /* DEGREE SIGN */ ++ case 0x0105: return 0xB1; /* LATIN SMALL LETTER A WITH OGONEK */ ++ case 0x02DB: return 0xB2; /* OGONEK */ ++ case 0x0157: return 0xB3; /* LATIN SMALL LETTER R WITH CEDILLA */ ++ case 0x00B4: return 0xB4; /* ACUTE ACCENT */ ++ case 0x0129: return 0xB5; /* LATIN SMALL LETTER I WITH TILDE */ ++ case 0x013C: return 0xB6; /* LATIN SMALL LETTER L WITH CEDILLA */ ++ case 0x02C7: return 0xB7; /* CARON */ ++ case 0x00B8: return 0xB8; /* CEDILLA */ ++ case 0x0161: return 0xB9; /* LATIN SMALL LETTER S WITH CARON */ ++ case 0x0113: return 0xBA; /* LATIN SMALL LETTER E WITH MACRON */ ++ case 0x0123: return 0xBB; /* LATIN SMALL LETTER G WITH CEDILLA */ ++ case 0x0167: return 0xBC; /* LATIN SMALL LETTER T WITH STROKE */ ++ case 0x014A: return 0xBD; /* LATIN CAPITAL LETTER ENG */ ++ case 0x017E: return 0xBE; /* LATIN SMALL LETTER Z WITH CARON */ ++ case 0x014B: return 0xBF; /* LATIN SMALL LETTER ENG */ ++ case 0x0100: return 0xC0; /* LATIN CAPITAL LETTER A WITH MACRON */ ++ case 0x00C1: return 0xC1; /* LATIN CAPITAL LETTER A WITH ACUTE */ ++ case 0x00C2: return 0xC2; /* LATIN CAPITAL LETTER A WITH CIRCUMFLEX */ ++ case 0x00C3: return 0xC3; /* LATIN CAPITAL LETTER A WITH TILDE */ ++ case 0x00C4: return 0xC4; /* LATIN CAPITAL LETTER A WITH DIAERESIS */ ++ case 0x00C5: return 0xC5; /* LATIN CAPITAL LETTER A WITH RING ABOVE */ ++ case 0x00C6: return 0xC6; /* LATIN CAPITAL LIGATURE AE */ ++ case 0x012E: return 0xC7; /* LATIN CAPITAL LETTER I WITH OGONEK */ ++ case 0x010C: return 0xC8; /* LATIN CAPITAL LETTER C WITH CARON */ ++ case 0x00C9: return 0xC9; /* LATIN CAPITAL LETTER E WITH ACUTE */ ++ case 0x0118: return 0xCA; /* LATIN CAPITAL LETTER E WITH OGONEK */ ++ case 0x00CB: return 0xCB; /* LATIN CAPITAL LETTER E WITH DIAERESIS */ ++ case 0x0116: return 0xCC; /* LATIN CAPITAL LETTER E WITH DOT ABOVE */ ++ case 0x00CD: return 0xCD; /* LATIN CAPITAL LETTER I WITH ACUTE */ ++ case 0x00CE: return 0xCE; /* LATIN CAPITAL LETTER I WITH CIRCUMFLEX */ ++ case 0x012A: return 0xCF; /* LATIN CAPITAL LETTER I WITH MACRON */ ++ case 0x0110: return 0xD0; /* LATIN CAPITAL LETTER D WITH STROKE */ ++ case 0x0145: return 0xD1; /* LATIN CAPITAL LETTER N WITH CEDILLA */ ++ case 0x014C: return 0xD2; /* LATIN CAPITAL LETTER O WITH MACRON */ ++ case 0x0136: return 0xD3; /* LATIN CAPITAL LETTER K WITH CEDILLA */ ++ case 0x00D4: return 0xD4; /* LATIN CAPITAL LETTER O WITH CIRCUMFLEX */ ++ case 0x00D5: return 0xD5; /* LATIN CAPITAL LETTER O WITH TILDE */ ++ case 0x00D6: return 0xD6; /* LATIN CAPITAL LETTER O WITH DIAERESIS */ ++ case 0x00D7: return 0xD7; /* MULTIPLICATION SIGN */ ++ case 0x00D8: return 0xD8; /* LATIN CAPITAL LETTER O WITH STROKE */ ++ case 0x0172: return 0xD9; /* LATIN CAPITAL LETTER U WITH OGONEK */ ++ case 0x00DA: return 0xDA; /* LATIN CAPITAL LETTER U WITH ACUTE */ ++ case 0x00DB: return 0xDB; /* LATIN CAPITAL LETTER U WITH CIRCUMFLEX */ ++ case 0x00DC: return 0xDC; /* LATIN CAPITAL LETTER U WITH DIAERESIS */ ++ case 0x0168: return 0xDD; /* LATIN CAPITAL LETTER U WITH TILDE */ ++ case 0x016A: return 0xDE; /* LATIN CAPITAL LETTER U WITH MACRON */ ++ case 0x00DF: return 0xDF; /* LATIN SMALL LETTER SHARP S */ ++ case 0x0101: return 0xE0; /* LATIN SMALL LETTER A WITH MACRON */ ++ case 0x00E1: return 0xE1; /* LATIN SMALL LETTER A WITH ACUTE */ ++ case 0x00E2: return 0xE2; /* LATIN SMALL LETTER A WITH CIRCUMFLEX */ ++ case 0x00E3: return 0xE3; /* LATIN SMALL LETTER A WITH TILDE */ ++ case 0x00E4: return 0xE4; /* LATIN SMALL LETTER A WITH DIAERESIS */ ++ case 0x00E5: return 0xE5; /* LATIN SMALL LETTER A WITH RING ABOVE */ ++ case 0x00E6: return 0xE6; /* LATIN SMALL LIGATURE AE */ ++ case 0x012F: return 0xE7; /* LATIN SMALL LETTER I WITH OGONEK */ ++ case 0x010D: return 0xE8; /* LATIN SMALL LETTER C WITH CARON */ ++ case 0x00E9: return 0xE9; /* LATIN SMALL LETTER E WITH ACUTE */ ++ case 0x0119: return 0xEA; /* LATIN SMALL LETTER E WITH OGONEK */ ++ case 0x00EB: return 0xEB; /* LATIN SMALL LETTER E WITH DIAERESIS */ ++ case 0x0117: return 0xEC; /* LATIN SMALL LETTER E WITH DOT ABOVE */ ++ case 0x00ED: return 0xED; /* LATIN SMALL LETTER I WITH ACUTE */ ++ case 0x00EE: return 0xEE; /* LATIN SMALL LETTER I WITH CIRCUMFLEX */ ++ case 0x012B: return 0xEF; /* LATIN SMALL LETTER I WITH MACRON */ ++ case 0x0111: return 0xF0; /* LATIN SMALL LETTER D WITH STROKE */ ++ case 0x0146: return 0xF1; /* LATIN SMALL LETTER N WITH CEDILLA */ ++ case 0x014D: return 0xF2; /* LATIN SMALL LETTER O WITH MACRON */ ++ case 0x0137: return 0xF3; /* LATIN SMALL LETTER K WITH CEDILLA */ ++ case 0x00F4: return 0xF4; /* LATIN SMALL LETTER O WITH CIRCUMFLEX */ ++ case 0x00F5: return 0xF5; /* LATIN SMALL LETTER O WITH TILDE */ ++ case 0x00F6: return 0xF6; /* LATIN SMALL LETTER O WITH DIAERESIS */ ++ case 0x00F7: return 0xF7; /* DIVISION SIGN */ ++ case 0x00F8: return 0xF8; /* LATIN SMALL LETTER O WITH STROKE */ ++ case 0x0173: return 0xF9; /* LATIN SMALL LETTER U WITH OGONEK */ ++ case 0x00FA: return 0xFA; /* LATIN SMALL LETTER U WITH ACUTE */ ++ case 0x00FB: return 0xFB; /* LATIN SMALL LETTER U WITH CIRCUMFLEX */ ++ case 0x00FC: return 0xFC; /* LATIN SMALL LETTER U WITH DIAERESIS */ ++ case 0x0169: return 0xFD; /* LATIN SMALL LETTER U WITH TILDE */ ++ case 0x016B: return 0xFE; /* LATIN SMALL LETTER U WITH MACRON */ ++ case 0x02D9: return 0xFF; /* DOT ABOVE */ ++#endif ++} ++ ++static void ++unicode_latin5( ++ char *arg ++) ++{ ++ int i; ++ static unsigned int latin5_unicode_map1[] = { ++ 0x0080, 0x0081, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, /* 80 */ ++ 0x02c6, 0x2030, 0x0160, 0x2039, 0x0152, 0x008d, 0x008e, 0x008f, /* 88 */ ++ 0x0090, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, /* 90 */ ++ 0x02dc, 0x2122, 0x0161, 0x203a, 0x0153, 0x009d, 0x009e, 0x0178, /* 98 */ ++ }; ++ static unsigned int latin5_unicode_map2[] = { ++ 0x011e, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, /* D0 */ ++ 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x0130, 0x015e, 0x00df, /* D8 */ ++ 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, /* E0 direct */ ++ 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, /* E8 direct */ ++ 0x011f, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, /* F0 */ ++ 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0131, 0x015f, 0x00ff, /* F8 */ ++ }; ++ ++ for(i=0; i<=0x7F; i++) ++ unicode_map[i] = i; ++ ++ for(i=0x80; i<=0x9F; i++) ++ unicode_map[i] = latin5_unicode_map1[i-0x80]; ++ ++ for(i=0xA0; i<=0xCF; i++) ++ unicode_map[i] = i; ++ ++ for(i=0xD0; i<=0xFF; i++) ++ unicode_map[i] = latin5_unicode_map2[i-0xD0]; ++} ++ ++/* a way to select one 256-character plane from Unicode ++ * or other multi-byte encoding ++ */ ++ ++static void ++unicode_plane( ++ char *arg ++) ++{ ++ static unsigned plane; ++ int nchars; ++ int c1, c2, i; ++ ++ if(uni_lang_selected == 0) ++ return; /* don't participate in auto-guessing */ ++ ++ plane = 0; force_pid = force_eid = -1; ++ ++ c1 = sscanf(arg, "pid=%d,eid=%d%n", &force_pid, &force_eid, &nchars); ++ if(c1 == 2) { ++ arg += nchars; ++ if(*arg == ',') ++ arg++; ++ } ++ if(arg[0] == '0' && (arg[1]=='x' || arg[1]=='X') ) { ++ arg += 2; ++ c2 = sscanf(arg, "%x", &plane); ++ } else { ++ c2 = sscanf(arg, "%d", &plane); ++ } ++ ++ if( (c1!=2 && c1!=0) || (c1==0 && c2==0) ) { ++ fprintf(stderr, "**** option -l plane expects one of the following formats:\n"); ++ fprintf(stderr, " -l plane+0xNN - select hexadecimal number of plane of Unicode\n"); ++ fprintf(stderr, " -l plane+NN - select decimal number of plane of Unicode\n"); ++ fprintf(stderr, " -l plane+pid=N,eid=N - select plane 0 of specified encoding\n"); ++ fprintf(stderr, " -l plane+pid=N,eid=N,0xNN - select hex plane of TTF encoding with this PID/EID\n"); ++ fprintf(stderr, " -l plane+pid=N,eid=N,NN - select decimal plane of TTF encoding with this PID/EID\n"); ++ exit(1); ++ } ++ ++ if(c2!=0) { ++ if(strlen(arg) > sizeof(uni_suffix_buf)-2) { ++ fprintf(stderr, "**** plane number is too large\n"); ++ } ++ ++ sprintf(uni_suffix_buf, "-%s", arg); ++ uni_font_name_suffix = uni_suffix_buf; ++ } else { ++ uni_font_name_suffix = ""; ++ } ++ ++ plane <<= 8; ++ for(i=0; i<=0xFF; i++) ++ unicode_map[i] = plane | i; ++} ++ ++/* look up the 8-bit code by unicode */ ++ ++int ++unicode_rev_lookup( ++ int unival ++) ++{ ++ int res; ++ ++ if( ! IS_UNI_BUCKET(unival) ) ++ return -1; ++ ++ for (res = 0; res < enctabsz; res++) ++ if (unicode_map[res] == unival) ++ return res; ++ return -1; ++} ++ ++/* mark the buckets for quick lookup */ ++ ++static void ++unicode_prepare_buckets( ++ void ++) ++{ ++ int i; ++ ++ memset(uni_user_buckets, 0, sizeof uni_user_buckets); ++ for(i=0; i 126) { ++ sprintf(res+i, "\\x%02X", c); ++ i+=4; ++ } else { ++ res[i++] = c; ++ } ++ } ++ if(*s != 0) { ++ res[i++] = '.'; ++ res[i++] = '.'; ++ res[i++] = '.'; ++ } ++ res[i++] = 0; ++ return res; ++} ++ ++/* ++ * Scale the values according to the scale_factor ++ */ ++ ++double ++fscale( ++ double val ++) ++{ ++ return scale_factor * val; ++} ++ ++int ++iscale( ++ int val ++) ++{ ++ return (int) (val > 0 ? scale_factor * val + 0.5 ++ : scale_factor * val - 0.5); ++} ++ ++/* ++ * Try to force fixed width of characters ++ */ ++ ++static void ++alignwidths(void) ++{ ++ int i; ++ int n = 0, avg, max = 0, min = 3000, sum = 0, x; ++ ++ for (i = 0; i < numglyphs; i++) { ++ if (glyph_list[i].flags & GF_USED) { ++ x = glyph_list[i].width; ++ ++ if (x != 0) { ++ if (x < min) ++ min = x; ++ if (x > max) ++ max = x; ++ ++ sum += x; ++ n++; ++ } ++ } ++ } ++ ++ if (n == 0) ++ return; ++ ++ avg = sum / n; ++ ++ WARNING_3 fprintf(stderr, "widths: max=%d avg=%d min=%d\n", max, avg, min); ++ ++ /* if less than 5% variation from average */ ++ /* force fixed width */ ++ if (20 * (avg - min) < avg && 20 * (max - avg) < avg) { ++ for (i = 0; i < numglyphs; i++) { ++ if (glyph_list[i].flags & GF_USED) ++ glyph_list[i].width = avg; ++ } ++ fontm.is_fixed_pitch = 1; ++ } ++} ++ ++static void ++convert_glyf( ++ int glyphno ++) ++{ ++ GLYPH *g; ++ int ncurves; ++ ++ g = &glyph_list[glyphno]; ++ ++ ++ g->scaledwidth = iscale(g->width); ++ ++ g->entries = 0; ++ g->lastentry = 0; ++ g->path = 0; ++ if (g->ttf_pathlen != 0) { ++ cursw->glpath(glyphno, glyph_list); ++ g->lastentry = 0; ++ ++ if(ISDBG(BUILDG)) ++ dumppaths(g, NULL, NULL); ++ ++ assertpath(g->entries, __FILE__, __LINE__, g->name); ++ ++ fclosepaths(g); ++ assertpath(g->entries, __FILE__, __LINE__, g->name); ++ ++ /* float processing */ ++ if(smooth) { ++ ffixquadrants(g); ++ assertpath(g->entries, __FILE__, __LINE__, g->name); ++ ++ fsplitzigzags(g); ++ assertpath(g->entries, __FILE__, __LINE__, g->name); ++ ++ fforceconcise(g); ++ assertpath(g->entries, __FILE__, __LINE__, g->name); ++ ++ fstraighten(g); ++ assertpath(g->entries, __FILE__, __LINE__, g->name); ++ } ++ ++ pathtoint(g); ++ /* all processing past this point expects integer path */ ++ assertpath(g->entries, __FILE__, __LINE__, g->name); ++ ++#if 0 ++ fixcontours(g); ++ testfixcvdir(g); ++#endif ++ ++ /* int processing */ ++ if (smooth) { ++ smoothjoints(g); ++ assertpath(g->entries, __FILE__, __LINE__, g->name); ++ } ++ ++ ncurves = 0; ++ { ++ GENTRY *ge; ++ for(ge = g->entries; ge; ge = ge->next) ++ ncurves++; ++ } ++ if (ncurves > 200) { ++ WARNING_3 fprintf(stderr, ++ "** Glyph %s is too long, may display incorrectly\n", ++ g->name); ++ } ++ } else { ++ /* for buildstems */ ++ g->flags &= ~GF_FLOAT; ++ } ++} ++ ++static void ++handle_gnames(void) ++{ ++ int i, n, found, c, type; ++ ++ /* get the names from the font file */ ++ ps_fmt_3 = cursw->glnames(glyph_list); ++ ++/* These checks are not required by Xprt's PS DDX... */ ++#ifndef XP_PSTEXT ++ /* check for names with wrong characters */ ++ for (n = 0; n < numglyphs; n++) { ++ int c; ++ for (i = 0; (c = glyph_list[n].name[i]) != 0; i++) { ++ if (!(isalnum(c) || c == '.' || c == '_' || c == '-') ++ || i==0 && isdigit(c)) { /* must not start with a digit */ ++ WARNING_3 fprintf(stderr, "Glyph %d %s (%s), ", ++ n, isdigit(c) ? "name starts with a digit" : ++ "has bad characters in name", ++ nametoprint(glyph_list[n].name)); ++ glyph_list[n].name = malloc(16); ++ sprintf(glyph_list[n].name, "_b_%d", n); ++ WARNING_3 fprintf(stderr, "changing to %s\n", glyph_list[n].name); ++ break; ++ } ++ } ++ } ++ ++ if( !ps_fmt_3 ) { ++ /* check for duplicate names */ ++ for (n = 0; n < numglyphs; n++) { ++ found = 0; ++ for (i = 0; i < n && !found; i++) { ++ if (strcmp(glyph_list[i].name, glyph_list[n].name) == 0) { ++ if (( glyph_list[n].name = malloc(16) )==0) { ++ fprintf (stderr, "****malloc failed %s line %d\n", __FILE__, __LINE__); ++ exit(255); ++ } ++ sprintf(glyph_list[n].name, "_d_%d", n); ++ ++ /* if the font has no names in it (what the native parser ++ * recognises as ps_fmt_3), FreeType returns all the ++ * names as .notdef, so don't complain in this case ++ */ ++ if(strcmp(glyph_list[i].name, ".notdef")) { ++ WARNING_3 fprintf(stderr, ++ "Glyph %d has the same name as %d: (%s), changing to %s\n", ++ n, i, ++ glyph_list[i].name, ++ glyph_list[n].name); ++ } ++ found = 1; ++ } ++ } ++ } ++ ++ } ++#endif /* !XP_PSTEXT */ ++ ++ /* start the encoding stuff */ ++ for (i = 0; i < ENCTABSZ; i++) { ++ encoding[i] = -1; ++ } ++ ++ /* do the 1st round of encoding by name */ ++ if(!ps_fmt_3 && uni_lang_selected && uni_lang_selected->convbyname) { ++ for (n = 0; n < numglyphs; n++) { ++ c = uni_lang_selected->convbyname(glyph_list[n].name, ++ uni_lang_arg, UNICONV_BYNAME_BEFORE); ++ if(c>=0 && cinit[i]; i++) { ++ for (n = 0; n < ENCTABSZ; n++) ++ unicode_map[n] = -1; ++ uni_lang_selected->init[i](uni_lang_arg); ++ unicode_prepare_buckets(); ++ type = cursw->glenc(glyph_list, encoding, unicode_map); ++ if( type == 0 ) ++ /* if we have an 8-bit encoding we don't need more tries */ ++ break; ++ } ++ } else { ++ /* language is unknown, try the first table of each */ ++ for(i=0; i < sizeof uni_lang/(sizeof uni_lang[0]); i++) { ++ if(uni_lang[i].init[0] == NULL) ++ continue; ++ for (n = 0; n < ENCTABSZ; n++) ++ unicode_map[n] = -1; ++ uni_lang[i].init[0](uni_lang_arg); ++ unicode_prepare_buckets(); ++ type = cursw->glenc(glyph_list, encoding, unicode_map); ++ if( type == 0 ) ++ /* if we have an 8-bit encoding we don't need more tries */ ++ break; ++ } ++ } ++ ++ if (ps_fmt_3) { ++ /* get rid of the old names, they are all "UNKNOWN" anyawy */ ++ for (i = 0; i < numglyphs; i++) { ++ glyph_list[i].name = 0; ++ } ++ if(type == 0) { ++ /* 8-bit - give 8859/1 names to the first 256 glyphs */ ++ for (i = 0; i < 256; i++) { /* here 256, not ENCTABSZ */ ++ if (encoding[i] > 0) { ++ glyph_list[encoding[i]].name = Fmt3Encoding[i]; ++ } ++ } ++ } else if(type == 1) { ++ /* Unicode - give 8859/1 names to the first 256 glyphs of Unicode */ ++ for (n = 0; n < 256; n++) { /* here 256, not ENCTABSZ */ ++ i = unicode_rev_lookup(n); ++ if (i>=0 && encoding[i] > 0) { ++ glyph_list[encoding[i]].name = Fmt3Encoding[i]; ++ } ++ } ++ } /* for other types of encodings just give generated names */ ++ /* assign unique names to the rest of the glyphs */ ++ for (i = 0; i < numglyphs; i++) { ++ if (glyph_list[i].name == 0) { ++ if (( glyph_list[i].name = malloc(16) )==0) { ++ fprintf (stderr, "****malloc failed %s line %d\n", __FILE__, __LINE__); ++ exit(255); ++ } ++ sprintf(glyph_list[i].name, "_d_%d", i); ++ } ++ } ++ } ++ ++ /* do the 2nd round of encoding by name */ ++ if(uni_lang_selected && uni_lang_selected->convbyname) { ++ for (n = 0; n < numglyphs; n++) { ++ c = uni_lang_selected->convbyname(glyph_list[n].name, ++ uni_lang_arg, UNICONV_BYNAME_AFTER); ++ if(c>=0 && c 0) ++ glyph_list[0].name = ".notdef"; ++ if(numglyphs > 1) ++ glyph_list[1].name = ".null"; ++#endif /* !XP_PSTEXT */ ++ ++ for (i = 0; i < ENCTABSZ; i++) { ++ if ((encoding[i] != 0) && glyph_rename[i]) { ++ glyph_list[encoding[i]].name = glyph_rename[i]; ++ } ++ } ++} ++ ++static void ++usage(void) ++{ ++ ++#ifdef XP_PSTEXT ++ fputs("ft2pt1: Internal startup error\n", stderr); ++#else ++ ++#ifdef _GNU_SOURCE ++# define fplop(txt) fputs(txt, stderr); ++#else ++# define fplop(txt) ++#endif ++ ++ fputs("Use:\n", stderr); ++ fputs("ttf2pt1 [-] [-l language | -L file] []\n", stderr); ++ fputs(" or\n", stderr); ++ fputs("ttf2pt1 [-] [-l language | -L file] -\n", stderr); ++ fputs(" or\n", stderr); ++ fputs("ttf2pt1 [-] [-l language | -L file] - | t1asm > \n", stderr); ++ ++ fplop("\n"); ++ fplop("This build supports both short and long option names,\n"); ++ fplop("the long options are listed before corresponding short ones\n"); ++ ++ fplop(" --all-glyphs\n"); ++ fputs(" -a - include all glyphs, even those not in the encoding table\n", stderr); ++ fplop(" --pfb\n"); ++ fputs(" -b - produce a compressed .pfb file\n", stderr); ++ fplop(" --debug dbg_suboptions\n"); ++ fputs(" -d dbg_suboptions - debugging options, run ttf2pt1 -d? for help\n", stderr); ++ fplop(" --encode\n"); ++ fputs(" -e - produce a fully encoded .pfa file\n", stderr); ++ fplop(" --force-unicode\n"); ++ fputs(" -F - force use of Unicode encoding even if other MS encoding detected\n", stderr); ++ fplop(" --generate suboptions\n"); ++ fputs(" -G suboptions - control the file generation, run ttf2pt1 -G? for help\n", stderr); ++ fplop(" --language language\n"); ++ fputs(" -l language - convert Unicode to specified language, run ttf2pt1 -l? for list\n", stderr); ++ fplop(" --language-map file\n"); ++ fputs(" -L file - convert Unicode according to encoding description file\n", stderr); ++ fplop(" --limit =\n"); ++ fputs(" -m = - set maximal limit of given type to value, types:\n", stderr); ++ fputs(" h - maximal hint stack depth in the PostScript interpreter\n", stderr); ++ fplop(" --processing suboptions\n"); ++ fputs(" -O suboptions - control outline processing, run ttf2pt1 -O? for help\n", stderr); ++ fplop(" --parser name\n"); ++ fputs(" -p name - use specific front-end parser, run ttf2pt1 -p? for list\n", stderr); ++ fplop(" --uid id\n"); ++ fputs(" -u id - use this UniqueID, -u A means autogeneration\n", stderr); ++ fplop(" --vertical-autoscale size\n"); ++ fputs(" -v size - scale the font to make uppercase letters >size/1000 high\n", stderr); ++ fplop(" --version\n"); ++ fputs(" -V - print ttf2pt1 version number\n", stderr); ++ fplop(" --warning number\n"); ++ fputs(" -W number - set the level of permitted warnings (0 - disable)\n", stderr); ++ fputs("Obsolete options (will be removed in future releases):\n", stderr); ++ fplop(" --afm\n"); ++ fputs(" -A - write the .afm file to STDOUT instead of the font, now -GA\n", stderr); ++ fputs(" -f - don't try to guess the value of the ForceBold hint, now -Ob\n", stderr); ++ fputs(" -h - disable autogeneration of hints, now -Oh\n", stderr); ++ fputs(" -H - disable hint substitution, now -Ou\n", stderr); ++ fputs(" -o - disable outline optimization, now -Oo\n", stderr); ++ fputs(" -s - disable outline smoothing, now -Os\n", stderr); ++ fputs(" -t - disable auto-scaling to 1000x1000 standard matrix, now -Ot\n", stderr); ++ fputs(" -w - correct the glyph widths (use only for buggy fonts), now -OW\n", stderr); ++ fputs("With no , write to with suffix replaced.\n", stderr); ++ fputs("The last '-' means 'use STDOUT'.\n", stderr); ++ ++#undef fplop ++ ++#endif /* XP_PSTEXT */ ++} ++ ++static void ++printversion(void) ++{ ++ fprintf(stderr, "ttf2pt1 %s\n", TTF2PT1_VERSION); ++} ++ ++/* initialize a table of suboptions */ ++static void ++init_subo_tbl( ++ struct subo_case *tbl ++) ++{ ++ int i; ++ ++ for(i=0; tbl[i].disbl != 0; i++) { ++ tbl[i].disbl = tolower(tbl[i].disbl); ++ tbl[i].enbl = toupper(tbl[i].disbl); ++ *(tbl[i].valp) = tbl[i].dflt; ++ } ++} ++ ++/* print the default value of the suboptions */ ++static void ++print_subo_dflt( ++ FILE *f, ++ struct subo_case *tbl ++) ++{ ++ int i; ++ ++ for(i=0; tbl[i].disbl != 0; i++) { ++ if(tbl[i].dflt) ++ putc(tbl[i].enbl, f); ++ else ++ putc(tbl[i].disbl, f); ++ } ++} ++ ++/* print the usage message for the suboptions */ ++static void ++print_subo_usage( ++ FILE *f, ++ struct subo_case *tbl ++) ++{ ++#ifdef XP_PSTEXT ++ fputs("ft2pt1: Internal startup error\n", stderr); ++#else ++ int i; ++ ++ fprintf(f,"The lowercase suboptions disable features, corresponding\n"); ++ fprintf(f,"uppercase suboptions enable them. The supported suboptions,\n"); ++ fprintf(f,"their default states and the features they control are:\n"); ++ for(i=0; tbl[i].disbl != 0; i++) { ++ fprintf(f," %c/%c - [%s] %s\n", tbl[i].disbl, tbl[i].enbl, ++ tbl[i].dflt ? "enabled" : "disabled", tbl[i].descr); ++ } ++#endif /* XP_PSTEXT */ ++} ++ ++/* find and set the entry according to suboption, ++ * return the found entry (or if not found return NULL) ++ */ ++struct subo_case * ++set_subo( ++ struct subo_case *tbl, ++ int subopt ++) ++{ ++ int i; ++ ++ for(i=0; tbl[i].disbl != 0; i++) { ++ if(subopt == tbl[i].disbl) { ++ *(tbl[i].valp) = 0; ++ return &tbl[i]; ++ } else if(subopt == tbl[i].enbl) { ++ *(tbl[i].valp) = 1; ++ return &tbl[i]; ++ } ++ } ++ return NULL; ++} ++ ++ ++#ifdef XP_PSTEXT ++FT_Face xp_pstext_ft_face = NULL; /* used by ft.c */ ++FontPtr xp_xtf = NULL; ++const char *xp_psfontname = NULL; ++unsigned long xp_font_block_offset = 0UL; ++ ++int ++ft2pt1_main( ++ int argc, ++ char **argv, ++ FTFontPtr tf, ++ const char *download_psfontname, ++ unsigned long download_font_block_offset ++) ++#else ++int ++main( ++ int argc, ++ char **argv ++) ++#endif /* XP_PSTEXT */ ++{ ++ long i, j; ++ time_t now; ++ char filename[4096]; ++ int c,nchars,nmetrics; ++ int ws; ++ int forcebold= -1; /* -1 means "don't know" */ ++ char *lang; ++ int oc; ++ int subid; ++ char *cmdline; ++#ifdef _GNU_SOURCE ++# define ttf2pt1_getopt(a, b, c, d, e) getopt_long(a, b, c, d, e) ++ static struct option longopts[] = { ++ { "afm", 0, NULL, 'A' }, ++ { "all-glyphs", 0, NULL, 'a' }, ++ { "pfb", 0, NULL, 'b' }, ++ { "debug", 1, NULL, 'd' }, ++ { "encode", 0, NULL, 'e' }, ++ { "force-unicode", 0, NULL, 'F' }, ++ { "generate", 1, NULL, 'G' }, ++ { "language", 1, NULL, 'l' }, ++ { "language-map", 1, NULL, 'L' }, ++ { "limit", 1, NULL, 'm' }, ++ { "processing", 1, NULL, 'O' }, ++ { "parser", 1, NULL, 'p' }, ++ { "uid", 1, NULL, 'u' }, ++ { "vertical-autoscale", 1, NULL, 'v' }, ++ { "version", 0, NULL, 'V' }, ++ { "warning", 1, NULL, 'W' }, ++ { NULL, 0, NULL, 0 } ++ }; ++#else ++# define ttf2pt1_getopt(a, b, c, d, e) getopt(a, b, c) ++#endif ++ /* table of Outline Processing (may think also as Optimization) options */ ++ static struct subo_case opotbl[] = { ++ { 'b', 0/*auto-set*/, &trybold, 1, "guessing of the ForceBold hint" }, ++ { 'h', 0/*auto-set*/, &hints, 1, "autogeneration of hints" }, ++ { 'u', 0/*auto-set*/, &subhints, 1, "hint substitution technique" }, ++ { 'o', 0/*auto-set*/, &optimize, 1, "space optimization of font files" }, ++ { 's', 0/*auto-set*/, &smooth, 1, "smoothing and repair of outlines" }, ++ { 't', 0/*auto-set*/, &transform, 1, "auto-scaling to the standard matrix 1000x1000" }, ++ { 'w', 0/*auto-set*/, &correctwidth, 0, "correct the glyph widths (use only for buggy fonts)" }, ++ { 'v', 0/*auto-set*/, &vectorize, 0, "vectorize (trace) the bitmaps" }, ++#ifdef USE_AUTOTRACE ++ { 'z', 0/*auto-set*/, &use_autotrace, 0, "use the autotrace library on bitmaps (works badly)" }, ++#endif /*USE_AUTOTRACE*/ ++ { 0, 0, 0, 0, 0} /* terminator */ ++ }; ++ /* table of the File Generation options */ ++ static struct subo_case fgotbl[] = { ++ { 'f', 0/*auto-set*/, &gen_pfa, 1, "generate the font file (.t1a, .pfa or .pfb)" }, ++ { 'a', 0/*auto-set*/, &gen_afm, 1, "generate the Adobe metrics file (.afm)" }, ++ { 'e', 0/*auto-set*/, &gen_dvienc, 0, "generate the dvips encoding file (.enc)" }, ++ { 0, 0, 0, 0, 0} /* terminator */ ++ }; ++ int *genlast = NULL; ++ ++#ifdef XP_PSTEXT ++ xp_pstext_ft_face = tf->instance->face->face; ++ xp_xtf = tf; ++ xp_psfontname = download_psfontname; ++ xp_font_block_offset = download_font_block_offset; ++#endif /* XP_PSTEXT */ ++ ++ init_subo_tbl(opotbl); /* initialize sub-options of -O */ ++ init_subo_tbl(fgotbl); /* initialize sub-options of -G */ ++ ++ /* save the command line for the record ++ * (we don't bother about escaping the shell special characters) ++ */ ++ ++ j = 0; ++ for(i=1; ivalp) ) ++ genlast = s->valp; ++ } ++ break; ++ } ++ case 'h': ++ fputs("Warning: option -h is obsolete, use -Oh instead\n", stderr); ++ hints = 0; ++ break; ++ case 'H': ++ fputs("Warning: meaning of option -H has been changed to its opposite\n", stderr); ++ fputs("Warning: option -H is obsolete, use -Ou instead\n", stderr); ++ subhints = 0; ++ break; ++ case 'f': ++ fputs("Warning: option -f is obsolete, use -Ob instead\n", stderr); ++ trybold = 0; ++ break; ++ case 'w': ++ fputs("Warning: option -w is obsolete, use -OW instead\n", stderr); ++ correctwidth = 1; ++ break; ++ case 'u': ++ if(wantuid) { ++ fprintf(stderr, "**** UniqueID may be specified only once ****\n"); ++ exit(1); ++ } ++ wantuid = 1; ++ if(optarg[0]=='A' && optarg[1]==0) ++ strUID=0; /* will be generated automatically */ ++ else { ++ strUID=optarg; ++ for(i=0; optarg[i]!=0; i++) ++ if( !isdigit(optarg[i]) ) { ++ fprintf(stderr, "**** UniqueID must be numeric or A for automatic ****\n"); ++ exit(1); ++ } ++ } ++ break; ++ case 'v': ++ correctvsize = atoi(optarg); ++ if(correctvsize <= 0 && correctvsize > 1000) { ++ fprintf(stderr, "**** wrong vsize '%d', ignored ****\n", correctvsize); ++ correctvsize=0; ++ } ++ break; ++ case 'p': ++ if(cursw!=0) { ++ fprintf(stderr, "**** only one front-end parser be used ****\n"); ++ exit(1); ++ } ++ ++ { /* separate parser from parser-specific argument */ ++ char *p = strchr(optarg, LANG_ARG_SEP); ++ if(p != 0) { ++ *p = 0; ++ front_arg = p+1; ++ } else ++ front_arg = ""; ++ } ++ for(i=0; frontswtab[i] != NULL; i++) ++ if( !strcmp(frontswtab[i]->name, optarg) ) { ++ cursw = frontswtab[i]; ++ break; ++ } ++ ++ if(cursw==0) { ++ if (strcmp(optarg, "?")) ++ fprintf(stderr, "**** unknown front-end parser '%s' ****\n", optarg); ++ fputs("the following front-ends are supported now:\n", stderr); ++ for(i=0; frontswtab[i] != NULL; i++) { ++ fprintf(stderr," %s (%s)\n file suffixes: ", ++ frontswtab[i]->name, ++ frontswtab[i]->descr ? frontswtab[i]->descr : "no description" ++ ); ++ for(j=0; jsuffix[j]) ++ fprintf(stderr, "%s ", frontswtab[i]->suffix[j]); ++ fprintf(stderr, "\n"); ++ } ++ exit(1); ++ } ++ break; ++ case 'l': ++ if(uni_lang_selected!=0) { ++ fprintf(stderr, "**** only one language option may be used ****\n"); ++ exit(1); ++ } ++ ++ { /* separate language from language-specific argument */ ++ char *p = strchr(optarg, LANG_ARG_SEP); ++ if(p != 0) { ++ *p = 0; ++ uni_lang_arg = p+1; ++ } else ++ uni_lang_arg = ""; ++ } ++ for(i=0; i < sizeof uni_lang/(sizeof uni_lang[0]); i++) ++ if( !strcmp(uni_lang[i].name, optarg) ) { ++ uni_lang_selected = &uni_lang[i]; ++ uni_sample = uni_lang[i].sample_upper; ++ break; ++ } ++ ++ if(uni_lang_selected==0) { ++ if (strcmp(optarg, "?")) ++ fprintf(stderr, "**** unknown language '%s' ****\n", optarg); ++ fputs(" the following languages are supported now:\n", stderr); ++ for(i=0; i < sizeof uni_lang/(sizeof uni_lang[0]); i++) ++ fprintf(stderr," %s (%s)\n", ++ uni_lang[i].name, ++ uni_lang[i].descr ? uni_lang[i].descr : "no description" ++ ); ++ exit(1); ++ } ++ break; ++ case 'L': ++ if(uni_lang_selected!=0) { ++ fprintf(stderr, "**** only one language option may be used ****\n"); ++ exit(1); ++ } ++ uni_lang_selected = &uni_lang_user; ++ uni_lang_arg = optarg; ++ break; ++ case 'V': ++ printversion(); ++ exit(0); ++ break; ++ default: ++ usage(); ++ exit(1); ++ break; ++ } ++ } ++ argc-=optind-1; /* the rest of code counts from argv[0] */ ++ argv+=optind-1; ++ ++ if (absolute && encode) { ++ fprintf(stderr, "**** options -a and -e are incompatible ****\n"); ++ exit(1); ++ } ++ if ((argc != 2) && (argc != 3)) { ++ usage(); ++ exit(1); ++ } ++ ++ /* try to guess the language by the locale used */ ++ if(uni_lang_selected==0 && (lang=getenv("LANG"))!=0 ) { ++ for(i=0; i < sizeof uni_lang/sizeof(struct uni_language); i++) { ++ if( !strncmp(uni_lang[i].name, lang, strlen(uni_lang[i].name)) ) { ++ uni_lang_selected = &uni_lang[i]; ++ goto got_a_language; ++ } ++ } ++ /* no full name ? try aliases */ ++ for(i=0; i < sizeof uni_lang/sizeof(struct uni_language); i++) { ++ for(c=0; csuffix[j] ++ && !strcmp(p, frontswtab[i]->suffix[j]) ) { ++ cursw = frontswtab[i]; ++ WARNING_1 fprintf(stderr, "Auto-detected front-end parser '%s'\n", ++ cursw->name); ++ WARNING_1 fprintf(stderr, " (use ttf2pt1 -p? to get the full list of available front-ends)\n"); ++ break; ++ } ++ } ++ free(s); ++ } ++ ++ if(cursw==0) { ++ cursw = frontswtab[0]; ++ WARNING_1 fprintf(stderr, "Can't detect front-end parser, using '%s' by default\n", ++ cursw->name); ++ WARNING_1 fprintf(stderr, " (use ttf2pt1 -p? to get the full list of available front-ends)\n"); ++ } ++ } ++ ++ /* open the input file */ ++ cursw->open(argv[1], front_arg); ++ ++ /* Get base name of output file (if not specified) ++ * by removing (known) suffixes ++ */ ++ if (argc == 2) { ++ char *p; ++ argv[2] = strdup (argv[1]); ++ p = strrchr(argv[2], '.'); ++ if (p != NULL) ++ for (j = 0; (j < MAXSUFFIX) && (cursw->suffix[j]); j++) ++ if (!strcmp(p+1, cursw->suffix[j])) { ++ *p = '\0'; ++ break; ++ } ++ } ++ ++ if ((null_file = fopen(BITBUCKET, "w")) == NULL) { ++ fprintf(stderr, "**** Cannot open %s ****\n", ++ BITBUCKET); ++ exit(1); ++ } ++ ++ if (argv[2][0] == '-' && argv[2][1] == 0) { ++#ifdef WINDOWS ++ if(encode) { ++ fprintf(stderr, "**** can't write encoded file to stdout ***\n"); ++ exit(1); ++ } ++#endif /* WINDOWS */ ++ pfa_file = afm_file = dvienc_file = null_file; ++ ++ if(wantafm || genlast == &gen_afm) { /* print .afm instead of .pfa */ ++ afm_file=stdout; ++ } else if(genlast == &gen_dvienc) { /* print .enc instead of .pfa */ ++ dvienc_file=stdout; ++ } else { ++ pfa_file=stdout; ++ } ++ } else { ++#ifndef WINDOWS ++ snprintf(filename, sizeof filename, "%s.%s", argv[2], encode ? (pfbflag ? "pfb" : "pfa") : "t1a" ); ++#else /* WINDOWS */ ++ snprintf(filename, sizeof filename, "%s.t1a", argv[2]); ++#endif /* WINDOWS */ ++ if(gen_pfa) { ++ if ((pfa_file = fopen(filename, "w+b")) == NULL) { ++ fprintf(stderr, "**** Cannot create %s ****\n", filename); ++ exit(1); ++ } else { ++ WARNING_2 fprintf(stderr, "Creating file %s\n", filename); ++ } ++ } else ++ pfa_file = null_file; ++ ++ if(gen_afm) { ++ snprintf(filename, sizeof filename, "%s.afm", argv[2]) ; ++ if ((afm_file = fopen(filename, "w+")) == NULL) { ++ fprintf(stderr, "**** Cannot create %s ****\n", filename); ++ exit(1); ++ } ++ } else ++ afm_file = null_file; ++ ++ if(gen_dvienc) { ++ snprintf(filename, sizeof filename, "%s.enc", argv[2]) ; ++ if ((dvienc_file = fopen(filename, "w+")) == NULL) { ++ fprintf(stderr, "**** Cannot create %s ****\n", filename); ++ exit(1); ++ } ++ } else ++ dvienc_file = null_file; ++ } ++ ++ /* ++ * Now check whether we want a fully encoded .pfa file ++ */ ++#ifndef WINDOWS ++ if (encode && pfa_file != null_file) { ++ int p[2]; ++ extern FILE *ifp, *ofp; /* from t1asm.c */ ++ ++ ifp=stdin; ++ ofp=stdout; ++ ++ if (pipe(p) < 0) { ++ perror("**** Cannot create pipe ****\n"); ++ exit(1); ++ } ++ ofp = pfa_file; ++ ifp = fdopen(p[0], "r"); ++ if (ifp == NULL) { ++ perror("**** Cannot use pipe for reading ****\n"); ++ exit(1); ++ } ++ pfa_file = fdopen(p[1], "w"); ++ if (pfa_file == NULL) { ++ perror("**** Cannot use pipe for writing ****\n"); ++ exit(1); ++ } ++ switch (fork()) { ++ case -1: ++ perror("**** Cannot fork the assembler process ****\n"); ++ exit(1); ++ case 0: /* child */ ++ fclose(pfa_file); ++ exit(runt1asm(pfbflag)); ++ default: /* parent */ ++ fclose(ifp); fclose(ofp); ++ } ++ } ++#endif /* WINDOWS */ ++ ++ numglyphs = cursw->nglyphs(); ++ ++ WARNING_3 fprintf(stderr, "numglyphs = %d\n", numglyphs); ++ ++ glyph_list = (GLYPH *) calloc(numglyphs, sizeof(GLYPH)); ++ ++ /* initialize non-0 fields */ ++ for (i = 0; i < numglyphs; i++) { ++ GLYPH *g; ++ ++ g = &glyph_list[i]; ++ g->char_no = -1; ++ g->orig_code = -1; ++ g->name = "UNKNOWN"; ++ g->flags = GF_FLOAT; /* we start with float representation */ ++ } ++ ++ handle_gnames(); ++ ++ cursw->glmetrics(glyph_list); ++ cursw->fnmetrics(&fontm); ++ ++ original_scale_factor = 1000.0 / (double) fontm.units_per_em; ++ ++ if(transform == 0) ++ scale_factor = 1.0; /* don't transform */ ++ else ++ scale_factor = original_scale_factor; ++ ++ if(correctvsize && uni_sample!=0) { /* only for known languages */ ++ /* try to adjust the scale factor to make a typical ++ * uppercase character of hight at least (correctvsize), this ++ * may improve the appearance of the font but also ++ * make it weird, use with caution ++ */ ++ int ysz; ++ ++ ysz = iscale(glyph_list[encoding[uni_sample]].yMax); ++ if( yszmapping, i); ++ ++ if( ftindex < numglyphs ) { ++ glyph_list[ftindex].flags |= GF_USED; ++ } ++ } ++ ++ /* also always include .notdef */ ++ { ++ int notdef_found = FALSE; ++ ++ for (i = 0; i < numglyphs; i++) { ++ if(!strcmp(glyph_list[i].name, ".notdef")) { ++ glyph_list[i].flags |= GF_USED; ++ notdef_found = TRUE; ++ break; ++ } ++ } ++ ++ if( !notdef_found ) ++ { ++ /* No ".notdef" found ? ++ * Then copy outlines of char 0 to the first "free" slot and make ++ * it our ".notdef" char. ++ */ ++ for (i = 0; i < numglyphs; i++) { ++ if((glyph_list[i].flags & GF_USED) == 0) { ++ glyph_list[i] = glyph_list[0]; ++ glyph_list[i].flags |= GF_USED; ++ glyph_list[i].name = ".notdef"; ++ notdef_found = TRUE; ++ break; ++ } ++ } ++ } ++ ++ if( !notdef_found ) ++ { ++ /* This shoudl never happen... */ ++ fprintf(stderr, "ft2pt1: '.notdef' missing in generated font.\n"); ++ } ++ } ++#else ++ if(allglyphs) { ++ for (i = 0; i < numglyphs; i++) { ++ glyph_list[i].flags |= GF_USED; ++ } ++ } else { ++ for (i = 0; i < ENCTABSZ; i++) { ++ glyph_list[encoding[i]].flags |= GF_USED; ++ } ++ ++ /* also always include .notdef */ ++ for (i = 0; i < numglyphs; i++) ++ if(!strcmp(glyph_list[i].name, ".notdef")) { ++ glyph_list[i].flags |= GF_USED; ++ break; ++ } ++ } ++#endif /* XP_ONLY_BLOCKS */ ++ ++ for (i = 0; i < numglyphs; i++) { ++ if (glyph_list[i].flags & GF_USED) { ++ DBG_TO_GLYPH(&glyph_list[i]); ++ convert_glyf(i); ++ DBG_FROM_GLYPH(&glyph_list[i]); ++ } ++ } ++ ++ italic_angle = fontm.italic_angle; ++ ++ if (italic_angle > 45.0 || italic_angle < -45.0) ++ italic_angle = 0.0; /* consider buggy */ ++ ++ if (hints) { ++ findblues(); ++ for (i = 0; i < numglyphs; i++) { ++ if (glyph_list[i].flags & GF_USED) { ++ DBG_TO_GLYPH(&glyph_list[i]); ++ buildstems(&glyph_list[i]); ++ assertpath(glyph_list[i].entries, __FILE__, __LINE__, glyph_list[i].name); ++ DBG_FROM_GLYPH(&glyph_list[i]); ++ } ++ } ++ stemstatistics(); ++ } else { ++ for(i=0; i<4; i++) ++ bbox[i] = iscale(fontm.bbox[i]); ++ } ++ /* don't touch the width of fixed width fonts */ ++ if( fontm.is_fixed_pitch ) ++ correctwidth=0; ++ docorrectwidth(); /* checks correctwidth inside */ ++ if (reverse) ++ for (i = 0; i < numglyphs; i++) { ++ if (glyph_list[i].flags & GF_USED) { ++ DBG_TO_GLYPH(&glyph_list[i]); ++ reversepaths(&glyph_list[i]); ++ assertpath(glyph_list[i].entries, __FILE__, __LINE__, glyph_list[i].name); ++ DBG_FROM_GLYPH(&glyph_list[i]); ++ } ++ } ++ ++ ++#if 0 ++ /* ++ ** It seems to bring troubles. The problem is that some ++ ** styles of the font may be recognized as fixed-width ++ ** while other styles of the same font as proportional. ++ ** So it's better to be commented out yet. ++ */ ++ if (tryfixed) ++ alignwidths(); ++#endif ++ ++ if(trybold) { ++ forcebold = fontm.force_bold; ++ } ++ ++#ifdef XP_PSTEXT ++ fprintf(pfa_file, "%%!PS-AdobeFont-1.0: %s\n", fontm.name_ps); ++#else ++ fprintf(pfa_file, "%%!PS-AdobeFont-1.0: %s %s\n", fontm.name_ps, fontm.name_copyright); ++ time(&now); ++ fprintf(pfa_file, "%%%%CreationDate: %s", ctime(&now)); ++ fprintf(pfa_file, "%% Converted by ttf2pt1 %s/%s\n", TTF2PT1_VERSION, cursw->name); ++ fprintf(pfa_file, "%% Args: %s\n", cmdline); ++ fprintf(pfa_file, "%%%%EndComments\n"); ++#endif /* XP_PSTEXT */ ++ fprintf(pfa_file, "12 dict begin\n/FontInfo 9 dict dup begin\n"); ++ ++ WARNING_3 fprintf(stderr, "FontName %s%s\n", fontm.name_ps, uni_font_name_suffix); ++ ++ ++ fprintf(pfa_file, " /version (%s) readonly def\n", fontm.name_version); ++ ++ fprintf(pfa_file, " /Notice (%s) readonly def\n", fontm.name_copyright); ++ ++ fprintf(pfa_file, " /FullName (%s) readonly def\n", fontm.name_full); ++ fprintf(pfa_file, " /FamilyName (%s) readonly def\n", fontm.name_family); ++ ++ if(wantuid) { ++ if(strUID) ++ fprintf(pfa_file, " /UniqueID %s def\n", strUID); ++ else { ++ numUID=0; ++ for(i=0; fontm.name_full[i]!=0; i++) { ++ numUID *= 37; /* magic number, good for hash */ ++ numUID += fontm.name_full[i]-' '; ++ /* if the name is long the first chars ++ * may be lost forever, so re-insert ++ * them thus making kind of CRC ++ */ ++ numUID += (numUID>>24) & 0xFF; ++ } ++ /* the range for private UIDs is 4 000 000 - 4 999 999 */ ++ fprintf(pfa_file, " /UniqueID %lu def\n", numUID%1000000+4000000); ++ } ++ } ++ ++ fprintf(pfa_file, " /Weight (%s) readonly def\n", fontm.name_style); ++ ++ fprintf(pfa_file, " /ItalicAngle %f def\n", italic_angle); ++ fprintf(pfa_file, " /isFixedPitch %s def\n", ++ fontm.is_fixed_pitch ? "true" : "false"); ++ ++ /* we don't print out the unused glyphs */ ++ nchars = 0; ++ for (i = 0; i < numglyphs; i++) { ++ if (glyph_list[i].flags & GF_USED) { ++ nchars++; ++ } ++ } ++ ++ fprintf(afm_file, "StartFontMetrics 4.1\n"); ++ fprintf(afm_file, "FontName %s%s\n", fontm.name_ps, uni_font_name_suffix); ++ fprintf(afm_file, "FullName %s\n", fontm.name_full); ++ fprintf(afm_file, "Notice %s\n", fontm.name_copyright); ++ fprintf(afm_file, "EncodingScheme FontSpecific\n"); ++ fprintf(afm_file, "FamilyName %s\n", fontm.name_family); ++ fprintf(afm_file, "Weight %s\n", fontm.name_style); ++ fprintf(afm_file, "Version %s\n", fontm.name_version); ++ fprintf(afm_file, "Characters %d\n", nchars); ++ fprintf(afm_file, "ItalicAngle %.1f\n", italic_angle); ++ ++ fprintf(afm_file, "Ascender %d\n", iscale(fontm.ascender)); ++ fprintf(afm_file, "Descender %d\n", iscale(fontm.descender)); ++ ++ fprintf(pfa_file, " /UnderlinePosition %d def\n", ++ iscale(fontm.underline_position)); ++ ++ fprintf(pfa_file, " /UnderlineThickness %hd def\n", ++ iscale(fontm.underline_thickness)); ++ ++ fprintf(pfa_file, "end readonly def\n"); ++ ++ fprintf(afm_file, "UnderlineThickness %d\n", ++ iscale(fontm.underline_thickness)); ++ ++ fprintf(afm_file, "UnderlinePosition %d\n", ++ iscale(fontm.underline_position)); ++ ++ fprintf(afm_file, "IsFixedPitch %s\n", ++ fontm.is_fixed_pitch ? "true" : "false"); ++ fprintf(afm_file, "FontBBox %d %d %d %d\n", ++ bbox[0], bbox[1], bbox[2], bbox[3]); ++ ++ fprintf(pfa_file, "/FontName /%s%s def\n", fontm.name_ps, uni_font_name_suffix); ++ fprintf(pfa_file, "/PaintType 0 def\n/StrokeWidth 0 def\n"); ++ /* I'm not sure if these are fixed */ ++ fprintf(pfa_file, "/FontType 1 def\n"); ++ ++ if (transform) { ++ fprintf(pfa_file, "/FontMatrix [0.001 0 0 0.001 0 0] def\n"); ++ } else { ++ fprintf(pfa_file, "/FontMatrix [%9.7f 0 0 %9.7f 0 0] def\n", ++ original_scale_factor / 1000.0, original_scale_factor / 1000.0); ++ } ++ ++ fprintf(pfa_file, "/FontBBox {%d %d %d %d} readonly def\n", ++ bbox[0], bbox[1], bbox[2], bbox[3]); ++ ++ fprintf(pfa_file, "/Encoding 256 array\n"); ++ /* determine number of elements for metrics table */ ++ nmetrics = 256; ++ for (i = 0; i < numglyphs; i++) { ++ if( glyph_list[i].flags & GF_USED ++ && glyph_list[i].char_no == -1 ) { ++ nmetrics++; ++ } ++ } ++ fprintf(afm_file, "StartCharMetrics %d\n", nmetrics); ++ ++ fprintf(dvienc_file, "/%s%sEncoding [\n", ++ fontm.name_ps, uni_font_name_suffix); ++ ++#ifdef XP_PSTEXT ++ { ++ int linewidth = 0; ++ for (i = 0; i < 256; i++) { /* here 256, not ENCTABSZ */ ++ linewidth += strlen(glyph_list[encoding[i]].name) + 14 + 8; ++ fprintf(pfa_file, "dup %d /%s put%s", ++ i, ++ glyph_list[encoding[i]].name, ++ (linewidth > 70 || i == 255)?(linewidth = 0, "\n"):("\t")); ++ if( glyph_list[encoding[i]].flags & GF_USED ) { ++ print_glyph_metrics(i, encoding[i]); ++ } ++ if (encoding[i]) ++ fprintf (dvienc_file, "/index0x%04X\n", encoding[i]); ++ else ++ fprintf (dvienc_file, "/.notdef\n"); ++ } ++ } ++#else ++ for (i = 0; i < 256; i++) { /* here 256, not ENCTABSZ */ ++ fprintf(pfa_file, ++ "dup %d /%s put\n", i, glyph_list[encoding[i]].name); ++ if( glyph_list[encoding[i]].flags & GF_USED ) { ++ print_glyph_metrics(i, encoding[i]); ++ } ++ if (encoding[i]) ++ fprintf (dvienc_file, "/index0x%04X\n", encoding[i]); ++ else ++ fprintf (dvienc_file, "/.notdef\n"); ++ } ++#endif /* XP_PSTEXT */ ++ /* print the metrics for glyphs not in encoding table */ ++ for(i=0; ikerning(glyph_list); ++ print_kerning(afm_file); ++ } ++ ++ fprintf(afm_file, "EndFontMetrics\n"); ++ if(afm_file != null_file) ++ fclose(afm_file); ++ ++ fprintf(dvienc_file, "] def\n"); ++ if(dvienc_file != null_file) ++ fclose(dvienc_file); ++ ++ WARNING_1 fprintf(stderr, "Finished - font files created\n"); ++ ++ cursw->close(); ++ ++#ifndef WINDOWS ++ while (wait(&ws) > 0) { ++ } ++#else ++ if (encode && pfa_file != null_file) { ++ extern FILE *ifp, *ofp; /* from t1asm.c */ ++ ++ snprintf(filename, sizeof filename, "%s.%s", argv[2], pfbflag ? "pfb" : "pfa" ); ++ ++ if ((ofp = fopen(filename, "w+b")) == NULL) { ++ fprintf(stderr, "**** Cannot create %s ****\n", filename); ++ exit(1); ++ } else { ++ WARNING_2 fprintf(stderr, "Creating file %s\n", filename); ++ } ++ ++ snprintf(filename, sizeof filename, "%s.t1a", argv[2]); ++ ++ if ((ifp = fopen(filename, "rb")) == NULL) { ++ fprintf(stderr, "**** Cannot read %s ****\n", filename); ++ exit(1); ++ } else { ++ WARNING_2 fprintf(stderr, "Converting file %s\n", filename); ++ } ++ ++ runt1asm(pfbflag); ++ ++ WARNING_2 fprintf(stderr, "Removing file %s\n", filename); ++ if(unlink(filename) < 0) ++ WARNING_1 fprintf(stderr, "Unable to remove file %s\n", filename); ++ } ++#endif /* WINDOWS */ ++ ++ fclose(null_file); ++ return 0; ++} +diff -ruN xserver-old/hw/xprint/extras/ttf2pt1/ttf2pt1_convert.1 xserver/hw/xprint/extras/ttf2pt1/ttf2pt1_convert.1 +--- xserver-old/hw/xprint/extras/ttf2pt1/ttf2pt1_convert.1 1970-01-01 10:00:00.000000000 +1000 ++++ xserver/hw/xprint/extras/ttf2pt1/ttf2pt1_convert.1 2006-06-27 13:10:26.000000000 +1000 +@@ -0,0 +1,512 @@ ++.rn '' }` ++''' $RCSfile$$Revision$$Date$ ++''' ++''' $Log$ ++''' Revision 1.1.4.1 2004/04/21 10:03:13 gisburn ++''' Fix for http://pdx.freedesktop.org/cgi-bin/bugzilla/show_bug.cgi?id=530 - Land XPRINT branch on XORG-CURRENT ++''' ++''' Revision 1.1 2003/06/04 00:33:54 roland ++''' Fix for http://xprint.mozdev.org/bugs/show_bug.cgi?id=3846 - RFE: Upload Freetype --> PS Type1 font converter "ttf2pt1" ... ++''' ++''' ++.de Sh ++.br ++.if t .Sp ++.ne 5 ++.PP ++\fB\\$1\fR ++.PP ++.. ++.de Sp ++.if t .sp .5v ++.if n .sp ++.. ++.de Ip ++.br ++.ie \\n(.$>=3 .ne \\$3 ++.el .ne 3 ++.IP "\\$1" \\$2 ++.. ++.de Vb ++.ft CW ++.nf ++.ne \\$1 ++.. ++.de Ve ++.ft R ++ ++.fi ++.. ++''' ++''' ++''' Set up \*(-- to give an unbreakable dash; ++''' string Tr holds user defined translation string. ++''' Bell System Logo is used as a dummy character. ++''' ++.tr \(*W-|\(bv\*(Tr ++.ie n \{\ ++.ds -- \(*W- ++.ds PI pi ++.if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch ++.if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch ++.ds L" "" ++.ds R" "" ++''' \*(M", \*(S", \*(N" and \*(T" are the equivalent of ++''' \*(L" and \*(R", except that they are used on ".xx" lines, ++''' such as .IP and .SH, which do another additional levels of ++''' double-quote interpretation ++.ds M" """ ++.ds S" """ ++.ds N" """"" ++.ds T" """"" ++.ds L' ' ++.ds R' ' ++.ds M' ' ++.ds S' ' ++.ds N' ' ++.ds T' ' ++'br\} ++.el\{\ ++.ds -- \(em\| ++.tr \*(Tr ++.ds L" `` ++.ds R" '' ++.ds M" `` ++.ds S" '' ++.ds N" `` ++.ds T" '' ++.ds L' ` ++.ds R' ' ++.ds M' ` ++.ds S' ' ++.ds N' ` ++.ds T' ' ++.ds PI \(*p ++'br\} ++.\" If the F register is turned on, we'll generate ++.\" index entries out stderr for the following things: ++.\" TH Title ++.\" SH Header ++.\" Sh Subsection ++.\" Ip Item ++.\" X<> Xref (embedded ++.\" Of course, you have to process the output yourself ++.\" in some meaninful fashion. ++.if \nF \{ ++.de IX ++.tm Index:\\$1\t\\n%\t"\\$2" ++.. ++.nr % 0 ++.rr F ++.\} ++.TH TTF2PT1_CONVERT 1 "version 3.4.4-SNAP-030526" "May 26, 2003" "TTF2PT1 Font Converter" ++.UC ++.if n .hy 0 ++.if n .na ++.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' ++.de CQ \" put $1 in typewriter font ++.ft CW ++'if n "\c ++'if t \\&\\$1\c ++'if n \\&\\$1\c ++'if n \&" ++\\&\\$2 \\$3 \\$4 \\$5 \\$6 \\$7 ++'.ft R ++.. ++.\" @(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2 ++. \" AM - accent mark definitions ++.bd B 3 ++. \" fudge factors for nroff and troff ++.if n \{\ ++. ds #H 0 ++. ds #V .8m ++. ds #F .3m ++. ds #[ \f1 ++. ds #] \fP ++.\} ++.if t \{\ ++. ds #H ((1u-(\\\\n(.fu%2u))*.13m) ++. ds #V .6m ++. ds #F 0 ++. ds #[ \& ++. ds #] \& ++.\} ++. \" simple accents for nroff and troff ++.if n \{\ ++. ds ' \& ++. ds ` \& ++. ds ^ \& ++. ds , \& ++. ds ~ ~ ++. ds ? ? ++. ds ! ! ++. ds / ++. ds q ++.\} ++.if t \{\ ++. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" ++. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' ++. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' ++. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' ++. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' ++. ds ? \s-2c\h'-\w'c'u*7/10'\u\h'\*(#H'\zi\d\s+2\h'\w'c'u*8/10' ++. ds ! \s-2\(or\s+2\h'-\w'\(or'u'\v'-.8m'.\v'.8m' ++. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' ++. ds q o\h'-\w'o'u*8/10'\s-4\v'.4m'\z\(*i\v'-.4m'\s+4\h'\w'o'u*8/10' ++.\} ++. \" troff and (daisy-wheel) nroff accents ++.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' ++.ds 8 \h'\*(#H'\(*b\h'-\*(#H' ++.ds v \\k:\h'-(\\n(.wu*9/10-\*(#H)'\v'-\*(#V'\*(#[\s-4v\s0\v'\*(#V'\h'|\\n:u'\*(#] ++.ds _ \\k:\h'-(\\n(.wu*9/10-\*(#H+(\*(#F*2/3))'\v'-.4m'\z\(hy\v'.4m'\h'|\\n:u' ++.ds . \\k:\h'-(\\n(.wu*8/10)'\v'\*(#V*4/10'\z.\v'-\*(#V*4/10'\h'|\\n:u' ++.ds 3 \*(#[\v'.2m'\s-2\&3\s0\v'-.2m'\*(#] ++.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] ++.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' ++.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' ++.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] ++.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] ++.ds ae a\h'-(\w'a'u*4/10)'e ++.ds Ae A\h'-(\w'A'u*4/10)'E ++.ds oe o\h'-(\w'o'u*4/10)'e ++.ds Oe O\h'-(\w'O'u*4/10)'E ++. \" corrections for vroff ++.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' ++.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' ++. \" for low resolution devices (crt and lpr) ++.if \n(.H>23 .if \n(.V>19 \ ++\{\ ++. ds : e ++. ds 8 ss ++. ds v \h'-1'\o'\(aa\(ga' ++. ds _ \h'-1'^ ++. ds . \h'-1'. ++. ds 3 3 ++. ds o a ++. ds d- d\h'-1'\(ga ++. ds D- D\h'-1'\(hy ++. ds th \o'bp' ++. ds Th \o'LP' ++. ds ae ae ++. ds Ae AE ++. ds oe oe ++. ds Oe OE ++.\} ++.rm #[ #] #H #V #F C ++.SH "NAME" ++\fBttf2pt1_convert\fR \- convenience font conversion script ++.SH "SYNOPSIS" ++ttf2pt1_convert \fB[config-file]\fR ++.SH "DESCRIPTION" ++`\fBConvert\fR\*(R' is the master conversion script provided with ttf2pt1. ++When installed into a public directory it's named `\fBttf2pt1_convert\fR\*(R' ++to avoid name collisions with the other programs. ++.PP ++If the configuration file is not specified as an argument then the file ++`\f(CWconvert.cfg\fR\*(R' in the current directory is used. This file contains ++a set of configuration variables. The distribution contains a sample file ++file `\f(CWconvert.cfg.sample\fR\*(R'. Please copy it to `\f(CWconvert.cfg\fR\*(R', ++look inside it and change the configuration variables. The more stable ++configuration variables, such as the path names of the scripts and ++encoding files are located in `\f(CWconvert\fR\*(R' itself, they are ++automatically updated when installing \fBttf2pt1\fR. ++.PP ++Put all the TTF fonts you want to convert into some directory (this ++may be just the directory that already contains all the Windows ++fonts on a mounted FAT filesystem). If you have fonts in different ++source encoding then put the fonts in each of the encodings ++into a separate directory. Up to 10 source directories are ++supported. If you (in a rather unlikely case) have more source ++directories then you can make two separate runs of the converter, ++converting up to 10 directories at a time. ++.PP ++The variables in the configuration file are: ++.Ip "\(bu" 2 ++\fB\f(CWSRCDIRS\fR\fR \- the list of directories (with absolute paths) with ++\s-1TTF\s0 fonts. Each line contains at least 3 fields: the name of the directory, ++the language of the fonts in it (if you have fonts for different ++languages you have to put them into the separate directories) and the ++encoding of the fonts. Again, if you have some of the \s-1TTF\s0 typefaces in ++one encoding, and some in another (say, \s-1CP\s0\-1251 and \s-1KOI\s0\-8), you have ++to put them into the separate source directories. Some lines may contain ++4 fields. Then the fourth field is the name of the external map to ++convert the Unicode fonts into the desirable encoding. This map is ++used instead of the built-in map for the specified language. ++.Sp ++*8* ++An interesting thing is that some languages have more than one ++widely used character encodings. For example, the widely used ++encodings for Russian are \s-1IBM\s0 \s-1CP\s0\-866 (\s-1MS\s0\-\s-1DOS\s0 and Unix), \s-1KOI\s0\-8 ++(Unix and \s-1VAX\s0, also the standard Internet encoding), \s-1IBM\s0 \s-1CP\s0\-1251 (\s-1MS\s0 Windows). ++That's why I have provided the means to generate the converted fonts ++in more than one encoding. See the file encodings/\s-1README\s0 for ++details about the encoding tables. Actually, if you plan to use ++these fonts with Netscape Navigator better use the aliases ++cp-866 instead of ibm-866 and windows-1251 instead of ibm-1251 ++because that's what Netscape wants. ++.Ip "\(bu" 2 ++\fB\f(CWDSTDIR\fR\fR \- directory for the resulting Type1 fonts. Be careful! ++This directory gets completely wiped out before conversion, ++so don't use any already existing directory for this purpose. ++.Ip "\(bu" 2 ++\fB\f(CWDSTENC\fI{language}\fR\fR\fR \- the list of encodings in which the destination ++fonts will be generated for each language. Each font of that ++language will be generated in each of the specified ++encodings. If you don't want any translation, just specify both ++\f(CWSRCENC\fR and \f(CWDSTENC\fR as iso8859-1 (or if you want any other encoding ++specified in the fonts.dir, copy the description of 8859-1 with ++new name and use this new name for \f(CWSRCENC\fR and \f(CWDSTENC\fR). ++.Ip "\(bu" 2 ++\fB\f(CWFOUNDRY\fR\fR \- the foundry name to be used in the fonts.dir file. I have ++set it to `fromttf\*(R' to avoid name conflicts with any existing font for ++sure. But this foundry name is not registered in X11 standards and ++if you want to get the full standard compliance or have a font server ++that enforces such a compliance, use `misc\*(R'. ++.PP ++The next few parameters control the general behavior of the converter. ++They default values are set to something reasonable. ++.Ip "\(bu" 2 ++\fB\f(CWCORRECTWIDTH\fR\fR \- if the value is set to \fB\f(CWYES\fR\fR then use the ++converter option \f(CW\fB-w\fR\fR, otherwise don't use it. See the description of ++this option in the \s-1README\s0 file. ++.Ip "\(bu" 2 ++\fB\f(CWREMOVET1A\fR\fR \- if the value is set to \fB\f(CWYES\fR\fR then after ++conversion remove the un-encoded \f(CW.t1a\fR font files and the ++intermediate \f(CW.xpfa\fR font metric files. ++.Ip "\(bu" 2 ++\fB\f(CWINSTALLFONTMAP\fR\fR \- a Ghostscript parameter, if the value is set to ++\fB\f(CWYES\fR\fR then install the entries for the new fonts ++right into the main \f(CWFontmap\fR file. Otherwise just leave ++the file \f(CWFontmap.ttf\fR in the Ghostscript configuration ++directory. ++.Ip "\(bu" 2 ++\fB\f(CWHINTSUBST\fR\fR \- if the value is set to \fB\f(CWYES\fR\fR use the option ++\f(CW\fB-H\fR\fR, otherwise don't use it. This option enables the ++hint substitution technique. If you have not installed the X11 patch ++described above, use this option with great caution. See further ++description of this option in the \s-1README\s0 file. ++.Ip "\(bu" 2 ++\fB\f(CWENFORCEISO\fR\fR \- if the value is set to \fB\f(CWYES\fR\fR then ++disguise the resulting fonts as the fonts in ISOLatin1 encoding. Historically ++this was neccessary due to the way the installer scripts created the ++X11 font configuration files. It is not neccessary any more for this ++purpose. But if you plan to use these fonts with some other application ++that expects ISOLatin1 encoding then better enable this option. ++.Ip "\(bu" 2 ++\fB\f(CWALLGLYPHS\fR\fR \- if the value is set to \fB\f(CWYES\fR\fR then ++include all the glyphs from the source fonts into the resulting fonts, even ++if these glyphs are inaccessible. If it's set to \fB\f(CWNO\fR\fR then ++include only the glyphs which have codes assigned to them. The glyphs ++without codes can not be used directly. But some clever programs, ++such as the Type 1 library from XFree86 3.9 and higher can change ++the encoding on the fly and use another set of glyphs. If you have not ++installed the X11 patch described above, use this option with great ++caution. See further description of the option option \f(CW\fB-a\fR\fR in the ++\s-1README\s0 file. ++.Ip "\(bu" 2 ++\fB\f(CWGENUID\fR\fR \- if the value is set to \fB\f(CWYES\fR\fR then use ++the option \f(CW\fB-uA\fR\fR of the converter to generate UniqueIDs for ++the converted fonts. The standard X11 Type 1 library does not use ++this \s-1ID\s0, so it may only be neccessary for the other applications. ++The script is clever enough to generate different UniqueID for the ++same font converted to multiple encodings. Also after conversion it ++checks all the fonts generacted during the session for duplicated ++UniqueID and shows those. Still, this does not quarantee that these ++UniqueIDs won't overlap with some other fonts. The UniqueIDs are ++generated as hash values from the font names, so it's guaranteed ++that if the `\f(CWconvert\fR\*(R' script runs multiple times it will ++generate the same UniqueIDs during each run. See further description ++of this option in the \s-1README\s0 file. ++.Ip "\(bu" 2 ++\fB\f(CWGENUID\fR\fR \- if the value is set to \fB\f(CWYES\fR\fR then create ++the \f(CW.pfb\fR files, otherwise the \f(CW.pfa\fR files. The \f(CW.pfb\fR ++files are more compact but contain binary data, so you may experience some ++troubles when transferring them through the network. ++.PP ++The following parameters are used to locate the other scripts and ++configuration files. By default the scripts do a bit of guessing for them: ++they search in the \fBttf2pt1\fR installation directory if \fBttf2pt1\fR ++was installed or otherwise suppose that you are running `\f(CWconvert\fR\*(R' with ++`\f(CWscripts\fR\*(R' subdirectory being the current directory. ++.Ip "\(bu" 2 ++\fB\f(CWENCDIR\fR\fR \- directory containing the descriptions of encodings ++.Ip "\(bu" 2 ++\fB\f(CWMAPDIR\fR\fR \- directory containing the external map files ++.PP ++Besides that a few parameters are built into the `\f(CWconvert\fR\*(R' script itself. ++You probably won't need to change them: ++.Ip "\(bu" 2 ++\f(CW\fBT1ASM\fR\fR, \f(CW\fBTTF2PT1\fR\fR, \f(CW\fBTRANS\fR\fR, \f(CW\fBT1FDIR\fR\fR, \f(CW\fBFORCEISO\fR\fR \- paths to the other script ++.PP ++Also there are a few parameters controlling the installation of ++fonts for Ghostscript. Please look at their description in the ++Ghostscript section of documentation or in the \fBttf2pt1_x2gs(1)\fR ++manual page before running `\f(CWconvert\fR\*(R'. If these parameters are ++set, `\f(CWconvert\fR\*(R' will call the `\f(CWx2gs\fR\*(R' script automatically ++to install the newly converted fonts in Ghostscript. ++.PP ++After creating the configuration file run the `\f(CWconvert\fR\*(R' script. Look at ++the result and the log file in \f(CWDSTDIR\fR. ++.PP ++Add the directory with newly converted fonts to the configuration ++of X server or font server. For most of the systems this step is ++very straightforward. For \s-1HP\s0\-\s-1UX\s0 it's rather tricky and poorly ++documented, so the file \s-1FONTS\s0.hpux gives a short description. ++.PP ++If you don't have the privileges of the root user, you still can ++configure your private font server. Just use some non-standard ++port number (see \s-1FONTS\s0.hpux for an example, exept that you won't ++need all the \s-1HP\s0\-related stuff on any other system). ++.SH "FILES" ++.Ip "\(bu" 2 ++\s-1TTF2PT1_SHAREDIR/\s0scripts/convert.cfg.sample ++.Ip "\(bu" 2 ++\s-1TTF2PT1_SHAREDIR/\s0scripts/* ++.Ip "\(bu" 2 ++\s-1TTF2PT1_SHAREDIR/README\s0 ++.Ip "\(bu" 2 ++\s-1TTF2PT1_SHAREDIR/FONTS\s0 ++.Ip "\(bu" 2 ++\s-1TTF2PT1_SHAREDIR\s0/* ++.Ip "\(bu" 2 ++\s-1TTF2PT1_BINDIR/\s0ttf2pt1 ++.SH "SEE ALSO" ++.Ip "\(bu" 4 ++the \fIttf2pt1(1)\fR manpage ++.Ip "\(bu" 4 ++the \fIttf2pt1_x2gs(1)\fR manpage ++.Ip "\(bu" 4 ++the \fIt1asm(1)\fR manpage ++.SH "BUGS" ++.Sh "Known problems" ++.Ip "\(bu" 4 ++One catch is that the X11 Type 1 font library has a rather low limit ++on the font size. Because of this the fonts with more complicated ++outlines and the enabled hint substitution may not fit into ++this limit. The same applies to the fonts with very complicated ++outlines or with very many glyphs (especially the fonts with ++over 256 glyphs). So you will need to excercise caution with ++these options if you plan using these fonts with X11. Some vendors ++such as \s-1HP\s0 provide the Type 1 implementation licensed from Adobe ++which should have no such problem. ++.Sp ++But there is a solution even for the generic X11. A patch located ++in the subdirectory `\f(CWapp/X11\fR\*(R' fixes this problem as well ++as some other minor problems. Its description is provided in ++app/X11/\s-1README\s0. ++.Sp ++To fix the X11 font library, you have to get the X11 sources. I ++can recommend the ftp sites of the XFree86 project ftp://ftp.xfree86.org ++or of the Open Group ftp://ftp.x.org. This patch was made on the sources ++of XFree86 so you may have better success with applying it to the ++XFree86 distribution. After you have got the sources, make sure ++that you can compile them. Then apply the patch as described. ++Make sure that it was applied properly. Compile the sources again ++(actually, you need only the fonts library, the fonts server, and ++possibly the X server). It would be prudent now to save your old ++font library, font server and, possibly, X server. Then install ++the new recently compiled versions of these files. Of course, ++if you know someone who already has compiled these files for the ++same \s-1OS\s0 as yours, you can just copy the binary fles from him. ++.Sp ++Alas, building the X11 system from the source code is not the ++easiest thing in the world and if you have no experience it ++can be quite difficult. In this case just avoid the aforementioned ++features or check each converted font to make sure that it ++works properly. ++.Ip "\(bu" 4 ++The Type1 font library from the standard X11 distribution ++does not work on \s-1HP\s0\-\s-1UX\s0 (at least, up to 10.01). The font server ++supplied with \s-1HP\s0\-\s-1UX\s0 up to 10.01 is also broken. Starting from ++\s-1HP\s0\-\s-1UX\s0 10.20 (I don't know about 10.10) they supply a proprietary font ++library and the converted fonts work fine with it, provided that ++they are configured properly (see the file \s-1FONTS\s0.hpux). ++.Ip "\(bu" 4 ++The \f(CWfonts.scale\fR files created by the older versions of the ++\f(CWttf2pt1\fR installation program (up to release 3.1) have conflicted ++with the language definitions of the \f(CWXfsft\fR font server and ++parts of it included into XFree86. To overcome this incompatibility ++the never versions creats the \f(CWfonts.scale\fR file describing all the ++fonts as belonging to the \f(CWadobe-fontspecific\fR encoding and ++the \f(CWfonts.alias\fR file with the proper names. The drawback of ++this solution is that \f(CWxlsfonts\fR gives the list of twice more ++fonts. But as a side effect the option \f(CW\fBENFORCEISO\fR\fR in ++`\f(CWconvert.cfg\fR\*(R' is not required for X11 any more. ++.Ip "\(bu" 4 ++The conversion script has no support for Eastern multi-plane fonts. ++Contribution of such a support would be welcome. ++ ++.rn }` '' ++.IX Title "TTF2PT1_CONVERT 1" ++.IX Name "B - convenience font conversion script" ++ ++.IX Header "NAME" ++ ++.IX Header "SYNOPSIS" ++ ++.IX Header "DESCRIPTION" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Header "FILES" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Header "SEE ALSO" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Header "BUGS" ++ ++.IX Subsection "Known problems" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ +diff -ruN xserver-old/hw/xprint/extras/ttf2pt1/ttf2pt1_x2gs.1 xserver/hw/xprint/extras/ttf2pt1/ttf2pt1_x2gs.1 +--- xserver-old/hw/xprint/extras/ttf2pt1/ttf2pt1_x2gs.1 1970-01-01 10:00:00.000000000 +1000 ++++ xserver/hw/xprint/extras/ttf2pt1/ttf2pt1_x2gs.1 2006-06-27 13:10:26.000000000 +1000 +@@ -0,0 +1,319 @@ ++.rn '' }` ++''' $RCSfile$$Revision$$Date$ ++''' ++''' $Log$ ++''' Revision 1.1.4.1 2004/04/21 10:03:13 gisburn ++''' Fix for http://pdx.freedesktop.org/cgi-bin/bugzilla/show_bug.cgi?id=530 - Land XPRINT branch on XORG-CURRENT ++''' ++''' Revision 1.1 2003/06/04 00:33:54 roland ++''' Fix for http://xprint.mozdev.org/bugs/show_bug.cgi?id=3846 - RFE: Upload Freetype --> PS Type1 font converter "ttf2pt1" ... ++''' ++''' ++.de Sh ++.br ++.if t .Sp ++.ne 5 ++.PP ++\fB\\$1\fR ++.PP ++.. ++.de Sp ++.if t .sp .5v ++.if n .sp ++.. ++.de Ip ++.br ++.ie \\n(.$>=3 .ne \\$3 ++.el .ne 3 ++.IP "\\$1" \\$2 ++.. ++.de Vb ++.ft CW ++.nf ++.ne \\$1 ++.. ++.de Ve ++.ft R ++ ++.fi ++.. ++''' ++''' ++''' Set up \*(-- to give an unbreakable dash; ++''' string Tr holds user defined translation string. ++''' Bell System Logo is used as a dummy character. ++''' ++.tr \(*W-|\(bv\*(Tr ++.ie n \{\ ++.ds -- \(*W- ++.ds PI pi ++.if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch ++.if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch ++.ds L" "" ++.ds R" "" ++''' \*(M", \*(S", \*(N" and \*(T" are the equivalent of ++''' \*(L" and \*(R", except that they are used on ".xx" lines, ++''' such as .IP and .SH, which do another additional levels of ++''' double-quote interpretation ++.ds M" """ ++.ds S" """ ++.ds N" """"" ++.ds T" """"" ++.ds L' ' ++.ds R' ' ++.ds M' ' ++.ds S' ' ++.ds N' ' ++.ds T' ' ++'br\} ++.el\{\ ++.ds -- \(em\| ++.tr \*(Tr ++.ds L" `` ++.ds R" '' ++.ds M" `` ++.ds S" '' ++.ds N" `` ++.ds T" '' ++.ds L' ` ++.ds R' ' ++.ds M' ` ++.ds S' ' ++.ds N' ` ++.ds T' ' ++.ds PI \(*p ++'br\} ++.\" If the F register is turned on, we'll generate ++.\" index entries out stderr for the following things: ++.\" TH Title ++.\" SH Header ++.\" Sh Subsection ++.\" Ip Item ++.\" X<> Xref (embedded ++.\" Of course, you have to process the output yourself ++.\" in some meaninful fashion. ++.if \nF \{ ++.de IX ++.tm Index:\\$1\t\\n%\t"\\$2" ++.. ++.nr % 0 ++.rr F ++.\} ++.TH TTF2PT1_X2GS 1 "version 3.4.4-SNAP-030526" "May 26, 2003" "TTF2PT1 Font Converter" ++.UC ++.if n .hy 0 ++.if n .na ++.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' ++.de CQ \" put $1 in typewriter font ++.ft CW ++'if n "\c ++'if t \\&\\$1\c ++'if n \\&\\$1\c ++'if n \&" ++\\&\\$2 \\$3 \\$4 \\$5 \\$6 \\$7 ++'.ft R ++.. ++.\" @(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2 ++. \" AM - accent mark definitions ++.bd B 3 ++. \" fudge factors for nroff and troff ++.if n \{\ ++. ds #H 0 ++. ds #V .8m ++. ds #F .3m ++. ds #[ \f1 ++. ds #] \fP ++.\} ++.if t \{\ ++. ds #H ((1u-(\\\\n(.fu%2u))*.13m) ++. ds #V .6m ++. ds #F 0 ++. ds #[ \& ++. ds #] \& ++.\} ++. \" simple accents for nroff and troff ++.if n \{\ ++. ds ' \& ++. ds ` \& ++. ds ^ \& ++. ds , \& ++. ds ~ ~ ++. ds ? ? ++. ds ! ! ++. ds / ++. ds q ++.\} ++.if t \{\ ++. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" ++. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' ++. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' ++. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' ++. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' ++. ds ? \s-2c\h'-\w'c'u*7/10'\u\h'\*(#H'\zi\d\s+2\h'\w'c'u*8/10' ++. ds ! \s-2\(or\s+2\h'-\w'\(or'u'\v'-.8m'.\v'.8m' ++. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' ++. ds q o\h'-\w'o'u*8/10'\s-4\v'.4m'\z\(*i\v'-.4m'\s+4\h'\w'o'u*8/10' ++.\} ++. \" troff and (daisy-wheel) nroff accents ++.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' ++.ds 8 \h'\*(#H'\(*b\h'-\*(#H' ++.ds v \\k:\h'-(\\n(.wu*9/10-\*(#H)'\v'-\*(#V'\*(#[\s-4v\s0\v'\*(#V'\h'|\\n:u'\*(#] ++.ds _ \\k:\h'-(\\n(.wu*9/10-\*(#H+(\*(#F*2/3))'\v'-.4m'\z\(hy\v'.4m'\h'|\\n:u' ++.ds . \\k:\h'-(\\n(.wu*8/10)'\v'\*(#V*4/10'\z.\v'-\*(#V*4/10'\h'|\\n:u' ++.ds 3 \*(#[\v'.2m'\s-2\&3\s0\v'-.2m'\*(#] ++.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] ++.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' ++.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' ++.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] ++.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] ++.ds ae a\h'-(\w'a'u*4/10)'e ++.ds Ae A\h'-(\w'A'u*4/10)'E ++.ds oe o\h'-(\w'o'u*4/10)'e ++.ds Oe O\h'-(\w'O'u*4/10)'E ++. \" corrections for vroff ++.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' ++.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' ++. \" for low resolution devices (crt and lpr) ++.if \n(.H>23 .if \n(.V>19 \ ++\{\ ++. ds : e ++. ds 8 ss ++. ds v \h'-1'\o'\(aa\(ga' ++. ds _ \h'-1'^ ++. ds . \h'-1'. ++. ds 3 3 ++. ds o a ++. ds d- d\h'-1'\(ga ++. ds D- D\h'-1'\(hy ++. ds th \o'bp' ++. ds Th \o'LP' ++. ds ae ae ++. ds Ae AE ++. ds oe oe ++. ds Oe OE ++.\} ++.rm #[ #] #H #V #F C ++.SH "NAME" ++\fBttf2pt1_x2gs\fR \- font installer for Ghostscript ++.SH "SYNOPSIS" ++ttf2pt1_x2gs \fB[config-file]\fR ++.SH "DESCRIPTION" ++The fonts generated with \fBttf2pt1\fR work fine with Ghostscript by ++themselves. The script `\fBx2gs\fR\*(R' (or `\fBttf2pt1_x2gs\fR\*(R' when installed ++into a public directory, to avoid name conflicts with other ++programs) links the font files from the X11 direcotry into the Ghostscript ++directory and automatically creates the description file (\f(CWFontmap\fR) ++in Ghostscript format. ++.PP ++If the configuration file is not specified as an argument then the file ++`\f(CWconvert.cfg\fR\*(R' in the current directory is used, just like the ++`\f(CWconvert\fR\*(R' script does. Indeed, this configuration file is used for ++both scripts. ++.PP ++The Ghostscript-related parameters in the configuration file are: ++.PP ++\fB\f(CWDSTDIR\fR\fR \- the X11 font directory used by `\f(CWx2gs\fR\*(R' as the ++source of the fonts. This parameter is common with the X11 ++configuration. ++.PP ++\fB\f(CWGSDIR\fR\fR \- the base directory of Ghostsript. If this ++parameter is set to an empty string then `\f(CWconvert\fR\*(R' won't ++call `\f(CWx2gs\fR\*(R'. So if you want to get only the X11 fonts ++installed then set this parameter to an empty string. This ++directory may vary on various system, so please check your ++system and set this value accordingly before running the script. ++.PP ++\fB\f(CWGSFONTDIR\fR\fR \- the font directory of Ghostscript. In the standard ++Ghostscript installation it's a subdirectory of \f(CWGSDIR\fR ++but some systems may use completely different directories. ++.PP ++\fB\f(CWGSCONFDIR\fR\fR \- the configuration subdirectory of Ghostscript ++that contains the \f(CWFontmap\fR file. ++.PP ++\fB\f(CWINSTALLFONTMAP\fR\fR \- if the value is set to \fB\f(CWYES\fR\fR then ++install the entries for the new fonts right into the main ++\f(CWFontmap\fR file. Otherwise just leave the file \f(CWFontmap.ttf\fR ++in the Ghostscript configuration directory. ++.PP ++After preparing the configuration file run the script. It symbolicaly links ++all the font files and creates the description file \f(CWFontmap.ttf\fR in ++\f(CWGSCONDFIR\fR. After that there are two choices. ++.PP ++If the option \f(CWINSTALLFONTMAP\fR was set to \f(CWYES\fR then ++the font descriptions are also automatically installed into the ++master \f(CWFontmap\fR file. The script is clever enough to ++detect if it was run multiple times with the same directories ++and if so it replaces the old \f(CWFontmap\fR entries with ++the new ones instead of just accumulating all of them. You ++may also run it multiple times for multiple X11 directories ++and all the results will be properly collected in the \f(CWFontmap\fR. ++But it's your responsibility to watch that the names of the ++font files don't overlap. If the X11 font directory gets ++renamed then you have to remove its font entries from the ++\f(CWFontmap\fR and only after that re-run `\f(CWx2gs\fR\*(R' ++for the new directory. ++.PP ++On the other hand if the option \f(CWINSTALLFONTMAP\fR was set to ++\f(CWNO\fR then go to the \f(CWGSCONFDIR\fR directory and insert the ++contents of \f(CWFontmap.ttf\fR into the \f(CWFontmap\fR file ++manually. This step may be left manual to make the installation ++a little bit more safe. ++.PP ++After that you may also want to redefine some of the aliases in ++\f(CWFontmap\fR to refer to the newly installed fonts. ++But the redefinition of the aliases may be dangerous if the width of ++characters in the new font will be different from the old font. ++Alas, there is no visible solution of this problem yet. ++.SH "FILES" ++.Ip "\(bu" 2 ++\s-1TTF2PT1_SHAREDIR/\s0scripts/convert.cfg.sample ++.Ip "\(bu" 2 ++\s-1TTF2PT1_SHAREDIR/\s0scripts/* ++.Ip "\(bu" 2 ++\s-1TTF2PT1_SHAREDIR/README\s0 ++.Ip "\(bu" 2 ++\s-1TTF2PT1_SHAREDIR/FONTS\s0 ++.Ip "\(bu" 2 ++\s-1TTF2PT1_SHAREDIR\s0/* ++.Ip "\(bu" 2 ++\s-1TTF2PT1_BINDIR/\s0ttf2pt1 ++.SH "SEE ALSO" ++.Ip "\(bu" 4 ++the \fIttf2pt1(1)\fR manpage ++.Ip "\(bu" 4 ++the \fIttf2pt1_convert(1)\fR manpage ++.Ip "\(bu" 4 ++the \fIt1asm(1)\fR manpage ++ ++.rn }` '' ++.IX Title "TTF2PT1_X2GS 1" ++.IX Name "B - font installer for Ghostscript" ++ ++.IX Header "NAME" ++ ++.IX Header "SYNOPSIS" ++ ++.IX Header "DESCRIPTION" ++ ++.IX Header "FILES" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Header "SEE ALSO" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ ++.IX Item "\(bu" ++ +diff -ruN xserver-old/hw/xprint/extras/ttf2pt1/ttf.c xserver/hw/xprint/extras/ttf2pt1/ttf.c +--- xserver-old/hw/xprint/extras/ttf2pt1/ttf.c 1970-01-01 10:00:00.000000000 +1000 ++++ xserver/hw/xprint/extras/ttf2pt1/ttf.c 2006-06-27 13:10:26.000000000 +1000 +@@ -0,0 +1,1480 @@ ++/* ++ * True Type Font to Adobe Type 1 font converter ++ * By Mark Heath ++ * Based on ttf2pfa by Andrew Weeks ++ * With help from Frank M. Siegert ++ * ++ * see COPYRIGHT ++ * ++ */ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#ifndef WINDOWS ++# include ++# include ++#else ++# include "windows.h" ++#endif ++ ++#include "ttf.h" ++#include "pt1.h" ++#include "global.h" ++ ++/* prototypes of call entries */ ++static void openfont(char *fname, char *arg); ++static void closefont( void); ++static int getnglyphs ( void); ++static int glnames( GLYPH *glyph_list); ++static void glmetrics( GLYPH *glyph_list); ++static int glenc( GLYPH *glyph_list, int *encoding, int *unimap); ++static void fnmetrics( struct font_metrics *fm); ++static void glpath( int glyphno, GLYPH *glyph_list); ++static void kerning( GLYPH *glyph_list); ++ ++/* globals */ ++ ++/* front-end descriptor */ ++struct frontsw ttf_sw = { ++ /*name*/ "ttf", ++ /*descr*/ "built-in TTF support", ++ /*suffix*/ { "ttf" }, ++ /*open*/ openfont, ++ /*close*/ closefont, ++ /*nglyphs*/ getnglyphs, ++ /*glnames*/ glnames, ++ /*glmetrics*/ glmetrics, ++ /*glenc*/ glenc, ++ /*fnmetrics*/ fnmetrics, ++ /*glpath*/ glpath, ++ /*kerning*/ kerning, ++}; ++ ++/* statics */ ++ ++static FILE *ttf_file; ++static int ttf_nglyphs, long_offsets; ++ ++static TTF_DIRECTORY *directory; ++static TTF_DIR_ENTRY *dir_entry; ++static char *filebuffer; ++static char *filebuffer_end; ++static TTF_NAME *name_table = NULL; ++static TTF_NAME_REC *name_record; ++static TTF_HEAD *head_table = NULL; ++static TTF_HHEA *hhea_table = NULL; ++static TTF_KERN *kern_table = NULL; ++static TTF_CMAP *cmap_table = NULL; ++static LONGHORMETRIC *hmtx_table = NULL; ++static TTF_GLYF *glyf_table; ++static BYTE *glyf_start = NULL; ++static TTF_MAXP *maxp_table = NULL; ++static TTF_POST_HEAD *post_table = NULL; ++static union { ++ USHORT *sp; ++ ULONG *lp; ++} loca_table; ++#define short_loca_table loca_table.sp ++#define long_loca_table loca_table.lp ++ ++static short cmap_n_segs; ++static USHORT *cmap_seg_start, *cmap_seg_end; ++static short *cmap_idDelta, *cmap_idRangeOffset; ++static TTF_CMAP_FMT0 *encoding0; ++static int enc_type; ++ ++static char name_buffer[2000]; ++static char *name_fields[8]; ++ ++static int enc_found_ms, enc_found_mac; ++ ++static char *mac_glyph_names[258] = { ++ ".notdef", ".null", "CR", ++ "space", "exclam", "quotedbl", "numbersign", ++ "dollar", "percent", "ampersand", "quotesingle", ++ "parenleft", "parenright", "asterisk", "plus", ++ "comma", "hyphen", "period", "slash", ++ "zero", "one", "two", "three", ++ "four", "five", "six", "seven", ++ "eight", "nine", "colon", "semicolon", ++ "less", "equal", "greater", "question", ++ "at", "A", "B", "C", ++ "D", "E", "F", "G", ++ "H", "I", "J", "K", ++ "L", "M", "N", "O", ++ "P", "Q", "R", "S", ++ "T", "U", "V", "W", ++ "X", "Y", "Z", "bracketleft", ++ "backslash", "bracketright", "asciicircum", "underscore", ++ "grave", "a", "b", "c", ++ "d", "e", "f", "g", ++ "h", "i", "j", "k", ++ "l", "m", "n", "o", ++ "p", "q", "r", "s", ++ "t", "u", "v", "w", ++ "x", "y", "z", "braceleft", ++ "bar", "braceright", "asciitilde", "Adieresis", ++ "Aring", "Ccedilla", "Eacute", "Ntilde", ++ "Odieresis", "Udieresis", "aacute", "agrave", ++ "acircumflex", "adieresis", "atilde", "aring", ++ "ccedilla", "eacute", "egrave", "ecircumflex", ++ "edieresis", "iacute", "igrave", "icircumflex", ++ "idieresis", "ntilde", "oacute", "ograve", ++ "ocircumflex", "odieresis", "otilde", "uacute", ++ "ugrave", "ucircumflex", "udieresis", "dagger", ++ "degree", "cent", "sterling", "section", ++ "bullet", "paragraph", "germandbls", "registered", ++ "copyright", "trademark", "acute", "dieresis", ++ "notequal", "AE", "Oslash", "infinity", ++ "plusminus", "lessequal", "greaterequal", "yen", ++ "mu", "partialdiff", "summation", "product", ++ "pi", "integral", "ordfeminine", "ordmasculine", ++ "Omega", "ae", "oslash", "questiondown", ++ "exclamdown", "logicalnot", "radical", "florin", ++ "approxequal", "increment", "guillemotleft", "guillemotright", ++ "ellipsis", "nbspace", "Agrave", "Atilde", ++ "Otilde", "OE", "oe", "endash", ++ "emdash", "quotedblleft", "quotedblright", "quoteleft", ++ "quoteright", "divide", "lozenge", "ydieresis", ++ "Ydieresis", "fraction", "currency", "guilsinglleft", ++ "guilsinglright", "fi", "fl", "daggerdbl", ++ "periodcentered", "quotesinglbase", "quotedblbase", "perthousand", ++ "Acircumflex", "Ecircumflex", "Aacute", "Edieresis", ++ "Egrave", "Iacute", "Icircumflex", "Idieresis", ++ "Igrave", "Oacute", "Ocircumflex", "applelogo", ++ "Ograve", "Uacute", "Ucircumflex", "Ugrave", ++ "dotlessi", "circumflex", "tilde", "macron", ++ "breve", "dotaccent", "ring", "cedilla", ++ "hungarumlaut", "ogonek", "caron", "Lslash", ++ "lslash", "Scaron", "scaron", "Zcaron", ++ "zcaron", "brokenbar", "Eth", "eth", ++ "Yacute", "yacute", "Thorn", "thorn", ++ "minus", "multiply", "onesuperior", "twosuperior", ++ "threesuperior", "onehalf", "onequarter", "threequarters", ++ "franc", "Gbreve", "gbreve", "Idot", ++ "Scedilla", "scedilla", "Cacute", "cacute", ++ "Ccaron", "ccaron", "dmacron" ++}; ++ ++/* other prototypes */ ++static void draw_composite_glyf( GLYPH *g, GLYPH *glyph_list, int glyphno, ++ double *matrix, int level); ++static void draw_simple_glyf( GLYPH *g, GLYPH *glyph_list, int glyphno, ++ double *matrix); ++static double f2dot14( short x); ++ ++/* get the TTF description table address and length for this index */ ++ ++static void ++get_glyf_table( ++ int glyphno, ++ TTF_GLYF **tab, ++ int *len ++) ++{ ++ if(tab!=NULL) { ++ if (long_offsets) { ++ *tab = (TTF_GLYF *) (glyf_start + ntohl(long_loca_table[glyphno])); ++ } else { ++ *tab = (TTF_GLYF *) (glyf_start + (ntohs(short_loca_table[glyphno]) << 1)); ++ } ++ } ++ if(len!=NULL) { ++ if (long_offsets) { ++ *len = ntohl(long_loca_table[glyphno + 1]) - ntohl(long_loca_table[glyphno]); ++ } else { ++ *len = (ntohs(short_loca_table[glyphno + 1]) - ntohs(short_loca_table[glyphno])) << 1; ++ } ++ } ++} ++ ++static void ++handle_name(void) ++{ ++ int j, k, lang, len, platform; ++ char *p, *string_area; ++ char *nbp = name_buffer; ++ int found3 = 0; ++ ++ string_area = (char *) name_table + ntohs(name_table->offset); ++ name_record = &(name_table->nameRecords); ++ ++ for (j = 0; j < 8; j++) { ++ name_fields[j] = ""; ++ } ++ ++ for (j = 0; j < ntohs(name_table->numberOfNameRecords); j++) { ++ ++ platform = ntohs(name_record->platformID); ++ ++ if (platform == 3) { ++ ++ found3 = 1; ++ lang = ntohs(name_record->languageID) & 0xff; ++ len = ntohs(name_record->stringLength); ++ if (lang == 0 || lang == 9) { ++ k = ntohs(name_record->nameID); ++ if (k < 8) { ++ name_fields[k] = nbp; ++ ++ p = string_area + ntohs(name_record->stringOffset); ++ for (k = 0; k < len; k++) { ++ if (p[k] != '\0') { ++ if (p[k] == '(') { ++ *nbp = '['; ++ } else if (p[k] == ')') { ++ *nbp = ']'; ++ } else { ++ *nbp = p[k]; ++ } ++ nbp++; ++ } ++ } ++ *nbp = '\0'; ++ nbp++; ++ } ++ } ++ } ++ name_record++; ++ } ++ ++ string_area = (char *) name_table + ntohs(name_table->offset); ++ name_record = &(name_table->nameRecords); ++ ++ if (!found3) { ++ for (j = 0; j < ntohs(name_table->numberOfNameRecords); j++) { ++ ++ platform = ntohs(name_record->platformID); ++ ++ if (platform == 1) { ++ ++ found3 = 1; ++ lang = ntohs(name_record->languageID) & 0xff; ++ len = ntohs(name_record->stringLength); ++ if (lang == 0 || lang == 9) { ++ k = ntohs(name_record->nameID); ++ if (k < 8) { ++ name_fields[k] = nbp; ++ ++ p = string_area + ntohs(name_record->stringOffset); ++ for (k = 0; k < len; k++) { ++ if (p[k] != '\0') { ++ if (p[k] == '(') { ++ *nbp = '['; ++ } else if (p[k] == ')') { ++ *nbp = ']'; ++ } else { ++ *nbp = p[k]; ++ } ++ nbp++; ++ } ++ } ++ *nbp = '\0'; ++ nbp++; ++ } ++ } ++ } ++ name_record++; ++ } ++ } ++ if (!found3) { ++ fprintf(stderr, "**** Cannot decode font name fields ****\n"); ++ exit(1); ++ } ++ if (name_fields[4][0] == 0) { /* Full Name empty, use Family Name */ ++ name_fields[4] = name_fields[1]; ++ } ++ if (name_fields[6][0] == 0) { /* Font Name empty, use Full Name */ ++ name_fields[6] = name_fields[4]; ++ if (name_fields[6][0] == 0) { /* oops, empty again */ ++ WARNING_1 fprintf(stderr, "Font name is unknown, setting to \"Unknown\"\n"); ++ name_fields[6] = "Unknown"; ++ } ++ } ++ p = name_fields[6]; ++ /* must not start with a digit */ ++ if(isdigit(*p)) ++ *p+= 'A'-'0'; /* change to a letter */ ++ while (*p != '\0') { ++ if (!isalnum(*p) || *p=='_') { ++ *p = '-'; ++ } ++ p++; ++ } ++} ++ ++static void ++handle_head(void) ++{ ++ long_offsets = ntohs(head_table->indexToLocFormat); ++ if (long_offsets != 0 && long_offsets != 1) { ++ fprintf(stderr, "**** indexToLocFormat wrong ****\n"); ++ exit(1); ++ } ++} ++ ++/* limit the recursion level to avoid cycles */ ++#define MAX_COMPOSITE_LEVEL 20 ++ ++static void ++draw_composite_glyf( ++ GLYPH *g, ++ GLYPH *glyph_list, ++ int glyphno, ++ double *orgmatrix, ++ int level ++) ++{ ++ int len; ++ short ncontours; ++ USHORT flagbyte, glyphindex; ++ double arg1, arg2; ++ BYTE *ptr; ++ char *bptr; ++ SHORT *sptr; ++ double matrix[6], newmatrix[6]; ++ ++ get_glyf_table(glyphno, &glyf_table, &len); ++ ++ if(len<=0) /* nothing to do */ ++ return; ++ ++ ncontours = ntohs(glyf_table->numberOfContours); ++ if (ncontours >= 0) { /* simple case */ ++ draw_simple_glyf(g, glyph_list, glyphno, orgmatrix); ++ return; ++ } ++ ++ if(ISDBG(COMPOSITE) && level ==0) ++ fprintf(stderr, "* %s [ %.2f %.2f %.2f %.2f %.2f %.2f ]\n", g->name, ++ orgmatrix[0], orgmatrix[1], orgmatrix[2], orgmatrix[3], ++ orgmatrix[4], orgmatrix[5]); ++ ++ /* complex case */ ++ if(level >= MAX_COMPOSITE_LEVEL) { ++ WARNING_1 fprintf(stderr, ++ "*** Glyph %s: stopped (possibly infinite) recursion at depth %d\n", ++ g->name, level); ++ return; ++ } ++ ++ ptr = ((BYTE *) glyf_table + sizeof(TTF_GLYF)); ++ sptr = (SHORT *) ptr; ++ do { ++ flagbyte = ntohs(*sptr); ++ sptr++; ++ glyphindex = ntohs(*sptr); ++ sptr++; ++ ++ if (flagbyte & ARG_1_AND_2_ARE_WORDS) { ++ arg1 = (short)ntohs(*sptr); ++ sptr++; ++ arg2 = (short)ntohs(*sptr); ++ sptr++; ++ } else { ++ bptr = (char *) sptr; ++ arg1 = (signed char) bptr[0]; ++ arg2 = (signed char) bptr[1]; ++ sptr++; ++ } ++ matrix[1] = matrix[2] = 0.0; ++ ++ if (flagbyte & WE_HAVE_A_SCALE) { ++ matrix[0] = matrix[3] = f2dot14(*sptr); ++ sptr++; ++ } else if (flagbyte & WE_HAVE_AN_X_AND_Y_SCALE) { ++ matrix[0] = f2dot14(*sptr); ++ sptr++; ++ matrix[3] = f2dot14(*sptr); ++ sptr++; ++ } else if (flagbyte & WE_HAVE_A_TWO_BY_TWO) { ++ matrix[0] = f2dot14(*sptr); ++ sptr++; ++ matrix[2] = f2dot14(*sptr); ++ sptr++; ++ matrix[1] = f2dot14(*sptr); ++ sptr++; ++ matrix[3] = f2dot14(*sptr); ++ sptr++; ++ } else { ++ matrix[0] = matrix[3] = 1.0; ++ } ++ ++ /* ++ * See * ++ * http://fonts.apple.com/TTRefMan/RM06/Chap6g ++ * lyf.html * matrix[0,1,2,3,4,5]=a,b,c,d,m,n ++ */ ++ ++ if (fabs(matrix[0]) > fabs(matrix[1])) ++ matrix[4] = fabs(matrix[0]); ++ else ++ matrix[4] = fabs(matrix[1]); ++ if (fabs(fabs(matrix[0]) - fabs(matrix[2])) <= 33. / 65536.) ++ matrix[4] *= 2.0; ++ ++ if (fabs(matrix[2]) > fabs(matrix[3])) ++ matrix[5] = fabs(matrix[2]); ++ else ++ matrix[5] = fabs(matrix[3]); ++ if (fabs(fabs(matrix[2]) - fabs(matrix[3])) <= 33. / 65536.) ++ matrix[5] *= 2.0; ++ ++ /* ++ * fprintf (stderr,"Matrix Opp %hd ++ * %hd\n",arg1,arg2); ++ */ ++#if 0 ++ fprintf(stderr, "Matrix: %f %f %f %f %f %f\n", ++ matrix[0], matrix[1], matrix[2], matrix[3], ++ matrix[4], matrix[5]); ++ fprintf(stderr, "Offset: %f %f (%s)\n", ++ arg1, arg2, ++ ((flagbyte & ARGS_ARE_XY_VALUES) ? "XY" : "index")); ++#endif ++ ++ if (flagbyte & ARGS_ARE_XY_VALUES) { ++ matrix[4] *= arg1; ++ matrix[5] *= arg2; ++ } else { ++ WARNING_1 fprintf(stderr, ++ "*** Glyph %s: reusing scale from another glyph is unsupported\n", ++ g->name); ++ /* ++ * must extract values from a glyph ++ * but it seems to be too much pain ++ * and it's not clear now that it ++ * would be really used in any ++ * interesting font ++ */ ++ } ++ ++ /* at this point arg1,arg2 contain what logically should be matrix[4,5] */ ++ ++ /* combine matrices */ ++ ++ newmatrix[0] = orgmatrix[0]*matrix[0] + orgmatrix[2]*matrix[1]; ++ newmatrix[1] = orgmatrix[0]*matrix[2] + orgmatrix[2]*matrix[3]; ++ ++ newmatrix[2] = orgmatrix[1]*matrix[0] + orgmatrix[3]*matrix[1]; ++ newmatrix[3] = orgmatrix[1]*matrix[2] + orgmatrix[3]*matrix[3]; ++ ++ newmatrix[4] = orgmatrix[0]*matrix[4] + orgmatrix[2]*matrix[5] + orgmatrix[4]; ++ newmatrix[5] = orgmatrix[1]*matrix[4] + orgmatrix[3]*matrix[5] + orgmatrix[5]; ++ ++ if(ISDBG(COMPOSITE)) { ++ fprintf(stderr, "%*c+-> %2d %s [ %.2f %.2f %.2f %.2f %.2f %.2f ]\n", ++ level+1, ' ', level, glyph_list[glyphindex].name, ++ matrix[0], matrix[1], matrix[2], matrix[3], ++ matrix[4], matrix[5]); ++ fprintf(stderr, "%*c = [ %.2f %.2f %.2f %.2f %.2f %.2f ]\n", ++ level+1, ' ', ++ newmatrix[0], newmatrix[1], newmatrix[2], newmatrix[3], ++ newmatrix[4], newmatrix[5]); ++ } ++ draw_composite_glyf(g, glyph_list, glyphindex, newmatrix, level+1); ++ ++ } while (flagbyte & MORE_COMPONENTS); ++} ++ ++static void ++draw_simple_glyf( ++ GLYPH *g, ++ GLYPH *glyph_list, ++ int glyphno, ++ double *matrix ++) ++{ ++ int i, j, k, k1, len, first, cs, ce; ++ /* We assume that hsbw always sets to(0, 0) */ ++ double xlast = 0, ylast = 0; ++ int finished, nguide, contour_start, contour_end; ++ short ncontours, n_inst, last_point; ++ USHORT *contour_end_pt; ++ BYTE *ptr; ++#define GLYFSZ 2000 ++ short xabs[GLYFSZ], yabs[GLYFSZ], xrel[GLYFSZ], yrel[GLYFSZ]; ++ double xcoord[GLYFSZ], ycoord[GLYFSZ]; ++ BYTE flags[GLYFSZ]; ++ double tx, ty; ++ int needreverse = 0; /* transformation may require ++ * that */ ++ GENTRY *lge; ++ ++ lge = g->lastentry; ++ ++ get_glyf_table(glyphno, &glyf_table, &len); ++ ++ if (len <= 0) { ++ WARNING_1 fprintf(stderr, ++ "**** Composite glyph %s refers to non-existent glyph %s, ignored\n", ++ g->name, ++ glyph_list[glyphno].name); ++ return; ++ } ++ ncontours = ntohs(glyf_table->numberOfContours); ++ if (ncontours < 0) { ++ WARNING_1 fprintf(stderr, ++ "**** Composite glyph %s refers to composite glyph %s, ignored\n", ++ g->name, ++ glyph_list[glyphno].name); ++ return; ++ } ++ contour_end_pt = (USHORT *) ((char *) glyf_table + sizeof(TTF_GLYF)); ++ ++ last_point = ntohs(contour_end_pt[ncontours - 1]); ++ n_inst = ntohs(contour_end_pt[ncontours]); ++ ++ ptr = ((BYTE *) contour_end_pt) + (ncontours << 1) + n_inst + 2; ++ j = k = 0; ++ while (k <= last_point) { ++ flags[k] = ptr[j]; ++ ++ if (ptr[j] & REPEAT) { ++ for (k1 = 0; k1 < ptr[j + 1]; k1++) { ++ k++; ++ flags[k] = ptr[j]; ++ } ++ j++; ++ } ++ j++; ++ k++; ++ } ++ ++ for (k = 0; k <= last_point; k++) { ++ if (flags[k] & XSHORT) { ++ if (flags[k] & XSAME) { ++ xrel[k] = ptr[j]; ++ } else { ++ xrel[k] = -ptr[j]; ++ } ++ j++; ++ } else if (flags[k] & XSAME) { ++ xrel[k] = 0.0; ++ } else { ++ xrel[k] = (short)( ptr[j] * 256 + ptr[j + 1] ); ++ j += 2; ++ } ++ if (k == 0) { ++ xabs[k] = xrel[k]; ++ } else { ++ xabs[k] = xrel[k] + xabs[k - 1]; ++ } ++ ++ } ++ ++ for (k = 0; k <= last_point; k++) { ++ if (flags[k] & YSHORT) { ++ if (flags[k] & YSAME) { ++ yrel[k] = ptr[j]; ++ } else { ++ yrel[k] = -ptr[j]; ++ } ++ j++; ++ } else if (flags[k] & YSAME) { ++ yrel[k] = 0; ++ } else { ++ yrel[k] = ptr[j] * 256 + ptr[j + 1]; ++ j += 2; ++ } ++ if (k == 0) { ++ yabs[k] = yrel[k]; ++ } else { ++ yabs[k] = yrel[k] + yabs[k - 1]; ++ } ++ } ++ ++ if (matrix) { ++ for (i = 0; i <= last_point; i++) { ++ tx = xabs[i]; ++ ty = yabs[i]; ++ xcoord[i] = fscale(matrix[0] * tx + matrix[2] * ty + matrix[4]); ++ ycoord[i] = fscale(matrix[1] * tx + matrix[3] * ty + matrix[5]); ++ } ++ } else { ++ for (i = 0; i <= last_point; i++) { ++ xcoord[i] = fscale(xabs[i]); ++ ycoord[i] = fscale(yabs[i]); ++ } ++ } ++ ++ i = j = 0; ++ first = 1; ++ ++ while (i <= ntohs(contour_end_pt[ncontours - 1])) { ++ contour_end = ntohs(contour_end_pt[j]); ++ ++ if (first) { ++ fg_rmoveto(g, xcoord[i], ycoord[i]); ++ xlast = xcoord[i]; ++ ylast = ycoord[i]; ++ contour_start = i; ++ first = 0; ++ } else if (flags[i] & ONOROFF) { ++ fg_rlineto(g, xcoord[i], ycoord[i]); ++ xlast = xcoord[i]; ++ ylast = ycoord[i]; ++ } else { ++ cs = i - 1; ++ finished = nguide = 0; ++ while (!finished) { ++ if (i == contour_end + 1) { ++ ce = contour_start; ++ finished = 1; ++ } else if (flags[i] & ONOROFF) { ++ ce = i; ++ finished = 1; ++ } else { ++ i++; ++ nguide++; ++ } ++ } ++ ++ switch (nguide) { ++ case 0: ++ fg_rlineto(g, xcoord[ce], ycoord[ce]); ++ xlast = xcoord[ce]; ++ ylast = ycoord[ce]; ++ break; ++ ++ case 1: ++ fg_rrcurveto(g, ++ (xcoord[cs] + 2.0 * xcoord[cs + 1]) / 3.0, ++ (ycoord[cs] + 2.0 * ycoord[cs + 1]) / 3.0, ++ (2.0 * xcoord[cs + 1] + xcoord[ce]) / 3.0, ++ (2.0 * ycoord[cs + 1] + ycoord[ce]) / 3.0, ++ xcoord[ce], ++ ycoord[ce] ++ ); ++ xlast = xcoord[ce]; ++ ylast = ycoord[ce]; ++ ++ break; ++ ++ case 2: ++ fg_rrcurveto(g, ++ (-xcoord[cs] + 4.0 * xcoord[cs + 1]) / 3.0, ++ (-ycoord[cs] + 4.0 * ycoord[cs + 1]) / 3.0, ++ (4.0 * xcoord[cs + 2] - xcoord[ce]) / 3.0, ++ (4.0 * ycoord[cs + 2] - ycoord[ce]) / 3.0, ++ xcoord[ce], ++ ycoord[ce] ++ ); ++ xlast = xcoord[ce]; ++ ylast = ycoord[ce]; ++ break; ++ ++ case 3: ++ fg_rrcurveto(g, ++ (xcoord[cs] + 2.0 * xcoord[cs + 1]) / 3.0, ++ (ycoord[cs] + 2.0 * ycoord[cs + 1]) / 3.0, ++ (5.0 * xcoord[cs + 1] + xcoord[cs + 2]) / 6.0, ++ (5.0 * ycoord[cs + 1] + ycoord[cs + 2]) / 6.0, ++ (xcoord[cs + 1] + xcoord[cs + 2]) / 2.0, ++ (ycoord[cs + 1] + ycoord[cs + 2]) / 2.0 ++ ); ++ ++ fg_rrcurveto(g, ++ (xcoord[cs + 1] + 5.0 * xcoord[cs + 2]) / 6.0, ++ (ycoord[cs + 1] + 5.0 * ycoord[cs + 2]) / 6.0, ++ (5.0 * xcoord[cs + 2] + xcoord[cs + 3]) / 6.0, ++ (5.0 * ycoord[cs + 2] + ycoord[cs + 3]) / 6.0, ++ (xcoord[cs + 3] + xcoord[cs + 2]) / 2.0, ++ (ycoord[cs + 3] + ycoord[cs + 2]) / 2.0 ++ ); ++ ++ fg_rrcurveto(g, ++ (xcoord[cs + 2] + 5.0 * xcoord[cs + 3]) / 6.0, ++ (ycoord[cs + 2] + 5.0 * ycoord[cs + 3]) / 6.0, ++ (2.0 * xcoord[cs + 3] + xcoord[ce]) / 3.0, ++ (2.0 * ycoord[cs + 3] + ycoord[ce]) / 3.0, ++ xcoord[ce], ++ ycoord[ce] ++ ); ++ ylast = ycoord[ce]; ++ xlast = xcoord[ce]; ++ ++ break; ++ ++ default: ++ k1 = cs + nguide; ++ fg_rrcurveto(g, ++ (xcoord[cs] + 2.0 * xcoord[cs + 1]) / 3.0, ++ (ycoord[cs] + 2.0 * ycoord[cs + 1]) / 3.0, ++ (5.0 * xcoord[cs + 1] + xcoord[cs + 2]) / 6.0, ++ (5.0 * ycoord[cs + 1] + ycoord[cs + 2]) / 6.0, ++ (xcoord[cs + 1] + xcoord[cs + 2]) / 2.0, ++ (ycoord[cs + 1] + ycoord[cs + 2]) / 2.0 ++ ); ++ ++ for (k = cs + 2; k <= k1 - 1; k++) { ++ fg_rrcurveto(g, ++ (xcoord[k - 1] + 5.0 * xcoord[k]) / 6.0, ++ (ycoord[k - 1] + 5.0 * ycoord[k]) / 6.0, ++ (5.0 * xcoord[k] + xcoord[k + 1]) / 6.0, ++ (5.0 * ycoord[k] + ycoord[k + 1]) / 6.0, ++ (xcoord[k] + xcoord[k + 1]) / 2.0, ++ (ycoord[k] + ycoord[k + 1]) / 2.0 ++ ); ++ ++ } ++ ++ fg_rrcurveto(g, ++ (xcoord[k1 - 1] + 5.0 * xcoord[k1]) / 6.0, ++ (ycoord[k1 - 1] + 5.0 * ycoord[k1]) / 6.0, ++ (2.0 * xcoord[k1] + xcoord[ce]) / 3.0, ++ (2.0 * ycoord[k1] + ycoord[ce]) / 3.0, ++ xcoord[ce], ++ ycoord[ce] ++ ); ++ xlast = xcoord[ce]; ++ ylast = ycoord[ce]; ++ ++ break; ++ } ++ } ++ if (i >= contour_end) { ++ g_closepath(g); ++ first = 1; ++ i = contour_end + 1; ++ j++; ++ } else { ++ i++; ++ } ++ } ++ ++ if (matrix) { ++ /* guess whether do we need to reverse the results */ ++ ++ double x[3], y[3]; ++ int max = 0, from, to; ++ ++ /* transform a triangle going in proper direction */ ++ /* ++ * the origin of triangle is in (0,0) so we know it in ++ * advance ++ */ ++ ++ x[0] = y[0] = 0; ++ x[1] = matrix[0] * 0 + matrix[2] * 300; ++ y[1] = matrix[1] * 0 + matrix[3] * 300; ++ x[2] = matrix[0] * 300 + matrix[2] * 0; ++ y[2] = matrix[1] * 300 + matrix[3] * 0; ++ ++ /* then find the topmost point */ ++ for (i = 0; i < 3; i++) ++ if (y[i] > y[max]) ++ max = i; ++ from = (max + 3 - 1) % 3; ++ to = (max + 1) % 3; ++ ++ needreverse = 0; ++ ++ /* special cases for horizontal lines */ ++ if (y[max] == y[from]) { ++ if (x[max] < y[from]) ++ needreverse = 1; ++ } else if (y[to] == y[from]) { ++ if (x[to] < x[max]) ++ needreverse = 1; ++ } else { /* generic case */ ++ if ((x[to] - x[max]) * (y[max] - y[from]) ++ > (x[max] - x[from]) * (y[to] - y[max])) ++ needreverse = 1; ++ } ++ ++ if (needreverse) { ++ if (lge) { ++ assertpath(lge->next, __FILE__, __LINE__, g->name); ++ reversepathsfromto(lge->next, NULL); ++ } else { ++ assertpath(g->entries, __FILE__, __LINE__, g->name); ++ reversepaths(g); ++ } ++ } ++ } ++} ++ ++static double ++f2dot14( ++ short x ++) ++{ ++ short y = ntohs(x); ++ return (y >> 14) + ((y & 0x3fff) / 16384.0); ++} ++ ++ ++/* check that the pointer points within the file */ ++/* returns 0 if pointer is good, 1 if bad */ ++static int ++badpointer( ++ void *ptr ++) ++{ ++ return (ptr < (void *)filebuffer || ptr >= (void *)filebuffer_end); ++} ++ ++/* ++ * Externally accessible methods ++ */ ++ ++/* ++ * Open font and prepare to return information to the main driver. ++ * May print error and warning messages. ++ * Exit on error. ++ */ ++ ++static void ++openfont( ++ char *fname, ++ char *arg /* unused now */ ++) ++{ ++ int i, j; ++ struct stat statbuf; ++ static struct { ++ void **tbpp; /* pointer to pointer to the table */ ++ char name[5]; /* table name */ ++ char optional; /* flag: table may be missing */ ++ } tables[] = { ++ { (void **)&name_table, "name", 0 }, ++ { (void **)&head_table, "head", 0 }, ++ { (void **)&hhea_table, "hhea", 0 }, ++ { (void **)&post_table, "post", 0 }, ++ { (void **)&glyf_start, "glyf", 0 }, ++ { (void **)&cmap_table, "cmap", 0 }, ++ { (void **)&kern_table, "kern", 1 }, ++ { (void **)&maxp_table, "maxp", 0 }, ++ { (void **)&hmtx_table, "hmtx", 0 }, ++ { (void **)&long_loca_table, "loca", 0 }, ++ { NULL, "", 0 } /* end of table */ ++ }; ++ ++ if (stat(fname, &statbuf) == -1) { ++ fprintf(stderr, "**** Cannot access %s ****\n", fname); ++ exit(1); ++ } ++ if ((filebuffer = malloc(statbuf.st_size)) == NULL) { ++ fprintf(stderr, "**** Cannot malloc space for file ****\n"); ++ exit(1); ++ } ++ ++ filebuffer_end = filebuffer + statbuf.st_size; ++ ++ if ((ttf_file = fopen(fname, "rb")) == NULL) { ++ fprintf(stderr, "**** Cannot open file '%s'\n", fname); ++ exit(1); ++ } else { ++ WARNING_2 fprintf(stderr, "Processing file %s\n", fname); ++ } ++ ++ if (fread(filebuffer, 1, statbuf.st_size, ttf_file) != statbuf.st_size) { ++ fprintf(stderr, "**** Could not read whole file \n"); ++ exit(1); ++ } ++ fclose(ttf_file); ++ ++ directory = (TTF_DIRECTORY *) filebuffer; ++ ++ if (ntohl(directory->sfntVersion) != 0x00010000) { ++ fprintf(stderr, ++ "**** Unknown File Version number [%x], or not a TrueType file\n", ++ directory->sfntVersion); ++ exit(1); ++ } ++ ++ /* clear the tables */ ++ for(j=0; tables[j].tbpp != NULL; j++) ++ *(tables[j].tbpp) = NULL; ++ ++ dir_entry = &(directory->list); ++ ++ for (i = 0; i < ntohs(directory->numTables); i++) { ++ ++ for(j=0; tables[j].tbpp != NULL; j++) ++ if (memcmp(dir_entry->tag, tables[j].name, 4) == 0) { ++ *(tables[j].tbpp) = (void *) (filebuffer + ntohl(dir_entry->offset)); ++ break; ++ } ++ ++ if (memcmp(dir_entry->tag, "EBDT", 4) == 0 || ++ memcmp(dir_entry->tag, "EBLC", 4) == 0 || ++ memcmp(dir_entry->tag, "EBSC", 4) == 0) { ++ WARNING_1 fprintf(stderr, "Font contains bitmaps\n"); ++ } ++ dir_entry++; ++ } ++ ++ for(j=0; tables[j].tbpp != NULL; j++) ++ if(!tables[j].optional && badpointer( *(tables[j].tbpp) )) { ++ fprintf(stderr, "**** File contains no required table '%s'\n", tables[j].name); ++ exit(1); ++ } ++ ++ handle_name(); ++ ++ handle_head(); ++ ++ ttf_nglyphs = ntohs(maxp_table->numGlyphs); ++ ++ enc_found_ms = enc_found_mac = 0; ++} ++ ++/* ++ * Close font. ++ * Exit on error. ++ */ ++ ++static void ++closefont( ++ void ++) ++{ ++ return; /* empty operation */ ++} ++ ++/* ++ * Get the number of glyphs in font. ++ */ ++ ++static int ++getnglyphs ( ++ void ++) ++{ ++ return ttf_nglyphs; ++} ++ ++/* ++ * Get the names of the glyphs. ++ * Returns 0 if the names were assigned, non-zero if the font ++ * provides no glyph names. ++ */ ++ ++static int ++glnames( ++ GLYPH *glyph_list ++) ++{ ++ int i, len, n, npost; ++ unsigned int format; ++ USHORT *name_index; ++ char *ptr, *p; ++ char **ps_name_ptr = (char **) malloc(ttf_nglyphs * sizeof(char *)); ++ int n_ps_names; ++ int ps_fmt_3 = 0; ++ ++ format = ntohl(post_table->formatType); ++ ++ if (format == 0x00010000) { ++ for (i = 0; i < 258 && i < ttf_nglyphs; i++) { ++ glyph_list[i].name = mac_glyph_names[i]; ++ } ++ } else if (format == 0x00020000) { ++ npost = ntohs(post_table->numGlyphs); ++ if (ttf_nglyphs != npost) { ++ /* This is an error in the font, but we can now cope */ ++ WARNING_1 fprintf(stderr, "**** Postscript table size mismatch %d/%d ****\n", ++ npost, ttf_nglyphs); ++ } ++ n_ps_names = 0; ++ name_index = &(post_table->glyphNameIndex); ++ ++ /* This checks the integrity of the post table */ ++ for (i=0; i n_ps_names + 257) { ++ n_ps_names = n - 257; ++ } ++ } ++ ++ ptr = (char *) post_table + 34 + (ttf_nglyphs << 1); ++ i = 0; ++ while (*ptr > 0 && i < n_ps_names) { ++ len = *ptr; ++ /* previously the program wrote nulls into the table. If the table ++ was corrupt, this could put zeroes anywhere, leading to obscure bugs, ++ so now I malloc space for the names. Yes it is much less efficient */ ++ ++ if ((p = malloc(len+1)) == NULL) { ++ fprintf (stderr, "****malloc failed %s line %d\n", __FILE__, __LINE__); ++ exit(255); ++ } ++ ++ ps_name_ptr[i] = p; ++ strncpy(p, ptr+1, len); ++ p[len] = '\0'; ++ i ++; ++ ptr += len + 1; ++ } ++ ++ if (i != n_ps_names) ++ { ++ WARNING_2 fprintf (stderr, "** Postscript Name mismatch %d != %d **\n", ++ i, n_ps_names); ++ n_ps_names = i; ++ } ++ ++ /* ++ * for (i=0; inumGlyphs); ++ for (i = 0; i < ttf_nglyphs; i++) { ++ glyph_list[i].name = mac_glyph_names[i + ptr[i]]; ++ } ++ } else { ++ fprintf(stderr, ++ "**** Postscript table in wrong format %x ****\n", ++ format); ++ exit(1); ++ } ++ ++ return ps_fmt_3; ++} ++ ++/* ++ * Get the metrics of the glyphs. ++ */ ++ ++static void ++glmetrics( ++ GLYPH *glyph_list ++) ++{ ++ int i; ++ int n_hmetrics = ntohs(hhea_table->numberOfHMetrics); ++ GLYPH *g; ++ LONGHORMETRIC *hmtx_entry = hmtx_table; ++ FWORD *lsblist; ++ ++ for (i = 0; i < n_hmetrics; i++) { ++ g = &(glyph_list[i]); ++ g->width = ntohs(hmtx_entry->advanceWidth); ++ g->lsb = ntohs(hmtx_entry->lsb); ++ hmtx_entry++; ++ } ++ ++ lsblist = (FWORD *) hmtx_entry; ++ hmtx_entry--; ++ ++ for (i = n_hmetrics; i < ttf_nglyphs; i++) { ++ g = &(glyph_list[i]); ++ g->width = ntohs(hmtx_entry->advanceWidth); ++ g->lsb = ntohs(lsblist[i - n_hmetrics]); ++ } ++ ++ for (i = 0; i < ttf_nglyphs; i++) { ++ g = &(glyph_list[i]); ++ get_glyf_table(i, &glyf_table, &g->ttf_pathlen); ++ ++ g->xMin = (short)ntohs(glyf_table->xMin); ++ g->xMax = (short)ntohs(glyf_table->xMax); ++ g->yMin = (short)ntohs(glyf_table->yMin); ++ g->yMax = (short)ntohs(glyf_table->yMax); ++ } ++ ++} ++ ++ ++static void ++handle_ms_encoding( ++ GLYPH *glyph_list, ++ int *encoding, ++ int *unimap ++) ++{ ++ int j, k, kk, set_ok; ++ USHORT start, end, ro; ++ short delta, n; ++ ++ for (j = 0; j < cmap_n_segs - 1; j++) { ++ start = ntohs(cmap_seg_start[j]); ++ end = ntohs(cmap_seg_end[j]); ++ delta = ntohs(cmap_idDelta[j]); ++ ro = ntohs(cmap_idRangeOffset[j]); ++ ++ for (k = start; k <= end; k++) { ++ if (ro == 0) { ++ n = k + delta; ++ } else { ++ n = ntohs(*((ro >> 1) + (k - start) + ++ &(cmap_idRangeOffset[j]))); ++ if (delta != 0) ++ { ++ /* Not exactly sure how to deal with this circumstance, ++ I suspect it never occurs */ ++ n += delta; ++ fprintf (stderr, ++ "rangeoffset and delta both non-zero - %d/%d", ++ ro, delta); ++ } ++ } ++ if(n<0 || n>=ttf_nglyphs) { ++ WARNING_1 fprintf(stderr, "Font contains a broken glyph code mapping, ignored\n"); ++ continue; ++ } ++ if (glyph_list[n].orig_code != -1) { ++#if 0 ++ if (strcmp(glyph_list[n].name, ".notdef") != 0) { ++ WARNING_2 fprintf(stderr, ++ "Glyph %s has >= two encodings (A), %4.4x & %4.4x\n", ++ glyph_list[n].name, ++ glyph_list[n].orig_code, ++ k); ++ } ++#endif ++ set_ok = 0; ++ } else { ++ set_ok = 1; ++ } ++ if (enc_type==1 || forcemap) { ++ kk = unicode_rev_lookup(k); ++ if(ISDBG(UNICODE)) ++ fprintf(stderr, "Unicode %s - 0x%04x\n",glyph_list[n].name,k); ++ if (set_ok) { ++ glyph_list[n].orig_code = k; ++ /* glyph_list[n].char_no = kk; */ ++ } ++ if (kk >= 0 && kk < ENCTABSZ && encoding[kk] == -1) ++ encoding[kk] = n; ++ } else { ++ if ((k & 0xff00) == 0xf000) { ++ if( encoding[k & 0x00ff] == -1 ) { ++ encoding[k & 0x00ff] = n; ++ if (set_ok) { ++ /* glyph_list[n].char_no = k & 0x00ff; */ ++ glyph_list[n].orig_code = k; ++ } ++ } ++ } else { ++ if (set_ok) { ++ /* glyph_list[n].char_no = k; */ ++ glyph_list[n].orig_code = k; ++ } ++ WARNING_2 fprintf(stderr, ++ "Glyph %s has non-symbol encoding %4.4x\n", ++ glyph_list[n].name, ++ k & 0xffff); ++ /* ++ * just use the code ++ * as it is ++ */ ++ if ((k & ~0xff) == 0 && encoding[k] == -1 ) ++ encoding[k] = n; ++ } ++ } ++ } ++ } ++} ++ ++static void ++handle_mac_encoding( ++ GLYPH *glyph_list, ++ int *encoding, ++ int *unimap ++) ++{ ++ short n; ++ int j, size; ++ ++ size = ntohs(encoding0->length) - 6; ++ for (j = 0; j < size; j++) { ++ n = encoding0->glyphIdArray[j]; ++ if (glyph_list[n].char_no != -1) { ++ WARNING_2 fprintf(stderr, ++ "Glyph %s has >= two encodings (B), %4.4x & %4.4x\n", ++ glyph_list[n].name, ++ glyph_list[n].char_no, ++ j); ++ } else { ++ if (j < ENCTABSZ) { ++ if(encoding[j] == -1) { ++ glyph_list[n].char_no = j; ++ encoding[j] = n; ++ } ++ } ++ } ++ } ++} ++ ++/* ++ * Get the original encoding of the font. ++ * Returns 1 for if the original encoding is Unicode, 2 if the ++ * original encoding is other 16-bit, 0 if 8-bit. ++ */ ++ ++static int ++glenc( ++ GLYPH *glyph_list, ++ int *encoding, ++ int *unimap ++) ++{ ++ int num_tables = ntohs(cmap_table->numberOfEncodingTables); ++ BYTE *ptr; ++ int i, format, offset, seg_c2, found; ++ int platform, encoding_id; ++ TTF_CMAP_ENTRY *table_entry; ++ TTF_CMAP_FMT4 *encoding4; ++ ++ if(enc_found_ms) { ++ handle_ms_encoding(glyph_list, encoding, unimap); ++ return enc_type; ++ } else if(enc_found_mac) { ++ handle_mac_encoding(glyph_list, encoding, unimap); ++ return 0; ++ } ++ ++ if(force_pid != -1 && force_pid != 3) { ++ fputs("*** Only platform ID == 3 is supported\n", stderr); ++ exit(1); ++ } ++ ++ enc_type = 0; ++ found = 0; ++ ++ for (i = 0; i < num_tables && !found; i++) { ++ table_entry = &(cmap_table->encodingTable[i]); ++ offset = ntohl(table_entry->offset); ++ encoding4 = (TTF_CMAP_FMT4 *) ((BYTE *) cmap_table + offset); ++ format = ntohs(encoding4->format); ++ platform = ntohs(table_entry->platformID); ++ encoding_id = ntohs(table_entry->encodingID); ++ ++ if (platform == 3 && format == 4) { ++ if(force_pid == 3) { ++ if(encoding_id != force_eid) ++ continue; ++ WARNING_1 fprintf(stderr, "Found Encoding PID=%d/EID=%d\n", ++ force_pid, force_eid); ++ enc_type = 1; ++ } else { ++ switch (encoding_id) { ++ case 0: ++ WARNING_1 fputs("Found Symbol Encoding\n", stderr); ++ break; ++ case 1: ++ WARNING_1 fputs("Found Unicode Encoding\n", stderr); ++ enc_type = 1; ++ break; ++ default: ++ WARNING_1 { ++ fprintf(stderr, ++ "****MS Encoding ID %d not supported****\n", ++ encoding_id); ++ fputs("Treating it like Symbol encoding\n", stderr); ++ } ++ break; ++ } ++ } ++ ++ found = 1; ++ seg_c2 = ntohs(encoding4->segCountX2); ++ cmap_n_segs = seg_c2 >> 1; ++ ptr = (BYTE *) encoding4 + 14; ++ cmap_seg_end = (USHORT *) ptr; ++ cmap_seg_start = (USHORT *) (ptr + seg_c2 + 2); ++ cmap_idDelta = (short *) (ptr + (seg_c2 * 2) + 2); ++ cmap_idRangeOffset = (short *) (ptr + (seg_c2 * 3) + 2); ++ enc_found_ms = 1; ++ ++ handle_ms_encoding(glyph_list, encoding, unimap); ++ } ++ } ++ ++ if (!found) { ++ if(force_pid != -1) { ++ fprintf(stderr, "*** TTF encoding table PID=%d/EID=%d not found\n", ++ force_pid, force_eid); ++ exit(1); ++ } ++ ++ WARNING_1 fputs("No Microsoft encoding, looking for MAC encoding\n", stderr); ++ for (i = 0; i < num_tables && !found; i++) { ++ table_entry = &(cmap_table->encodingTable[i]); ++ offset = ntohl(table_entry->offset); ++ encoding0 = (TTF_CMAP_FMT0 *) ((BYTE *) cmap_table + offset); ++ format = ntohs(encoding0->format); ++ platform = ntohs(table_entry->platformID); ++ encoding_id = ntohs(table_entry->encodingID); ++ ++ if (format == 0) { ++ found = 1; ++ enc_found_mac = 1; ++ ++ handle_mac_encoding(glyph_list, encoding, unimap); ++ } ++ } ++ } ++ if (!found) { ++ fprintf(stderr, "**** No Recognised Encoding Table ****\n"); ++ exit(1); ++ } ++ ++ return enc_type; ++} ++ ++/* ++ * Get the font metrics ++ */ ++static void ++fnmetrics( ++ struct font_metrics *fm ++) ++{ ++ char *str; ++ static int fieldstocheck[]= {2,4,6}; ++ int i, j, len; ++ ++ fm->italic_angle = (short) (ntohs(post_table->italicAngle.upper)) + ++ ((short) ntohs(post_table->italicAngle.lower) / 65536.0); ++ fm->underline_position = (short) ntohs(post_table->underlinePosition); ++ fm->underline_thickness = (short) ntohs(post_table->underlineThickness); ++ fm->is_fixed_pitch = ntohl(post_table->isFixedPitch); ++ ++ fm->ascender = (short)ntohs(hhea_table->ascender); ++ fm->descender = (short)ntohs(hhea_table->descender); ++ ++ fm->units_per_em = ntohs(head_table->unitsPerEm); ++ ++ fm->bbox[0] = (short) ntohs(head_table->xMin); ++ fm->bbox[1] = (short) ntohs(head_table->yMin); ++ fm->bbox[2] = (short) ntohs(head_table->xMax); ++ fm->bbox[3] = (short) ntohs(head_table->yMax); ++ ++ fm->name_copyright = name_fields[0]; ++ fm->name_family = name_fields[1]; ++ fm->name_style = name_fields[2]; ++ fm->name_full = name_fields[4]; ++ fm->name_version = name_fields[5]; ++ fm->name_ps = name_fields[6]; ++ ++ /* guess the boldness from the font names */ ++ fm->force_bold=0; ++ ++ for(i=0; !fm->force_bold && i= len || !islower(str[j+4])) ++ ) { ++ fm->force_bold=1; ++ break; ++ } ++ } ++ } ++} ++ ++/* ++ * Get the path of contrours for a glyph. ++ */ ++ ++static void ++glpath( ++ int glyphno, ++ GLYPH *glyf_list ++) ++{ ++ double matrix[6]; ++ GLYPH *g; ++ ++ g = &glyph_list[glyphno]; ++ ++ matrix[0] = matrix[3] = 1.0; ++ matrix[1] = matrix[2] = matrix[4] = matrix[5] = 0.0; ++ draw_composite_glyf(g, glyf_list, glyphno, matrix, 0 /*level*/); ++} ++ ++/* ++ * Get the kerning data. ++ */ ++ ++static void ++kerning( ++ GLYPH *glyph_list ++) ++{ ++ TTF_KERN_SUB *subtable; ++ TTF_KERN_ENTRY *kern_entry; ++ int i, j; ++ int ntables; ++ int npairs; ++ char *ptr; ++ ++ if(kern_table == NULL) { ++ WARNING_1 fputs("No Kerning data\n", stderr); ++ return; ++ } ++ if(badpointer(kern_table)) { ++ fputs("**** Defective Kerning table, ignored\n", stderr); ++ return; ++ } ++ ++ ntables = ntohs(kern_table->nTables); ++ ptr = (char *) kern_table + 4; ++ ++ for (i = 0; i < ntables; i++) { ++ subtable = (TTF_KERN_SUB *) ptr; ++ if ((ntohs(subtable->coverage) & 0xff00) == 0) { ++ npairs = (short) ntohs(subtable->nPairs); ++ kern_entry = (TTF_KERN_ENTRY *) (ptr + sizeof(TTF_KERN_SUB)); ++ ++ kern_entry = (TTF_KERN_ENTRY *) (ptr + sizeof(TTF_KERN_SUB)); ++ for (j = 0; j < npairs; j++) { ++ if( kern_entry->value != 0) ++ addkernpair(ntohs(kern_entry->left), ++ ntohs(kern_entry->right), (short)ntohs(kern_entry->value)); ++ kern_entry++; ++ } ++ } ++ ptr += subtable->length; ++ } ++} ++ +diff -ruN xserver-old/hw/xprint/extras/ttf2pt1/ttf.h xserver/hw/xprint/extras/ttf2pt1/ttf.h +--- xserver-old/hw/xprint/extras/ttf2pt1/ttf.h 1970-01-01 10:00:00.000000000 +1000 ++++ xserver/hw/xprint/extras/ttf2pt1/ttf.h 2006-06-27 13:10:26.000000000 +1000 +@@ -0,0 +1,183 @@ ++/* ++ * see COPYRIGHT ++ */ ++ ++/* these definitions are mostly taken from Microsoft's True Type ++ documentation. ++*/ ++ ++#ifdef XP_PSTEXT ++typedef unsigned char BYTE; ++typedef signed char CHAR; ++typedef unsigned short USHORT; ++typedef signed short SHORT; ++typedef unsigned int ULONG; ++typedef signed int LONG; ++typedef SHORT FWORD; ++typedef USHORT UFWORD; ++#else ++#define BYTE unsigned char ++#define CHAR signed char ++#define USHORT unsigned short ++#define SHORT signed short ++#define ULONG unsigned int ++#define LONG signed int ++#define FWORD SHORT ++#define UFWORD USHORT ++#endif /* XP_PSTEXT */ ++ ++#define ONOROFF 0x01 ++#define XSHORT 0x02 ++#define YSHORT 0x04 ++#define REPEAT 0x08 ++#define XSAME 0x10 ++#define YSAME 0x20 ++ ++#define ARG_1_AND_2_ARE_WORDS 0x0001 ++#define ARGS_ARE_XY_VALUES 0x0002 ++#define XY_BOUND_TO_GRID 0x0004 ++#define WE_HAVE_A_SCALE 0x0008 ++#define MORE_COMPONENTS 0x0020 ++#define WE_HAVE_AN_X_AND_Y_SCALE 0x0040 ++#define WE_HAVE_A_TWO_BY_TWO 0x0080 ++#define WE_HAVE_INSTRUCTIONS 0x0100 ++#define USE_MY_METRICS 0x0200 ++ ++typedef struct short_2 { ++ SHORT upper; ++ USHORT lower; ++} FIXED ; ++ ++typedef struct longhormetric { ++ UFWORD advanceWidth; ++ FWORD lsb; ++} LONGHORMETRIC; ++ ++typedef struct ttf_hhea { ++ BYTE version[4]; ++ SHORT ascender, descender, lineGap; ++ USHORT advnaceWidthMax; ++ SHORT minLSB, minRSB, xMaxExtent; ++ SHORT caretSlopeRise, caretSlopeRun; ++ SHORT reserved[5]; ++ SHORT metricDataFormat; ++ USHORT numberOfHMetrics; ++} TTF_HHEA; ++ ++typedef struct ttf_dir_entry { ++ char tag[4]; ++ ULONG checksum; ++ ULONG offset; ++ ULONG length; ++} TTF_DIR_ENTRY ; ++ ++typedef struct ttf_directory { ++ ULONG sfntVersion; ++ USHORT numTables; ++ USHORT searchRange; ++ USHORT entrySelector; ++ USHORT rangeShift; ++ TTF_DIR_ENTRY list; ++} TTF_DIRECTORY ; ++ ++typedef struct ttf_name_rec { ++ USHORT platformID; ++ USHORT encodingID; ++ USHORT languageID; ++ USHORT nameID; ++ USHORT stringLength; ++ USHORT stringOffset; ++} TTF_NAME_REC; ++ ++typedef struct ttf_name { ++ USHORT format; ++ USHORT numberOfNameRecords; ++ USHORT offset; ++ TTF_NAME_REC nameRecords; ++} TTF_NAME ; ++ ++typedef struct ttf_head { ++ ULONG version; ++ ULONG fontRevision; ++ ULONG checksumAdjust; ++ ULONG magicNo; ++ USHORT flags; ++ USHORT unitsPerEm; ++ BYTE created[8]; ++ BYTE modified[8]; ++ FWORD xMin, yMin, xMax, yMax; ++ USHORT macStyle, lowestRecPPEM; ++ SHORT fontDirection, indexToLocFormat, glyphDataFormat; ++} TTF_HEAD ; ++ ++typedef struct ttf_kern { ++ USHORT version, nTables; ++} TTF_KERN ; ++ ++typedef struct ttf_kern_sub { ++ USHORT version, length, coverage; ++ USHORT nPairs, searchRange, entrySelector, rangeShift; ++} TTF_KERN_SUB; ++ ++typedef struct ttf_kern_entry { ++ USHORT left, right; ++ FWORD value; ++} TTF_KERN_ENTRY; ++ ++typedef struct ttf_cmap_fmt0 { ++ USHORT format; ++ USHORT length; ++ USHORT version; ++ BYTE glyphIdArray[256]; ++} TTF_CMAP_FMT0; ++ ++typedef struct ttf_cmap_fmt4 { ++ USHORT format; ++ USHORT length; ++ USHORT version; ++ USHORT segCountX2; ++ USHORT searchRange; ++ USHORT entrySelector; ++ USHORT rangeShift; ++} TTF_CMAP_FMT4; ++ ++typedef struct ttf_cmap_entry { ++ USHORT platformID; ++ USHORT encodingID; ++ ULONG offset; ++} TTF_CMAP_ENTRY; ++ ++typedef struct ttf_cmap { ++ USHORT version; ++ USHORT numberOfEncodingTables; ++ TTF_CMAP_ENTRY encodingTable[1]; ++} TTF_CMAP ; ++ ++typedef struct ttf_glyf { ++ SHORT numberOfContours; ++ FWORD xMin, yMin, xMax, yMax; ++} TTF_GLYF ; ++ ++typedef struct ttf_maxp { ++ ULONG version; ++ USHORT numGlyphs, maxPoints, maxContours; ++ USHORT maxCompositePoints, maxCompositeContours; ++ USHORT maxZones, maxTwilightPoints, maxStorage; ++ USHORT maxFunctionDefs, maxInstructionsDefs; ++ USHORT maxSizeOfInstructions, maxComponentElements; ++ USHORT maxComponentDepth; ++} TTF_MAXP ; ++ ++typedef struct ttf_post_head { ++ ULONG formatType; ++ FIXED italicAngle; ++ FWORD underlinePosition; ++ FWORD underlineThickness; ++ ULONG isFixedPitch; ++ ULONG minMemType42; ++ ULONG maxMemType42; ++ ULONG minMemType1; ++ ULONG maxMemType1; ++ USHORT numGlyphs; ++ USHORT glyphNameIndex; ++} TTF_POST_HEAD ; +diff -ruN xserver-old/hw/xprint/extras/ttf2pt1/version.h xserver/hw/xprint/extras/ttf2pt1/version.h +--- xserver-old/hw/xprint/extras/ttf2pt1/version.h 1970-01-01 10:00:00.000000000 +1000 ++++ xserver/hw/xprint/extras/ttf2pt1/version.h 2006-06-27 13:10:26.000000000 +1000 +@@ -0,0 +1,7 @@ ++/* ++ * see COPYRIGHT ++ */ ++ ++ ++/* version number */ ++#define TTF2PT1_VERSION "3.4.4-SNAP-030526" +diff -ruN xserver-old/hw/xprint/extras/ttf2pt1/winbuild.bat xserver/hw/xprint/extras/ttf2pt1/winbuild.bat +--- xserver-old/hw/xprint/extras/ttf2pt1/winbuild.bat 1970-01-01 10:00:00.000000000 +1000 ++++ xserver/hw/xprint/extras/ttf2pt1/winbuild.bat 2006-06-27 13:10:26.000000000 +1000 +@@ -0,0 +1,11 @@ ++rem file to build ttf2pt1 with Visual C++ ++ ++cl -DWINDOWS -c bdf.c ++cl -DWINDOWS -c ttf2pt1.c ++cl -DWINDOWS -c pt1.c ++cl -DWINDOWS -c ttf.c ++cl -DWINDOWS -c t1asm.c ++cl -DWINDOWS -c bitmap.c ++cl -o ttf2pt1 ttf2pt1.obj pt1.obj t1asm.obj ttf.obj bdf.obj bitmap.obj ++cl -o t1asm -DWINDOWS -DSTANDALONE t1asm.c ++ +diff -ruN xserver-old/hw/xprint/extras/ttf2pt1/windows.h xserver/hw/xprint/extras/ttf2pt1/windows.h +--- xserver-old/hw/xprint/extras/ttf2pt1/windows.h 1970-01-01 10:00:00.000000000 +1000 ++++ xserver/hw/xprint/extras/ttf2pt1/windows.h 2006-06-27 13:10:26.000000000 +1000 +@@ -0,0 +1,93 @@ ++/* ++ * Implementation of things missing in Windows ++ */ ++ ++#ifndef M_PI ++#define M_PI 3.14159265358979323846 ++#endif ++ ++#undef ntohs ++#undef ntohl ++#undef htonl ++ ++#ifdef WINDOWS_FUNCTIONS ++/* byte order */ ++ ++static unsigned short StoM(unsigned short inv) { ++ union iconv { ++ unsigned short ui; ++ unsigned char uc[2]; ++ } *inp, outv; ++ ++ inp = (union iconv *)&inv; ++ ++ outv.uc[0] = inp->uc[1]; ++ outv.uc[1] = inp->uc[0]; ++ ++ return (outv.ui); ++} ++ ++static unsigned int ItoM(unsigned int inv) { ++ union iconv { ++ unsigned int ui; ++ unsigned char uc[4]; ++ } *inp, outv; ++ ++ inp = (union iconv *)&inv; ++ ++ outv.uc[0] = inp->uc[3]; ++ outv.uc[1] = inp->uc[2]; ++ outv.uc[2] = inp->uc[1]; ++ outv.uc[3] = inp->uc[0]; ++ ++ return (outv.ui); ++} ++ ++unsigned short ntohs(unsigned short inv) { return StoM(inv); } ++unsigned long ntohl(unsigned long inv) { return ItoM(inv); } ++unsigned long htonl(unsigned long inv) { return ItoM(inv); } ++ ++char *optarg; ++int optind=1; ++ ++char getopt(int argc, char **argv, char *args) { ++ int n,nlen=strlen(args),nLen=0; ++ char nCmd; ++ ++ if (argv[optind] && *argv[optind]=='-') { ++ nCmd=*((argv[optind]+1)); ++ ++ for (n=0;n Xprinters.ghostscript ++ sed < $(srcdir)/Xprinters "s/#Printer xp_pdf_spooldir_HOME_Xprintjobs/Printer xp_pdf_spooldir_HOME_Xprintjobs/" > Xprinters.ghostscript + + + +diff -ruN xorg-server-old/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/model-config xorg-server/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/model-config +--- xorg-server-old/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/model-config 2004-04-24 04:52:27.000000000 +1000 ++++ xorg-server/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/model-config 2006-04-14 21:50:19.000000000 +1000 +@@ -20,7 +20,7 @@ + # + # Attributes supported for this printer model + *content-orientations-supported: portrait landscape reverse-portrait reverse-landscape +-*descriptor: PDF job spool dir /tmp/Xprintjobs ++*descriptor: PDF job spool dir $HOME/Xprintjobs + *document-formats-supported: {POSTSCRIPT 2} + *input-trays-supported: + *medium-source-sizes-supported: \ +@@ -45,7 +45,7 @@ + } + + *plexes-supported: simplex duplex tumble +-*printer-model: "PDF job spool dir /tmp/Xprintjobs" ++*printer-model: "PDF job spool dir $HOME/Xprintjobs" + # 75, 100, 120, 150, 180, 200, 240, 300, 360, 400, 600, 720, + # 940, 1200 and 2440 are supported DPI values, we limit it here + # to some common values: +@@ -60,7 +60,7 @@ + # Note that "%xpconfigdir%" is currently only supported in Xprt servers build + # from xprint.mozdev.org sources, other platforms have replace it with the + # absolute path name to the script +-*xp-spooler-command: %xpconfigdir%/C/print/models/PS2PDFspooldir-GS/ps2pdf_spooltodir.sh -d /tmp/Xprintjobs -s .pdf -u 077 -p %printer-name% -c %copy-count% -t %job-name% -o "%options%" ++*xp-spooler-command: %xpconfigdir%/C/print/models/PS2PDFspooldir-GS/ps2pdf_spooltodir.sh -s .pdf -u 077 -p %printer-name% -c %copy-count% -t %job-name% -o "%options%" + + # NOTE: xp-psddx-* attributes are EXPERIMENTAL for now. + # xp-psddx-download-fonts defines which fonts should be downloaded as outlines +diff -ruN xorg-server-old/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/ps2pdf_spooltodir.sh xorg-server/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/ps2pdf_spooltodir.sh +--- xorg-server-old/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/ps2pdf_spooltodir.sh 2004-04-24 04:52:27.000000000 +1000 ++++ xorg-server/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/ps2pdf_spooltodir.sh 2006-04-14 21:53:19.000000000 +1000 +@@ -3,7 +3,7 @@ + export PATH + + verbose_msgs="false" +-DEFAULT_SPOOLDIR=/tmp/Xprintjobs ++DEFAULT_SPOOLDIR=`perl -e '@x = getpwuid($>); print $x[7]'`/Xprintjobs + + usage() + { +@@ -74,7 +74,6 @@ + + if [ ! -d "${DEFAULT_SPOOLDIR}" ] ; then + mkdir "${DEFAULT_SPOOLDIR}" +- chmod a+rwxt "${DEFAULT_SPOOLDIR}" + fi + + if [ "${permmask}" != "" ] ; then +diff -ruN xorg-server-old/hw/xprint/config/C/print/models/PSspooldir/model-config xorg-server/hw/xprint/config/C/print/models/PSspooldir/model-config +--- xorg-server-old/hw/xprint/config/C/print/models/PSspooldir/model-config 2004-04-24 04:54:16.000000000 +1000 ++++ xorg-server/hw/xprint/config/C/print/models/PSspooldir/model-config 2006-04-14 21:57:02.000000000 +1000 +@@ -19,7 +19,7 @@ + # + # Attributes supported for this printer model + *content-orientations-supported: portrait landscape reverse-portrait reverse-landscape +-*descriptor: PostScript job spool dir /tmp/Xprintjobs ++*descriptor: PostScript job spool dir $HOME/Xprintjobs + *document-formats-supported: {POSTSCRIPT 2} + *input-trays-supported: + *medium-source-sizes-supported: \ +@@ -44,7 +44,7 @@ + } + + *plexes-supported: simplex duplex tumble +-*printer-model: "PostScript job spool dir /tmp/Xprintjobs" ++*printer-model: "PostScript job spool dir $HOME/Xprintjobs" + # 75, 100, 120, 150, 180, 200, 240, 300, 360, 400, 600, 720, + # 940, 1200 and 2440 are supported DPI values, we limit it here + # to some common values: +@@ -59,7 +59,7 @@ + # Note that "%xpconfigdir%" is currently only supported in Xprt servers build + # from xprint.mozdev.org sources, other platforms have replace it with the + # absolute path name to the script +-*xp-spooler-command: %xpconfigdir%/C/print/models/PSspooldir/spooltodir.sh -d /tmp/Xprintjobs -s .ps -u 077 -p %printer-name% -c %copy-count% -t %job-name% -o "%options%" ++*xp-spooler-command: %xpconfigdir%/C/print/models/PSspooldir/spooltodir.sh -s .ps -u 077 -p %printer-name% -c %copy-count% -t %job-name% -o "%options%" + + # NOTE: xp-psddx-* attributes are EXPERIMENTAL for now. + # xp-psddx-download-fonts defines which fonts should be downloaded as outlines +diff -ruN xorg-server-old/hw/xprint/config/C/print/models/PSspooldir/spooltodir.sh xorg-server/hw/xprint/config/C/print/models/PSspooldir/spooltodir.sh +--- xorg-server-old/hw/xprint/config/C/print/models/PSspooldir/spooltodir.sh 2004-04-24 04:54:16.000000000 +1000 ++++ xorg-server/hw/xprint/config/C/print/models/PSspooldir/spooltodir.sh 2006-04-14 21:58:06.000000000 +1000 +@@ -3,7 +3,7 @@ + export PATH + + verbose_msgs="false" +-DEFAULT_SPOOLDIR=/tmp/Xprintjobs ++DEFAULT_SPOOLDIR=`perl -e '@x = getpwuid($>); print $x[7]'`/Xprintjobs + + usage() + { +@@ -74,7 +74,6 @@ + + if [ ! -d "${DEFAULT_SPOOLDIR}" ] ; then + mkdir "${DEFAULT_SPOOLDIR}" +- chmod a+rwxt "${DEFAULT_SPOOLDIR}" + fi + + if [ "${permmask}" != "" ] ; then +diff -ruN xorg-server-old/hw/xprint/config/C/print/Xprinters xorg-server/hw/xprint/config/C/print/Xprinters +--- xorg-server-old/hw/xprint/config/C/print/Xprinters 2004-04-24 04:46:31.000000000 +1000 ++++ xorg-server/hw/xprint/config/C/print/Xprinters 2006-04-14 22:04:56.000000000 +1000 +@@ -30,10 +30,10 @@ + + ######################################################################## + # Preconfigured entry for the PSspooldir model +-# (which sends jobs to /tmp/Xprintjobs instead to a physical printer) ++# (which sends jobs to $HOME/Xprintjobs instead to a physical printer) + ######################################################################## +-#Printer xp_pdf_spooldir_tmp_Xprintjobs +-Printer xp_ps_spooldir_tmp_Xprintjobs ++#Printer xp_pdf_spooldir_HOME_Xprintjobs ++Printer xp_ps_spooldir_HOME_Xprintjobs + + ######################################################################## + # Add individual printers to the list of printers managed by the --- xorg-server-1.4.2.orig/debian/patches/91_ttf2pt1_updates +++ xorg-server-1.4.2/debian/patches/91_ttf2pt1_updates @@ -0,0 +1,39 @@ +diff -ruN xserver-old/hw/xprint/extras/ttf2pt1/ft.c xorg-server/hw/xprint/extras/ttf2pt1/ft.c +--- xorg-server-old/hw/xprint/extras/ttf2pt1/ft.c 2006-06-27 13:14:02.000000000 +1000 ++++ xorg-server/hw/xprint/extras/ttf2pt1/ft.c 2006-06-27 13:18:56.000000000 +1000 +@@ -36,15 +36,15 @@ + + #ifdef XP_PSTEXT + #include "os.h" +-#include "Xproto.h" +-#include "font.h" +-#include "fontstruct.h" +-#include "fntfilst.h" +-#include "fontutil.h" +-#include "fontenc.h" +-#include "ft.h" ++#include ++#include ++#include ++#include ++#include ++#include ++#include + #define NOT_IN_FTFUNCS +-#include "ftfuncs.h" ++#include + #endif /* XP_PSTEXT */ + + #include "pt1.h" +diff -ruN xorg-server-old/hw/xprint/extras/ttf2pt1/ttf2pt1.c xorg-server/hw/xprint/extras/ttf2pt1/ttf2pt1.c +--- xorg-server-old/hw/xprint/extras/ttf2pt1/ttf2pt1.c 2006-06-27 13:14:02.000000000 +1000 ++++ xorg-server/hw/xprint/extras/ttf2pt1/ttf2pt1.c 2006-06-27 13:15:49.000000000 +1000 +@@ -1698,7 +1698,7 @@ + + #ifdef XP_PSTEXT + FT_Face xp_pstext_ft_face = NULL; /* used by ft.c */ +-FontPtr xp_xtf = NULL; ++FTFontPtr xp_xtf = NULL; + const char *xp_psfontname = NULL; + unsigned long xp_font_block_offset = 0UL; + --- xorg-server-1.4.2.orig/debian/patches/10_dont_look_in_home_for_config.diff +++ xorg-server-1.4.2/debian/patches/10_dont_look_in_home_for_config.diff @@ -0,0 +1,12 @@ +Index: a/hw/xfree86/common/xf86Config.c +=================================================================== +--- a/hw/xfree86/common/xf86Config.c.orig 2007-08-16 22:47:18.000000000 -0400 ++++ b/hw/xfree86/common/xf86Config.c 2007-08-16 22:47:21.000000000 -0400 +@@ -92,7 +92,6 @@ + "/etc/X11/%R," "%P/etc/X11/%R," \ + "%E," "%F," \ + "/etc/X11/%F," "%P/etc/X11/%F," \ +- "%D/%X," \ + "/etc/X11/%X-%M," "/etc/X11/%X," "/etc/%X," \ + "%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \ + "%P/etc/X11/%X," \ --- xorg-server-1.4.2.orig/debian/patches/54_more-sanity-checks.diff +++ xorg-server-1.4.2/debian/patches/54_more-sanity-checks.diff @@ -0,0 +1,40 @@ +From 30c077f228f563e4e1f4115b345577d9fd393b68 Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Fri, 24 Oct 2008 15:06:49 +1030 +Subject: [PATCH] dix: extra sanity-checks against potential NULL-dereferences. #434807 + +Two minor code paths could potentially crash the server: +- if scr is NULL, we shouldn't try to dereference it. +- if GPE is called with buttons != 0 but the event is not a + ButtonPress or ButtonRelease, the button mapping may dereference a NULL + pointer. + +Admittedly the second should never happen, but better to guard against it. +--- + dix/getevents.c | 6 ++++++ + 1 files changed, 6 insertions(+), 0 deletions(-) + +Index: xorg-server/dix/getevents.c +=================================================================== +--- xorg-server.orig/dix/getevents.c ++++ xorg-server/dix/getevents.c +@@ -535,6 +535,9 @@ + ScreenPtr scr = miPointerGetScreen(pDev); + + /* Sanity checks. */ ++ if (!scr) ++ return 0; ++ + if (type != MotionNotify && type != ButtonPress && type != ButtonRelease) + return 0; + +@@ -546,6 +549,9 @@ + if (!pDev->valuator) + return 0; + ++ if (buttons && !pDev->button) ++ return 0; ++ + if (!coreOnly && pDev->coreEvents) + num_events = 2; + else --- xorg-server-1.4.2.orig/debian/patches/07_autoconfig_screen_with_device_section.diff +++ xorg-server-1.4.2/debian/patches/07_autoconfig_screen_with_device_section.diff @@ -0,0 +1,27 @@ +Index: xorg-server/hw/xfree86/common/xf86Config.c +=================================================================== +--- xorg-server.orig/hw/xfree86/common/xf86Config.c 2007-09-27 22:18:22.000000000 -0400 ++++ xorg-server/hw/xfree86/common/xf86Config.c 2007-09-27 22:20:32.000000000 -0400 +@@ -1927,11 +1927,20 @@ + 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 (configDevice(screenp->device,conf_screen->scrn_device, TRUE)) ++ if ((!conf_screen->scrn_device) && (xf86configptr->conf_device_lst)) { ++ conf_screen->scrn_device = xf86configptr->conf_device_lst; ++ 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)) { + screenp->device->myScreenSection = screenp; +- else ++ } else { + screenp->device = NULL; ++ } + screenp->options = conf_screen->scrn_option_lst; + + /* --- xorg-server-1.4.2.orig/debian/patches/93_xprint_fonts_fix +++ xorg-server-1.4.2/debian/patches/93_xprint_fonts_fix @@ -0,0 +1,12 @@ +diff -ruN xorg-server-old/hw/xprint/ps/psout_ft.c xorg-server/hw/xprint/ps/psout_ft.c +--- xorg-server-old/hw/xprint/ps/psout_ft.c 2006-04-02 10:09:43.000000000 +1000 ++++ xorg-server/hw/xprint/ps/psout_ft.c 2006-04-14 22:22:42.000000000 +1000 +@@ -280,6 +280,8 @@ + else + { + sprintf(buf, "%s", baseFontName); ++ xfree(self->FontName); ++ self->FontName = NULL; + } + + if( self->FontSize == -1 ) --- xorg-server-1.4.2.orig/debian/patches/16_X86EMU-pass-the-correct-bus-dev-fn-tag-to-pci-emula.patch +++ xorg-server-1.4.2/debian/patches/16_X86EMU-pass-the-correct-bus-dev-fn-tag-to-pci-emula.patch @@ -0,0 +1,96 @@ +From 9c17439807c80876bf7027b17859714b31401ab9 Mon Sep 17 00:00:00 2001 +From: Bart Trojanowski +Date: Fri, 11 Jan 2008 19:59:54 -0500 +Subject: [PATCH] X86EMU: pass the correct bus:dev:fn tag to pci emulation + +Signed-off-by: Bart Trojanowski + +Work funded by: Symbio Technologies + +There seems to be an inconsistency between what the x86emu gets from the +PCI handling code and by accessing hardware directly. x86emu relies on +a set of functions to emulate PCI access. When things goes wrong, the +emulator is asked to execute an OUT instruction on port 0x20. + +I've put together a patch against xserver-xorg package that prevents +accesses to BAD registers. This turns a freeze into a segfault in X. + +http://www.jukie.net/~bart/patches/xorg-server/20080111/0001-X86EMU-added-blacklist-for-I-O-port-in-0-0xFF-range.patch + +It does not address the DDC not working, I hope that after fixing the +bugs in x86emu, things may improve. + +Anyway, I am continuing to investigate the real cause of the PCI access +issue. To find out more read this thread: + +http://lists.freedesktop.org/archives/xorg/2008-January/031811.html + +-Bart + +diff -Nurp xorg-server-1.4.1~git20080118-patched/hw/xfree86/int10/helper_exec.c xorg-server-1.4.1~git20080118-working/hw/xfree86/int10/helper_exec.c +--- xorg-server-1.4.1~git20080118-patched/hw/xfree86/int10/helper_exec.c 2008-01-22 10:22:26.000000000 -0800 ++++ xorg-server-1.4.1~git20080118-working/hw/xfree86/int10/helper_exec.c 2008-01-22 11:00:52.000000000 -0800 +@@ -542,7 +542,8 @@ Mem_wl(CARD32 addr, CARD32 val) + + static CARD32 PciCfg1Addr = 0; + +-#define OFFSET(Cfg1Addr) (Cfg1Addr & 0xff) ++#define PCI_OFFSET(x) ((x) & 0x000000ff) ++#define PCI_TAG(x) ((x) & 0x00ffff00) + + static int + pciCfg1in(CARD16 addr, CARD32 *val) +@@ -552,7 +553,7 @@ pciCfg1in(CARD16 addr, CARD32 *val) + return 1; + } + if (addr == 0xCFC) { +- *val = pciReadLong(Int10Current->Tag, OFFSET(PciCfg1Addr)); ++ *val = pciReadLong(PCI_TAG(PciCfg1Addr), PCI_OFFSET(PciCfg1Addr)); + if (PRINT_PORT && DEBUG_IO_TRACE()) + ErrorF(" cfg_inl(%#x) = %8.8x\n", PciCfg1Addr, *val); + return 1; +@@ -570,7 +571,7 @@ pciCfg1out(CARD16 addr, CARD32 val) + if (addr == 0xCFC) { + if (PRINT_PORT && DEBUG_IO_TRACE()) + ErrorF(" cfg_outl(%#x, %8.8x)\n", PciCfg1Addr, val); +- pciWriteLong(Int10Current->Tag, OFFSET(PciCfg1Addr), val); ++ pciWriteLong(PCI_TAG(PciCfg1Addr), PCI_OFFSET(PciCfg1Addr), val); + return 1; + } + return 0; +@@ -588,7 +589,7 @@ pciCfg1inw(CARD16 addr, CARD16 *val) + } + if ((addr >= 0xCFC) && (addr <= 0xCFF)) { + offset = addr - 0xCFC; +- *val = pciReadWord(Int10Current->Tag, OFFSET(PciCfg1Addr) + offset); ++ *val = pciReadWord(PCI_TAG(PciCfg1Addr), PCI_OFFSET(PciCfg1Addr) + offset); + if (PRINT_PORT && DEBUG_IO_TRACE()) + ErrorF(" cfg_inw(%#x) = %4.4x\n", PciCfg1Addr + offset, *val); + return 1; +@@ -611,7 +612,7 @@ pciCfg1outw(CARD16 addr, CARD16 val) + offset = addr - 0xCFC; + if (PRINT_PORT && DEBUG_IO_TRACE()) + ErrorF(" cfg_outw(%#x, %4.4x)\n", PciCfg1Addr + offset, val); +- pciWriteWord(Int10Current->Tag, OFFSET(PciCfg1Addr) + offset, val); ++ pciWriteWord(PCI_TAG(PciCfg1Addr), PCI_OFFSET(PciCfg1Addr) + offset, val); + return 1; + } + return 0; +@@ -629,7 +630,7 @@ pciCfg1inb(CARD16 addr, CARD8 *val) + } + if ((addr >= 0xCFC) && (addr <= 0xCFF)) { + offset = addr - 0xCFC; +- *val = pciReadByte(Int10Current->Tag, OFFSET(PciCfg1Addr) + offset); ++ *val = pciReadByte(PCI_TAG(PciCfg1Addr), PCI_OFFSET(PciCfg1Addr) + offset); + if (PRINT_PORT && DEBUG_IO_TRACE()) + ErrorF(" cfg_inb(%#x) = %2.2x\n", PciCfg1Addr + offset, *val); + return 1; +@@ -652,7 +653,7 @@ pciCfg1outb(CARD16 addr, CARD8 val) + offset = addr - 0xCFC; + if (PRINT_PORT && DEBUG_IO_TRACE()) + ErrorF(" cfg_outb(%#x, %2.2x)\n", PciCfg1Addr + offset, val); +- pciWriteByte(Int10Current->Tag, OFFSET(PciCfg1Addr) + offset, val); ++ pciWriteByte(PCI_TAG(PciCfg1Addr), PCI_OFFSET(PciCfg1Addr) + offset, val); + return 1; + } + return 0; --- xorg-server-1.4.2.orig/debian/patches/001_ubuntu_add_extra_modelines_from_xorg.patch +++ xorg-server-1.4.2/debian/patches/001_ubuntu_add_extra_modelines_from_xorg.patch @@ -0,0 +1,63 @@ +--- foo/hw/xfree86/common/extramodes.orig 2005-03-28 14:40:18.784980424 +1000 ++++ bar/hw/xfree86/common/extramodes 2005-03-28 15:04:04.731203648 +1000 +@@ -7,27 +7,53 @@ + # 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 + ++# 1280x768 @ 60Hz (LCD native res) hsync: 47.70kHz ++ModeLine "1280x768" 80.14 1280 1344 1480 1680 768 769 772 795 ++ ++# 1280x800 @ 60Hz (LCD native res) hsync: 49.68kHz ++ModeLine "1280x800" 83.46 1280 1344 1480 1680 800 801 804 828 ++ + # 1152x768 @ 54.8Hz (Titanium PowerBook) hsync: 44.2kHz +-ModeLine "1152x768" 64.995 1152 1178 1314 1472 768 771 777 806 +hsync +vsync ++ModeLine "1152x768" 64.995 1152 1178 1314 1472 768 771 777 806 +hsync +vsync ++ ++# 1152x864 @ 85Hz (Red Hat custom modeline) ++ModeLine "1152x864" 121.5 1152 1216 1344 1568 864 865 868 911 +hsync -vsync + + # 1400x1050 @ 60Hz (VESA GTF) hsync: 65.5kHz + ModeLine "1400x1050" 122.0 1400 1488 1640 1880 1050 1052 1064 1082 +hsync +vsync + ++# 1400x1050 @ 70Hz (Red Hat custom modeline) hsync: 76.8kHz ++ModeLine "1400x1050" 151.0 1400 1464 1656 1960 1050 1051 1054 1100 +hsync +vsync ++ + # 1400x1050 @ 75Hz (VESA GTF) hsync: 82.2kHz + ModeLine "1400x1050" 155.8 1400 1464 1784 1912 1050 1052 1064 1090 +hsync +vsync + ++# 1400x1050 @ 85Hz (Red Hat custom modeline) hsync: 93.2 kHz ++ModeLine "1400x1050" 184.0 1400 1464 1656 1960 1050 1051 1054 1100 +hsync +vsync ++ ++# 1440x900 @ 100Hz (17" iMac LCD) hsync: 67 kHz ++ModeLine "1440x900" 108.84 1440 1472 1880 1912 900 918 927 946 +hsync +vsync ++ + # 1600x1024 @ 60Hz (SGI 1600SW) hsync: 64.0kHz +-Modeline "1600x1024" 106.910 1600 1620 1640 1670 1024 1027 1030 1067 -hsync -vsync ++ModeLine "1600x1024" 106.910 1600 1620 1640 1670 1024 1027 1030 1067 -hsync -vsync ++ ++# 1680x1050 @ 60Hz (LCD native res) hsync: 64.22kHz ++ModeLine "1680x1050" 147.14 1680 1784 1968 2256 1050 1051 1054 1087 ++ ++# 1920x1200 @ 60Hz (LCD native res) hsync: 74.52kHz ++ModeLine "1920x1200" 193.16 1920 2048 2256 2592 1200 1201 1204 1242 ++ ++# 1920x1200 @ 70Hz (Red Hat custom modeline - bugzilla #53364) hsync: 87.50 KHz ++ModeLine "1920x1200" 230.0 1920 1936 2096 2528 1200 1201 1204 1250 -HSync -VSync + + # 1920x1440 @ 85Hz (VESA GTF) hsync: 128.5kHz +-Modeline "1920x1440" 341.35 1920 2072 2288 2656 1440 1441 1444 1512 -hsync +vsync ++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 ++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 ++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 +- ++ModeLine "2048x1536" 388.04 2048 2216 2440 2832 1536 1537 1540 1612 -hsync +vsync --- xorg-server-1.4.2.orig/debian/patches/02_libvgahw_gcc4_volatile_fix.diff +++ xorg-server-1.4.2/debian/patches/02_libvgahw_gcc4_volatile_fix.diff @@ -0,0 +1,70 @@ +gcc4 has issues with libvgahw.a. This patch is a workaround stolen from +https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=161242 (by Olivier +Baudron). See also Debian #318218 and bugs merged to it + +Index: xorg-server/hw/xfree86/vgahw/vgaHW.c +=================================================================== +--- xorg-server.orig/hw/xfree86/vgahw/vgaHW.c 2006-11-26 01:24:48.000000000 +0100 ++++ xorg-server/hw/xfree86/vgahw/vgaHW.c 2006-11-26 01:25:44.000000000 +0100 +@@ -434,12 +434,16 @@ + static void + mmioWriteAttr(vgaHWPtr hwp, CARD8 index, CARD8 value) + { ++ volatile CARD8 tmp; ++ + if (hwp->paletteEnabled) + index &= ~0x20; + else + index |= 0x20; + +- (void) minb(hwp->IOBase + VGA_IN_STAT_1_OFFSET); ++ /* gcc-4.0 -O2 is broken : needs a volatile assignment */ ++ tmp = minb(hwp->IOBase + VGA_IN_STAT_1_OFFSET); ++ + moutb(VGA_ATTR_INDEX, index); + moutb(VGA_ATTR_DATA_W, value); + } +@@ -447,12 +451,16 @@ + static CARD8 + mmioReadAttr(vgaHWPtr hwp, CARD8 index) + { ++ volatile CARD8 tmp; ++ + if (hwp->paletteEnabled) + index &= ~0x20; + else + index |= 0x20; + +- (void) minb(hwp->IOBase + VGA_IN_STAT_1_OFFSET); ++ /* gcc-4.0 -O2 is broken : needs a volatile assignment */ ++ tmp = minb(hwp->IOBase + VGA_IN_STAT_1_OFFSET); ++ + moutb(VGA_ATTR_INDEX, index); + return minb(VGA_ATTR_DATA_R); + } +@@ -472,7 +480,11 @@ + static void + mmioEnablePalette(vgaHWPtr hwp) + { +- (void) minb(hwp->IOBase + VGA_IN_STAT_1_OFFSET); ++ volatile CARD8 tmp; ++ ++ /* gcc-4.0 -O2 is broken : needs a volatile assignment */ ++ tmp = minb(hwp->IOBase + VGA_IN_STAT_1_OFFSET); ++ + moutb(VGA_ATTR_INDEX, 0x00); + hwp->paletteEnabled = TRUE; + } +@@ -480,7 +492,11 @@ + static void + mmioDisablePalette(vgaHWPtr hwp) + { +- (void) minb(hwp->IOBase + VGA_IN_STAT_1_OFFSET); ++ volatile CARD8 tmp; ++ ++ /* gcc-4.0 -O2 is broken : needs a volatile assignment */ ++ tmp = minb(hwp->IOBase + VGA_IN_STAT_1_OFFSET); ++ + moutb(VGA_ATTR_INDEX, 0x20); + hwp->paletteEnabled = FALSE; + } --- xorg-server-1.4.2.orig/debian/patches/48_xaa_nooffscreenpixmaps.diff +++ xorg-server-1.4.2/debian/patches/48_xaa_nooffscreenpixmaps.diff @@ -0,0 +1,41 @@ +xaa: disable offscreen pixmaps by default + +Can be enabled with Option "XaaOffscreenPixmaps". + +Index: xorg-server/hw/xfree86/xaa/xaaInitAccel.c +=================================================================== +--- xorg-server.orig/hw/xfree86/xaa/xaaInitAccel.c ++++ xorg-server/hw/xfree86/xaa/xaaInitAccel.c +@@ -87,7 +87,7 @@ + OPTV_BOOLEAN, {0}, FALSE }, + {XAAOPT_PIXMAP_CACHE, "XaaNoPixmapCache", + OPTV_BOOLEAN, {0}, FALSE }, +- {XAAOPT_OFFSCREEN_PIXMAPS, "XaaNoOffscreenPixmaps", ++ {XAAOPT_OFFSCREEN_PIXMAPS, "XaaOffscreenPixmaps", + OPTV_BOOLEAN, {0}, FALSE }, + { -1, NULL, + OPTV_NONE, {0}, FALSE } +@@ -542,7 +542,7 @@ + #define XAAMSG(s) do { if (serverGeneration == 1) xf86ErrorF(s); } while (0) + + if((infoRec->Flags & OFFSCREEN_PIXMAPS) && HaveScreenToScreenCopy && +- !xf86IsOptionSet(options, XAAOPT_OFFSCREEN_PIXMAPS)) { ++ xf86IsOptionSet(options, XAAOPT_OFFSCREEN_PIXMAPS)) { + XAAMSG("\tOffscreen Pixmaps\n"); + } else { + infoRec->Flags &= ~OFFSCREEN_PIXMAPS; +Index: xorg-server/hw/xfree86/doc/man/xorg.conf.man.pre +=================================================================== +--- xorg-server.orig/hw/xfree86/doc/man/xorg.conf.man.pre ++++ xorg-server/hw/xfree86/doc/man/xorg.conf.man.pre +@@ -1648,8 +1648,8 @@ + Disables accelerated fills of a trapezoidal region with a monochrome + pattern. + .TP 7 +-.BI "Option \*qXaaNoOffscreenPixmaps\*q" +-Disables accelerated draws into pixmaps stored in offscreen video memory. ++.BI "Option \*qXaaOffscreenPixmaps\*q" ++Enables accelerated draws into pixmaps stored in offscreen video memory. + .TP 7 + .BI "Option \*qXaaNoPixmapCache\*q" + Disables caching of patterns in offscreen video memory. --- xorg-server-1.4.2.orig/debian/patches/08_better_dpms_logging.diff +++ xorg-server-1.4.2/debian/patches/08_better_dpms_logging.diff @@ -0,0 +1,31 @@ +Index: xorg-server/hw/xfree86/common/xf86DPMS.c +=================================================================== +--- xorg-server.orig/hw/xfree86/common/xf86DPMS.c 2008-01-07 20:19:47.000000000 -0500 ++++ xorg-server/hw/xfree86/common/xf86DPMS.c 2008-01-07 20:28:11.000000000 -0500 +@@ -61,6 +61,7 @@ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + DPMSPtr pDPMS; + pointer DPMSOpt; ++ MessageType enabled_from = X_INFO; + + if (serverGeneration != DPMSGeneration) { + if ((DPMSIndex = AllocateScreenPrivateIndex()) < 0) +@@ -82,8 +83,8 @@ + = xf86SetBoolOption(pScrn->options, "dpms", FALSE)) + && !DPMSDisabledSwitch) + DPMSEnabled = TRUE; ++ enabled_from = X_CONFIG; + xf86MarkOptionUsed(DPMSOpt); +- xf86DrvMsg(pScreen->myNum, X_CONFIG, "DPMS enabled\n"); + } else if (DPMSEnabledSwitch) { + if (!DPMSDisabledSwitch) + DPMSEnabled = TRUE; +@@ -92,6 +93,8 @@ + else { + pDPMS->Enabled = defaultDPMSEnabled; + } ++ if (pDPMS->Enabled) ++ xf86DrvMsg(pScreen->myNum, enabled_from, "DPMS enabled\n"); + pDPMS->CloseScreen = pScreen->CloseScreen; + pScreen->CloseScreen = DPMSClose; + DPMSCount++; --- xorg-server-1.4.2.orig/debian/patches/53_Properly-initialize-io.pi_sel.pc_domain-on-kfreebsd.patch +++ xorg-server-1.4.2/debian/patches/53_Properly-initialize-io.pi_sel.pc_domain-on-kfreebsd.patch @@ -0,0 +1,32 @@ +From 43b9645e4f5343757613c422c9e1204ba826d1f7 Mon Sep 17 00:00:00 2001 +From: Petr Salinger +Date: Mon, 6 Oct 2008 18:33:31 +0200 +Subject: [PATCH] Properly initialize io.pi_sel.pc_domain on kfreebsd + +--- + hw/xfree86/os-support/bus/freebsdPci.c | 2 ++ + 1 files changed, 2 insertions(+), 0 deletions(-) + +diff --git a/hw/xfree86/os-support/bus/freebsdPci.c b/hw/xfree86/os-support/bus/freebsdPci.c +index 63c00b2..b1f3dbd 100644 +--- a/hw/xfree86/os-support/bus/freebsdPci.c ++++ b/hw/xfree86/os-support/bus/freebsdPci.c +@@ -133,6 +133,7 @@ freebsdPciCfgRead(PCITAG tag, int off) + { + struct pci_io io; + int error; ++ io.pi_sel.pc_domain = PCI_DOM_FROM_TAG(tag); + io.pi_sel.pc_bus = BUS(tag); + io.pi_sel.pc_dev = DFN(tag) >> 3; + io.pi_sel.pc_func = DFN(tag) & 7; +@@ -148,6 +149,7 @@ static void + freebsdPciCfgWrite(PCITAG tag, int off, CARD32 val) + { + struct pci_io io; ++ io.pi_sel.pc_domain = PCI_DOM_FROM_TAG(tag); + io.pi_sel.pc_bus = BUS(tag); + io.pi_sel.pc_dev = DFN(tag) >> 3; + io.pi_sel.pc_func = DFN(tag) & 7; +-- +1.5.6.5 + --- xorg-server-1.4.2.orig/debian/patches/13_debian_add_xkbpath_env_variable.diff +++ xorg-server-1.4.2/debian/patches/13_debian_add_xkbpath_env_variable.diff @@ -0,0 +1,27 @@ +--- xorg-server.orig/xkb/xkbInit.c ++++ xorg-server/xkb/xkbInit.c +@@ -835,6 +835,14 @@ + extern unsigned char XkbDfltAccessXOptions; + + int ++xkbInitGlobals() ++{ ++ char * xkbpath= getenv("XKBPATH"); ++ if (xkbpath!=NULL) ++ XkbBaseDirectory= xkbpath; ++} ++ ++int + XkbProcessArguments(int argc,char *argv[],int i) + { + if (strcmp(argv[i],"-kb")==0) { +--- xorg-server.orig/os/utils.c ++++ xorg-server/os/utils.c +@@ -684,6 +684,7 @@ + */ + void InitGlobals(void) + { ++ xkbInitGlobals(); + ddxInitGlobals(); + } + --- xorg-server-1.4.2.orig/debian/patches/41_vbe_filter_less.diff +++ xorg-server-1.4.2/debian/patches/41_vbe_filter_less.diff @@ -0,0 +1,46 @@ +* Fri Sep 22 2006 Adam Jackson 1.1.1-41.fc6 +- xorg-x11-server-1.1.1-vbe-filter-less.patch: Be gentler about rejecting + VESA modes early, since xf86ValidateModes should handle them just fine. + +http://cvs.fedora.redhat.com/viewcvs/devel/xorg-x11-server/xorg-x11-server-1.1.1-vbe-filter-less.patch?rev=1.1&view=auto +Debian bug #424684 (and maybe #428711) + +Index: xorg-server/hw/xfree86/vbe/vbeModes.c +=================================================================== +--- xorg-server.orig/hw/xfree86/vbe/vbeModes.c 2007-07-05 17:55:24.000000000 +0200 ++++ xorg-server/hw/xfree86/vbe/vbeModes.c 2007-07-05 17:57:01.000000000 +0200 +@@ -152,34 +152,6 @@ + xf86ErrorFVerb(DEBUG_VERB, "*"); + } + +- /* +- * Check if there's a valid monitor mode that this one can be matched +- * up with. The actual matching is done later. +- */ +- if (modeOK) { +- Bool sizeMatch = FALSE; +- modeOK = FALSE; +- for (p = pScrn->monitor->Modes; p != NULL; p = p->next) { +- if ((p->HDisplay != mode->XResolution) || +- (p->VDisplay != mode->YResolution) || +- (p->Flags & (V_INTERLACE | V_DBLSCAN | V_CLKDIV2))) +- continue; +- sizeMatch = TRUE; +- /* XXX could support the various V_ flags */ +- status = xf86CheckModeForMonitor(p, pScrn->monitor); +- if (status == MODE_OK) { +- modeOK = TRUE; +- break; +- } +- } +- if (sizeMatch && !modeOK) { +- xf86DrvMsg(pScrn->scrnIndex, X_INFO, +- "Not using built-in mode \"%dx%d\" (%s)\n", +- mode->XResolution, mode->YResolution, +- xf86ModeStatusToString(status)); +- } +- } +- + xf86ErrorFVerb(DEBUG_VERB, + "Mode: %x (%dx%d)\n", id, mode->XResolution, mode->YResolution); + xf86ErrorFVerb(DEBUG_VERB, --- xorg-server-1.4.2.orig/debian/patches/46_reduce_wakeups_from_smart_scheduler.patch +++ xorg-server-1.4.2/debian/patches/46_reduce_wakeups_from_smart_scheduler.patch @@ -0,0 +1,157 @@ +commit 2338d5c9914e2a43c3a4f7ee0f4355ad0a1ad9e7 +Author: Arjan van de Ven +Date: Sun Oct 28 09:37:52 2007 +0100 + + reduce wakeups from smart scheduler + + The smart scheduler itimer currently always fires after each request + (which in turn causes the CPU to wake out of idle, burning precious + power). Rather than doing this, just stop the timer before going into + the select() portion of the WaitFor loop. It's a cheap system call, and + it will only get called if there's no more commands batched up from the + active fd. + + This change also allows some of the functions to be simplified; + setitimer() will only fail if it's passed invalid data, and we don't do + that... so make it void and remove all the conditional code that deals + with failure. + + The change also allows us to remove a few variables that were used for + housekeeping between the signal handler and the main loop. + + Signed-off-by: Keith Packard + +commit 0e9ef65fa583bf2393dd0fda82df6f092387b425 +Author: Keith Packard +Date: Wed Nov 7 16:33:10 2007 -0800 + + Don't frob timers unless SmartSchedule is running + +--- xorg-server.orig/include/dixstruct.h ++++ xorg-server/include/dixstruct.h +@@ -150,11 +150,9 @@ + extern long SmartScheduleInterval; + extern long SmartScheduleSlice; + extern long SmartScheduleMaxSlice; +-extern unsigned long SmartScheduleIdleCount; + extern Bool SmartScheduleDisable; +-extern Bool SmartScheduleIdle; +-extern Bool SmartScheduleTimerStopped; +-extern Bool SmartScheduleStartTimer(void); ++extern void SmartScheduleStartTimer(void); ++extern void SmartScheduleStopTimer(void); + #define SMART_MAX_PRIORITY (20) + #define SMART_MIN_PRIORITY (-20) + +--- xorg-server.orig/os/WaitFor.c ++++ xorg-server/os/WaitFor.c +@@ -217,7 +217,8 @@ + XFD_COPYSET(&AllSockets, &LastSelectMask); + #ifdef SMART_SCHEDULE + } +- SmartScheduleIdle = TRUE; ++ SmartScheduleStopTimer (); ++ + #endif + BlockHandler((pointer)&wt, (pointer)&LastSelectMask); + if (NewOutputPending) +@@ -237,13 +238,7 @@ + selecterr = GetErrno(); + WakeupHandler(i, (pointer)&LastSelectMask); + #ifdef SMART_SCHEDULE +- if (i >= 0) +- { +- SmartScheduleIdle = FALSE; +- SmartScheduleIdleCount = 0; +- if (SmartScheduleTimerStopped) +- (void) SmartScheduleStartTimer (); +- } ++ SmartScheduleStartTimer (); + #endif + if (i <= 0) /* An error or timeout occurred */ + { +--- xorg-server.orig/os/utils.c ++++ xorg-server/os/utils.c +@@ -1513,10 +1513,6 @@ + + #ifdef SMART_SCHEDULE + +-unsigned long SmartScheduleIdleCount; +-Bool SmartScheduleIdle; +-Bool SmartScheduleTimerStopped; +- + #ifdef SIGVTALRM + #define SMART_SCHEDULE_POSSIBLE + #endif +@@ -1526,49 +1522,43 @@ + #define SMART_SCHEDULE_TIMER ITIMER_REAL + #endif + +-static void ++void + SmartScheduleStopTimer (void) + { + #ifdef SMART_SCHEDULE_POSSIBLE + struct itimerval timer; + ++ if (SmartScheduleDisable) ++ return; + timer.it_interval.tv_sec = 0; + timer.it_interval.tv_usec = 0; + timer.it_value.tv_sec = 0; + timer.it_value.tv_usec = 0; + (void) setitimer (ITIMER_REAL, &timer, 0); +- SmartScheduleTimerStopped = TRUE; + #endif + } + +-Bool ++void + SmartScheduleStartTimer (void) + { + #ifdef SMART_SCHEDULE_POSSIBLE + struct itimerval timer; + +- SmartScheduleTimerStopped = FALSE; ++ if (SmartScheduleDisable) ++ return; + timer.it_interval.tv_sec = 0; + timer.it_interval.tv_usec = SmartScheduleInterval * 1000; + timer.it_value.tv_sec = 0; + timer.it_value.tv_usec = SmartScheduleInterval * 1000; +- return setitimer (ITIMER_REAL, &timer, 0) >= 0; ++ setitimer (ITIMER_REAL, &timer, 0); + #endif +- return FALSE; + } + + #ifdef SMART_SCHEDULE_POSSIBLE + static void + SmartScheduleTimer (int sig) + { +- int olderrno = errno; +- + SmartScheduleTime += SmartScheduleInterval; +- if (SmartScheduleIdle) +- { +- SmartScheduleStopTimer (); +- } +- errno = olderrno; + } + #endif + +@@ -1592,14 +1582,6 @@ + perror ("sigaction for smart scheduler"); + return FALSE; + } +- /* Set up the virtual timer */ +- if (!SmartScheduleStartTimer ()) +- { +- perror ("scheduling timer"); +- return FALSE; +- } +- /* stop the timer and wait for WaitForSomething to start it */ +- SmartScheduleStopTimer (); + return TRUE; + #else + return FALSE; --- xorg-server-1.4.2.orig/debian/patches/series +++ xorg-server-1.4.2/debian/patches/series @@ -0,0 +1,37 @@ +001_ubuntu_add_extra_modelines_from_xorg.patch +02_libvgahw_gcc4_volatile_fix.diff +03_auto_load_driver.diff +04_auto_load_driver_no_conf.diff +05_kill_type1.diff +06_use_proc_instead_of_sysfs_for_pci_domains.diff +07_autoconfig_screen_with_device_section.diff +08_better_dpms_logging.diff +10_dont_look_in_home_for_config.diff +11_dont_crash_on_bad_dri_mode.diff +13_debian_add_xkbpath_env_variable.diff +14_default_screen_section.diff +15_X86EMU-added-blacklist-for-I-O-port-in-0-0xFF-range.patch +16_X86EMU-pass-the-correct-bus-dev-fn-tag-to-pci-emula.patch +17_x86emu_handle_cpuid.patch +18_glx_initialize_getvisualconfigs_buf.diff +21_glx_align_fixes.patch +41_vbe_filter_less.diff +43_allow_override_BIOS_EDID_preferred_mode.diff +44_preferredmode_infinite_loop.diff +45_only_XF86_APM_CAPABILITY_CHANGED_for_video_change_acpi_events.diff +46_reduce_wakeups_from_smart_scheduler.patch +47_fbdevhw_magic_numbers.diff +48_xaa_nooffscreenpixmaps.diff +49_x86emu_int1a_fix.diff +50_Make-RandRQueryVersion-return-1.1-for-swapped-client.patch +51_xevie-length.diff +52_xevie-swap-replies.diff +53_Properly-initialize-io.pi_sel.pc_domain-on-kfreebsd.patch +54_more-sanity-checks.diff +91_ttf2pt1 +91_ttf2pt1_updates +92_xprint-security-holes-fix.patch +93_spooltodir_check_file_exists +93_xprint_fonts_fix +94_xprint_XSERVER_LIBS +95_xprint_disable_dbus --- xorg-server-1.4.2.orig/debian/patches/49_x86emu_int1a_fix.diff +++ xorg-server-1.4.2/debian/patches/49_x86emu_int1a_fix.diff @@ -0,0 +1,70 @@ +commit 9e5b3deafb97ec1f83e6bfe067bc68df7385bc6a +Author: Adam Jackson +Date: Tue Jun 24 14:08:04 2008 -0400 + + Bug #11842: Fix emulation of int1A PCI BIOS services. + + Use only %di to name the PCI register to read/write, rather than %edi. + DOS is only expecting the base PCI config space anyway, and the BIOS + might be using the high bits of %edi. + +backported to pre-pciaccess, fixes #404885. + +Index: xorg-server/hw/xfree86/int10/xf86int10.c +=================================================================== +--- xorg-server.orig/hw/xfree86/int10/xf86int10.c 2008-06-24 20:31:06.000000000 +0200 ++++ xorg-server/hw/xfree86/int10/xf86int10.c 2008-06-24 20:34:46.000000000 +0200 +@@ -667,7 +667,7 @@ + return 1; + case 0xb108: + if ((tag = findPci(pInt, X86_EBX)) != PCI_NOT_FOUND) { +- X86_CL = pciReadByte(tag, X86_EDI); ++ X86_CL = pciReadByte(tag, X86_DI); + X86_EAX = X86_AL | (SUCCESSFUL << 8); + X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ + } else { +@@ -680,7 +680,7 @@ + return 1; + case 0xb109: + if ((tag = findPci(pInt, X86_EBX)) != PCI_NOT_FOUND) { +- X86_CX = pciReadWord(tag, X86_EDI); ++ X86_CX = pciReadWord(tag, X86_DI); + X86_EAX = X86_AL | (SUCCESSFUL << 8); + X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ + } else { +@@ -693,7 +693,7 @@ + return 1; + case 0xb10a: + if ((tag = findPci(pInt, X86_EBX)) != PCI_NOT_FOUND) { +- X86_ECX = pciReadLong(tag, X86_EDI); ++ X86_ECX = pciReadLong(tag, X86_DI); + X86_EAX = X86_AL | (SUCCESSFUL << 8); + X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ + } else { +@@ -706,7 +706,7 @@ + return 1; + case 0xb10b: + if ((tag = findPci(pInt, X86_EBX)) != PCI_NOT_FOUND) { +- pciWriteByte(tag, X86_EDI, X86_CL); ++ pciWriteByte(tag, X86_DI, X86_CL); + X86_EAX = X86_AL | (SUCCESSFUL << 8); + X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ + } else { +@@ -719,7 +719,7 @@ + return 1; + case 0xb10c: + if ((tag = findPci(pInt, X86_EBX)) != PCI_NOT_FOUND) { +- pciWriteWord(tag, X86_EDI, X86_CX); ++ pciWriteWord(tag, X86_DI, X86_CX); + X86_EAX = X86_AL | (SUCCESSFUL << 8); + X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ + } else { +@@ -732,7 +732,7 @@ + return 1; + case 0xb10d: + if ((tag = findPci(pInt, X86_EBX)) != PCI_NOT_FOUND) { +- pciWriteLong(tag, X86_EDI, X86_ECX); ++ pciWriteLong(tag, X86_DI, X86_ECX); + X86_EAX = X86_AL | (SUCCESSFUL << 8); + X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ + } else { --- xorg-server-1.4.2.orig/debian/patches/09_debian_xserver_rtff.diff +++ xorg-server-1.4.2/debian/patches/09_debian_xserver_rtff.diff @@ -0,0 +1,52 @@ +$Id: 910_debian_Xserver_RTFF.diff 486 2005-08-03 04:51:11Z dnusinow $ + +Give the user a far stronger clue as to what to do when their font configuration +is horribly screwed up; this patch by Branden Robinson. + +Index: a/dix/main.c +=================================================================== +--- a/dix/main.c.orig 2006-11-13 19:59:22.000000000 +0100 ++++ b/dix/main.c 2006-11-26 01:55:13.000000000 +0100 +@@ -407,10 +407,42 @@ + defaultFontPath); + } + if (!SetDefaultFont(defaultTextFont)) ++#ifdef DEBIAN ++ FatalError("could not open default font '%s';\n" ++"the X server's font paths might be misconfigured, remote font server(s)\n" ++"may be unreachable, and/or local fonts may not be installed or are not\n" ++"configured correctly.\n" ++"\n" ++"People inexperienced with the X Window System should have the\n" ++"\"xorg\" package installed.\n" ++"# apt-get install xorg\n" ++"\n" ++"Other useful commands to run include:\n" ++"$ dpkg --status x11-common\n" ++"$ dpkg --status xfonts-base\n" ++"$ zmore /usr/share/doc/x11-common/FAQ.gz", defaultTextFont); ++#else + FatalError("could not open default font '%s'", defaultTextFont); ++#endif + if (!(rootCursor = CreateRootCursor(defaultCursorFont, 0))) ++#ifdef DEBIAN ++ FatalError("could not open default cursor font '%s';\n" ++"the X server's font paths might be misconfigured, remote font server(s)\n" ++"may be unreachable, and/or local fonts may not be installed or are not\n" ++"configured correctly.\n" ++"\n" ++"People inexperienced with the X Window System should have the\n" ++"\"xorg\" package installed.\n" ++"# apt-get install xorg\n" ++"\n" ++"Other useful commands to run include:\n" ++"$ dpkg --status x11-common\n" ++"$ dpkg --status xfonts-base\n" ++"$ zmore /usr/share/doc/x11-common/FAQ.gz", defaultTextFont); ++#else + FatalError("could not open default cursor font '%s'", + defaultCursorFont); ++#endif + #ifdef DPMSExtension + /* check all screens, looking for DPMS Capabilities */ + DPMSCapableFlag = DPMSSupported(); --- xorg-server-1.4.2.orig/debian/patches/95_xprint_disable_dbus +++ xorg-server-1.4.2/debian/patches/95_xprint_disable_dbus @@ -0,0 +1,30 @@ +From: Drew Parsons +Date: Fri, 9 May 2008 13:20:11 +0000 (+1000) +Subject: Disable D-BUS from Xprint. +X-Git-Url: http://gitweb.freedesktop.org/?p=xorg/xserver.git;a=commitdiff;h=2a3d1421e0cc18822ae8f478fcc272e16a9e9340 + +Disable D-BUS from Xprint. + +Use dummy config functions to replace those from config/config.c, and +therefore do not link Xprt with $CONFIG_LIB. + +Works around an endlessly spinning loop in dix/dispatch.c::Dispatch() +(WaitForSomething() not waiting) when built with dbus, which was +causing Xprt to use 95% cpu. +--- + +--- a/hw/xprint/ddxInit.c ++++ b/hw/xprint/ddxInit.c +@@ -291,6 +291,12 @@ ddxProcessArgument ( + #include "XIstubs.h" + #include "exglobals.h" + ++/* Place dummy config functions here instead of config/config.c, ++ since Xprint does not use D-BUS */ ++void config_init() { } ++void config_fini() { } ++ ++ + int + ChangePointerDevice ( + DeviceIntPtr old_dev, --- xorg-server-1.4.2.orig/debian/patches/21_glx_align_fixes.patch +++ xorg-server-1.4.2/debian/patches/21_glx_align_fixes.patch @@ -0,0 +1,57 @@ +--- xorg-server.orig/GL/glx/Makefile.am ++++ xorg-server/GL/glx/Makefile.am +@@ -14,7 +14,8 @@ + -I@MESA_SOURCE@/src/mesa/glapi \ + -I@MESA_SOURCE@/src/mesa/main \ + -DXFree86Server \ +- @GLX_DEFINES@ ++ @GLX_DEFINES@ \ ++ @GLX_ARCH_DEFINES@ + + # none yet + #sdk_HEADERS = +--- xorg-server.orig/configure.ac ++++ xorg-server/configure.ac +@@ -287,6 +287,7 @@ + case $host_os in + *netbsd*) AC_DEFINE(USE_ALPHA_PIO, 1, [NetBSD PIO alpha IO]) ;; + esac ++ GLX_ARCH_DEFINES="-D__GLX_ALIGN64 -mieee" + ;; + arm*) + ARM_VIDEO=yes +@@ -317,6 +318,7 @@ + xorg_loader_sparcmuldiv="yes" + SPARC64_VIDEO=yes + BSD_ARCH_SOURCES="sparc64_video.c ioperm_noop.c" ++ GLX_ARCH_DEFINES="-D__GLX_ALIGN64" + ;; + x86_64*|amd64*) + use_x86_asm="yes" +@@ -332,8 +334,16 @@ + 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]) +--- xorg-server.orig/hw/dmx/glxProxy/Makefile.am ++++ xorg-server/hw/dmx/glxProxy/Makefile.am +@@ -32,6 +32,7 @@ + unpack.h + + AM_CFLAGS = \ ++ @GLX_ARCH_DEFINES@ \ + $(DIX_CFLAGS) \ + -I$(top_srcdir)/hw/dmx \ + -I$(top_srcdir)/include \ --- xorg-server-1.4.2.orig/debian/patches/45_only_XF86_APM_CAPABILITY_CHANGED_for_video_change_acpi_events.diff +++ xorg-server-1.4.2/debian/patches/45_only_XF86_APM_CAPABILITY_CHANGED_for_video_change_acpi_events.diff @@ -0,0 +1,56 @@ +commit 74e84b8d891632141a60e2d29463ab46f622df3f +Author: Matthias Hopf +Date: Fri Oct 19 17:28:15 2007 +0200 + + Only issue XF86_APM_CAPABILITY_CHANGED for video change ACPI events (not e.g. brightness etc.). + +diff --git a/hw/xfree86/os-support/linux/lnx_acpi.c b/hw/xfree86/os-support/linux/lnx_acpi.c +index 9808e37..bb975cc 100644 +--- a/hw/xfree86/os-support/linux/lnx_acpi.c ++++ b/hw/xfree86/os-support/linux/lnx_acpi.c +@@ -69,9 +69,11 @@ lnxACPIGetEventFromOs(int fd, pmEvent *events, int num) + 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 (strstr(ev, "video") == ev) { ++ if (!strncmp(ev, "video", 5)) { + char *video = NULL; + char *GFX = NULL; + char *notify = NULL; +@@ -97,26 +99,19 @@ lnxACPIGetEventFromOs(int fd, pmEvent *events, int num) + ErrorF("data: 0x%lx\n",data_l); + #endif + +- /* We currently don't differentiate between any event */ ++ /* Differentiate between events */ + switch (notify_l) { + case ACPI_VIDEO_NOTIFY_SWITCH: +- break; +- case ACPI_VIDEO_NOTIFY_PROBE: +- break; + case ACPI_VIDEO_NOTIFY_CYCLE: +- break; + case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT: +- break; + case ACPI_VIDEO_NOTIFY_PREV_OUTPUT: +- break; ++ events[0] = XF86_APM_CAPABILITY_CHANGED; ++ return 1; ++ case ACPI_VIDEO_NOTIFY_PROBE: ++ return 0; + default: +- break; ++ return 0; + } +- +- /* Deal with all ACPI events as a capability change */ +- events[0] = XF86_APM_CAPABILITY_CHANGED; +- +- return 1; + } + + return 0; --- xorg-server-1.4.2.orig/debian/patches/93_spooltodir_check_file_exists +++ xorg-server-1.4.2/debian/patches/93_spooltodir_check_file_exists @@ -0,0 +1,52 @@ +diff -ruN xorg-server-old/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/ps2pdf_spooltodir.sh xorg-server/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/ps2pdf_spooltodir.sh +--- xorg-server-old/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/ps2pdf_spooltodir.sh 2006-04-14 22:14:47.000000000 +1000 ++++ xorg-server/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/ps2pdf_spooltodir.sh 2006-04-14 22:17:05.000000000 +1000 +@@ -108,8 +108,21 @@ + # which may screw-up further processing by other shell scripts ... + filename="`echo \"${filename}\" | tr '[:blank:]' '_' | tr -c -d '[:alnum:]_.-'`" + ++# consider that the end name might be too long: ++# 1. Calculate the length of the suffix (I think we need to count in bytes) ++filename_length="`echo \"${filename_suffix}\" | wc -c`" ++# 2. remove this length from 256 ++filename_length="`echo \"256-${filename_length}\" | bc`" ++# 3. and keep only the first 256 - suffix_length bytes from the name. ++filename="`echo \"${filename}\" | cut -b-${filename_length}`" ++ + # ... add path and suffix ... +-filename="${spooldir}/${filename}${filename_suffix}" ++# ... should be unique, but check anyway ++if [ -e "${spooldir}/${filename}" ]; then ++ filename="`tempfile -d "${spooldir}" -s "_${filename}${filename_suffix}"`" ++else ++ filename="${spooldir}/${filename}${filename_suffix}" ++fi + + verbose "# File name is \"$filename\"." + +diff -ruN xorg-server-old/hw/xprint/config/C/print/models/PSspooldir/spooltodir.sh xorg-server/hw/xprint/config/C/print/models/PSspooldir/spooltodir.sh +--- xorg-server-old/hw/xprint/config/C/print/models/PSspooldir/spooltodir.sh 2006-04-14 22:14:47.000000000 +1000 ++++ xorg-server/hw/xprint/config/C/print/models/PSspooldir/spooltodir.sh 2006-04-14 22:18:06.000000000 +1000 +@@ -108,8 +108,21 @@ + # which may screw-up further processing by other shell scripts ... + filename="`echo \"${filename}\" | tr '[:blank:]' '_' | tr -c -d '[:alnum:]_.-'`" + ++# consider that the end name might be too long: ++# 1. Calculate the length of the suffix (I think we need to count in bytes) ++filename_length="`echo \"${filename_suffix}\" | wc -c`" ++# 2. remove this length from 256 ++filename_length="`echo \"256-${filename_length}\" | bc`" ++# 3. and keep only the first 256 - suffix_length bytes from the name. ++filename="`echo \"${filename}\" | cut -b-${filename_length}`" ++ + # ... add path and suffix ... +-filename="${spooldir}/${filename}${filename_suffix}" ++# ... should be unique, but check anyway ++if [ -e "${spooldir}/${filename}" ]; then ++ filename="`tempfile -d "${spooldir}" -s "_${filename}${filename_suffix}"`" ++else ++ filename="${spooldir}/${filename}${filename_suffix}" ++fi + + verbose "# File name is \"$filename\"." + --- xorg-server-1.4.2.orig/debian/patches/51_xevie-length.diff +++ xorg-server-1.4.2/debian/patches/51_xevie-length.diff @@ -0,0 +1,42 @@ +From: Thorvald Natvig +Subject: fix XEvIE + +For all the replys but ProcXevieQueryVersion, the rep.length field isn't +set to zero, which makes the client misbehave when it gets the reply. + +Index: xorg-server/Xext/xevie.c +=================================================================== +--- xorg-server.orig/Xext/xevie.c ++++ xorg-server/Xext/xevie.c +@@ -213,6 +213,7 @@ + + xevieModifiersOn = FALSE; + ++ rep.length = 0; + rep.type = X_Reply; + rep.sequence_number = client->sequence; + WriteToClient (client, sizeof (xXevieStartReply), (char *)&rep); +@@ -232,6 +233,7 @@ + XevieEnd(xevieClientIndex); + } + ++ rep.length = 0; + rep.type = X_Reply; + rep.sequence_number = client->sequence; + WriteToClient (client, sizeof (xXevieEndReply), (char *)&rep); +@@ -250,6 +252,7 @@ + return BadAccess; + + xE = (xEvent *)&stuff->event; ++ rep.length = 0; + rep.type = X_Reply; + rep.sequence_number = client->sequence; + WriteToClient (client, sizeof (xXevieSendReply), (char *)&rep); +@@ -294,6 +297,7 @@ + return BadAccess; + + xevieMask = (long)stuff->event_mask; ++ rep.length = 0; + rep.type = X_Reply; + rep.sequence_number = client->sequence; + WriteToClient (client, sizeof (xXevieSelectInputReply), (char *)&rep); --- xorg-server-1.4.2.orig/debian/patches/06_use_proc_instead_of_sysfs_for_pci_domains.diff +++ xorg-server-1.4.2/debian/patches/06_use_proc_instead_of_sysfs_for_pci_domains.diff @@ -0,0 +1,36 @@ +Upstream commit 56f21bda1ce95741c88c423b60bd709eef26eb12 was supposed to +only avoid multiple scans of the PCI devices, but it actually also added +an "optimization" based on using sysfs files instead of /proc. However, +this code is broken, for instance because there are no ioctl handler on +/sys/bus/pci/devices/*/config files while there some on /proc/bus/pci/* + +It breaks the Xserver on architectures that require such ioctls to scan +the PCI devices and/or deal with PCI domains: +#422077: xserver-xorg: Fatal server error on sparc: xf86MapPciMem failed +#422095: xserver-xorg-core: fails to start on powerpc, no devices detected + +The following patch forces the server to behave as if we were running on +a 2.4 kernel while scanning PCI devices, so that the sysfs code is disabled. + +Upstream doesn't apply this patch since they want to fix the sysfs-code. +See https://bugs.freedesktop.org/show_bug.cgi?id=7248 + +Thanks to Jim Watson for testing! + +--- + hw/xfree86/os-support/bus/linuxPci.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: xorg-server-1.3.0.0.dfsg/hw/xfree86/os-support/bus/linuxPci.c +=================================================================== +--- xorg-server-1.3.0.0.dfsg.orig/hw/xfree86/os-support/bus/linuxPci.c 2007-05-10 21:51:55.000000000 +0200 ++++ xorg-server-1.3.0.0.dfsg/hw/xfree86/os-support/bus/linuxPci.c 2007-05-10 21:52:13.000000000 +0200 +@@ -148,7 +148,7 @@ + int domain, bus, dev, func; + char file[64]; + struct stat ignored; +- static int is26 = -1; ++ static int is26 = 0; + + domain = PCI_DOM_FROM_TAG(tag); + bus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(tag)); --- xorg-server-1.4.2.orig/debian/patches/44_preferredmode_infinite_loop.diff +++ xorg-server-1.4.2/debian/patches/44_preferredmode_infinite_loop.diff @@ -0,0 +1,28 @@ +From 29e0e180729a4f0cc020985a4de4c8bc4b9c7f5f Mon Sep 17 00:00:00 2001 +From: Keith Packard +Date: Mon, 22 Oct 2007 13:38:16 -0700 +Subject: [PATCH] Leave hardware-specified preferred modes alone when user preference exists. + +Instead of removing the preference bit marking the hardware declared mode +preference, leave it in place and just move the user preferred mode to the +front of the list while marking it with the USERPREF bit which will cause it +to be selected by the initial mode selection code. +--- + hw/xfree86/modes/xf86Crtc.c | 3 +-- + 1 files changed, 1 insertions(+), 2 deletions(-) + +Index: xorg-server/hw/xfree86/modes/xf86Crtc.c +=================================================================== +--- xorg-server.orig/hw/xfree86/modes/xf86Crtc.c ++++ xorg-server/hw/xfree86/modes/xf86Crtc.c +@@ -1433,9 +1433,8 @@ + output->probed_modes = mode; + } + mode->type |= (M_T_PREFERRED|M_T_USERPREF); ++ break; + } +- else +- mode->type &= ~M_T_PREFERRED; + } + } + --- xorg-server-1.4.2.orig/debian/patches/05_kill_type1.diff +++ xorg-server-1.4.2/debian/patches/05_kill_type1.diff @@ -0,0 +1,160 @@ +From 13949f997289068354e83bc83e50d97b8232efb1 Mon Sep 17 00:00:00 2001 +From: Julien Cristau +Date: Thu, 23 Aug 2007 11:27:33 +0200 +Subject: [PATCH] Get rid of the type1 font module. + +It is completely replaced by freetype these days. +--- + hw/xfree86/common/xf86AutoConfig.c | 1 - + hw/xfree86/common/xf86Config.c | 1 - + hw/xfree86/dixmods/Makefile.am | 6 +-- + hw/xfree86/dixmods/type1mod.c | 75 ---------------------------------- + hw/xfree86/doc/man/xorg.conf.man.pre | 4 +- + 5 files changed, 3 insertions(+), 84 deletions(-) + delete mode 100644 hw/xfree86/dixmods/type1mod.c + +Index: xorg-server/hw/xfree86/common/xf86AutoConfig.c +=================================================================== +--- xorg-server.orig/hw/xfree86/common/xf86AutoConfig.c 2007-09-18 21:01:37.000000000 +0200 ++++ xorg-server/hw/xfree86/common/xf86AutoConfig.c 2007-09-18 21:02:26.000000000 +0200 +@@ -49,7 +49,6 @@ + "\tLoad\t\"dbe\"\n" \ + "\tLoad\t\"glx\"\n" \ + "\tLoad\t\"freetype\"\n" \ +- "\tLoad\t\"type1\"\n" \ + "\tLoad\t\"record\"\n" \ + "\tLoad\t\"dri\"\n" \ + "EndSection\n\n" +Index: xorg-server/hw/xfree86/common/xf86Config.h +=================================================================== +--- xorg-server.orig/hw/xfree86/common/xf86Config.h 2007-09-18 21:01:37.000000000 +0200 ++++ xorg-server/hw/xfree86/common/xf86Config.h 2007-09-18 21:02:26.000000000 +0200 +@@ -61,7 +61,6 @@ + {.name = "dbe", .toLoad = TRUE, .load_opt=NULL}, + {.name = "glx", .toLoad = TRUE, .load_opt=NULL}, + {.name = "freetype", .toLoad = TRUE, .load_opt=NULL}, +- {.name = "type1", .toLoad = TRUE, .load_opt=NULL}, + {.name = "record", .toLoad = TRUE, .load_opt=NULL}, + {.name = "dri", .toLoad = TRUE, .load_opt=NULL}, + {.name = NULL, .toLoad = FALSE, .load_opt=NULL} +Index: xorg-server/hw/xfree86/dixmods/Makefile.am +=================================================================== +--- xorg-server.orig/hw/xfree86/dixmods/Makefile.am 2007-09-18 20:57:33.000000000 +0200 ++++ xorg-server/hw/xfree86/dixmods/Makefile.am 2007-09-18 21:02:26.000000000 +0200 +@@ -40,8 +40,7 @@ + $(XTRAPMOD) + + fontsmoduledir = $(moduledir)/fonts +-fontsmodule_LTLIBRARIES = libfreetype.la \ +- libtype1.la ++fontsmodule_LTLIBRARIES = libfreetype.la + + AM_CFLAGS = @XORG_CFLAGS@ @DIX_CFLAGS@ + INCLUDES = @XORG_INCS@ \ +@@ -104,9 +103,6 @@ + libfreetype_la_LDFLAGS = -avoid-version + libfreetype_la_SOURCES = ftmodule.c + +-libtype1_la_LDFLAGS = -avoid-version +-libtype1_la_SOURCES = type1mod.c +- + libdixmods_la_SOURCES = $(top_srcdir)/mi/miinitext.c + libdixmods_la_CFLAGS = -DXFree86LOADER $(AM_CFLAGS) + +Index: xorg-server/hw/xfree86/dixmods/type1mod.c +=================================================================== +--- xorg-server.orig/hw/xfree86/dixmods/type1mod.c 2007-09-10 14:32:05.000000000 +0200 ++++ /dev/null 1970-01-01 00:00:00.000000000 +0000 +@@ -1,75 +0,0 @@ +-/* +- * 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 "misc.h" +- +-#include +-#include "xf86Module.h" +- +-static MODULESETUPPROTO(type1Setup); +- +- /* +- * This is the module data function that is accessed when loading +- * libtype1 as a module. +- */ +- +-static XF86ModuleVersionInfo VersRec = +-{ +- "type1", +- MODULEVENDORSTRING, +- MODINFOSTRING1, +- MODINFOSTRING2, +- XORG_VERSION_CURRENT, +- 1, 0, 2, +- ABI_CLASS_FONT, /* Font module */ +- ABI_FONT_VERSION, +- MOD_CLASS_FONT, +- {0,0,0,0} /* signature, to be patched into the file by a tool */ +-}; +- +-_X_EXPORT XF86ModuleData type1ModuleData = { &VersRec, type1Setup, NULL }; +- +-extern void Type1RegisterFontFileFunctions(void); +- +-FontModule type1Module = { +- Type1RegisterFontFileFunctions, +- "Type1", +- NULL +-}; +- +-static pointer +-type1Setup(pointer module, pointer opts, int *errmaj, int *errmin) +-{ +- type1Module.module = module; +- LoadFont(&type1Module); +- +- /* Need a non-NULL return */ +- return (pointer)1; +-} +Index: xorg-server/hw/xfree86/doc/man/xorg.conf.man.pre +=================================================================== +--- xorg-server.orig/hw/xfree86/doc/man/xorg.conf.man.pre 2007-09-18 20:51:46.000000000 +0200 ++++ xorg-server/hw/xfree86/doc/man/xorg.conf.man.pre 2007-09-18 21:02:26.000000000 +0200 +@@ -700,10 +700,10 @@ + prefix, or the \(lq.a\(rq, \(lq.o\(rq, or \(lq.so\(rq suffixes. + .PP + .RS 7 +-Example: the Type 1 font rasteriser can be loaded with the following entry: ++Example: the FreeType font rasteriser can be loaded with the following entry: + .PP + .RS 4 +-.B "Load \*qtype1\*q" ++.B "Load \*qfreetype\*q" + .RE + .RE + .TP 7 --- xorg-server-1.4.2.orig/debian/patches/94_xprint_XSERVER_LIBS +++ xorg-server-1.4.2/debian/patches/94_xprint_XSERVER_LIBS @@ -0,0 +1,21 @@ +--- xorg-server.orig/hw/xprint/Makefile.am ++++ xorg-server/hw/xprint/Makefile.am +@@ -18,6 +18,7 @@ + $(top_builddir)/fb/libfb.la \ + $(top_builddir)/render/librender.la \ + $(XSERVER_LIBS) \ ++ $(top_builddir)/mi/libmi.la \ + $(top_builddir)/Xext/libXext.la \ + $(top_builddir)/xkb/libxkb.la \ + $(top_builddir)/xkb/libxkbstubs.la \ +--- xorg-server.orig/configure.ac ++++ xorg-server/configure.ac +@@ -1635,7 +1635,7 @@ + if test "x$XPRINT" = xyes; then + PKG_CHECK_MODULES([XPRINTMODULES], [printproto x11 xfont $XDMCP_MODULES xau]) + XPRINT_CFLAGS="$XPRINTMODULES_CFLAGS" +- XPRINT_LIBS="$XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS $MIEXT_DAMAGE_LIB $CWRAP_LIBS $XKB_LIB $XKB_STUB_LIB" ++ XPRINT_LIBS="$XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS $MIEXT_DAMAGE_LIB $CWRAP_LIBS $XKB_LIB $XKB_STUB_LIB $DIX_LIB $MI_LIB $OS_LIB" + XPRINT_SYS_LIBS="$XPRINTMODULES_LIBS" + + xpconfigdir=$libdir/X11/xserver --- xorg-server-1.4.2.orig/debian/patches/17_x86emu_handle_cpuid.patch +++ xorg-server-1.4.2/debian/patches/17_x86emu_handle_cpuid.patch @@ -0,0 +1,230 @@ +From e76dd7d7991b32cfc0f64bddcdcee201f34a85c5 Mon Sep 17 00:00:00 2001 +From: Bart Trojanowski +Date: Sat, 2 Feb 2008 12:21:57 -0500 +Subject: [PATCH] X86EMU: handle CPUID instruction + +This bug is tracked here: +https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-amd/+bug/180742 + +After trying to switch from X to VT (or just quit) the video-amd driver +attempts to issue INT 10/0 to go to mode 3 (VGA). The emulator, running +the BIOS code, would then spit out: + + c000:0282: A2 ILLEGAL EXTENDED X86 OPCODE! + +The opcode was 0F A2, or CPUID; it was not implemented in the emulator. +This simple patch, against 1.3.0.0, handles the CPUID instruction in one of +two ways: + 1) if ran on __i386__ or __x86_64__ then it calls the CPUID instruction + directly. + 2) if ran elsewhere it returns a canned 486dx4 set of values for + function 1. + +This fix allows the video-amd driver to switch back to console mode, +with the GSW BIOS. + +Thanks to Symbio Technologies for funding my work, and ThinCan for +providing hardware :) + +Signed-off-by: Bart Trojanowski +--- + hw/xfree86/x86emu/ops2.c | 16 ++++++- + hw/xfree86/x86emu/prim_ops.c | 44 +++++++++++++++++ + hw/xfree86/x86emu/x86emu/prim_ops.h | 1 + + hw/xfree86/x86emu/x86emu/prim_x86_gcc.h | 79 +++++++++++++++++++++++++++++++ + 4 files changed, 139 insertions(+), 1 deletions(-) + create mode 100644 hw/xfree86/x86emu/x86emu/prim_x86_gcc.h + +diff --git a/hw/xfree86/x86emu/ops2.c b/hw/xfree86/x86emu/ops2.c +index 8c6c535..324de8a 100644 +--- a/hw/xfree86/x86emu/ops2.c ++++ b/hw/xfree86/x86emu/ops2.c +@@ -328,6 +328,20 @@ static void x86emuOp2_pop_FS(u8 X86EMU_UNUSED(op2)) + } + + /**************************************************************************** ++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 + ****************************************************************************/ +@@ -2734,7 +2748,7 @@ void (*x86emu_optab2[256])(u8) = + + /* 0xa0 */ x86emuOp2_push_FS, + /* 0xa1 */ x86emuOp2_pop_FS, +-/* 0xa2 */ x86emuOp2_illegal_op, ++/* 0xa2 */ x86emuOp2_cpuid, + /* 0xa3 */ x86emuOp2_bt_R, + /* 0xa4 */ x86emuOp2_shld_IMM, + /* 0xa5 */ x86emuOp2_shld_CL, +diff --git a/hw/xfree86/x86emu/prim_ops.c b/hw/xfree86/x86emu/prim_ops.c +index 461e09e..07ccfe5 100644 +--- a/hw/xfree86/x86emu/prim_ops.c ++++ b/hw/xfree86/x86emu/prim_ops.c +@@ -102,6 +102,12 @@ + #define PRIM_OPS_NO_REDEFINE_ASM + #include "x86emu/x86emui.h" + ++#if defined(__GNUC__) ++# if defined (__i386__) || defined(__i386) || defined(__AMD64__) || defined(__x86_64__) || defined(__amd64__) ++# include "x86emu/prim_x86_gcc.h" ++# endif ++#endif ++ + /*------------------------- Global Variables ------------------------------*/ + + static u32 x86emu_parity_tab[8] = +@@ -2654,3 +2660,41 @@ DB( if (CHECK_SP_ACCESS()) + 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 ++ hw_cpuid(&M.x86.R_EAX, &M.x86.R_EBX, &M.x86.R_ECX, &M.x86.R_EDX); ++#endif ++ switch (feature) { ++ case 0: ++ M.x86.R_EAX = 1; // maximum function number we support ++#ifndef X86EMU_HAS_PRIM_CPUID ++ M.x86.R_EBX = 0x756e6547; ++ M.x86.R_ECX = 0x6c65746e; ++ M.x86.R_EDX = 0x49656e69; ++#endif ++ break; ++ case 1: ++#ifndef X86EMU_HAS_PRIM_CPUID ++ M.x86.R_EAX = 0x00000480; // 486dx4 ++ M.x86.R_EBX = 0x00000000; ++ M.x86.R_ECX = 0x00000000; ++ M.x86.R_EDX = 0x00000002; // VME ++#else ++ M.x86.R_EDX &= 0x00000012; // TSC and VME ++#endif ++ break; ++ default: ++ M.x86.R_EAX = 0; // don't support extended features ++ M.x86.R_EBX = 0; ++ M.x86.R_ECX = 0; ++ M.x86.R_EDX = 0; ++ break; ++ } ++} ++ +diff --git a/hw/xfree86/x86emu/x86emu/prim_ops.h b/hw/xfree86/x86emu/x86emu/prim_ops.h +index bea8357..6ac2a29 100644 +--- a/hw/xfree86/x86emu/x86emu/prim_ops.h ++++ b/hw/xfree86/x86emu/x86emu/prim_ops.h +@@ -133,6 +133,7 @@ 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++ */ +diff --git a/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h b/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h +new file mode 100644 +index 0000000..c085ddc +--- /dev/null ++++ b/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h +@@ -0,0 +1,79 @@ ++/**************************************************************************** ++* ++* 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(__x86_64__) || 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 +-- +1.5.3.7.1150.g149d432 + --- xorg-server-1.4.2.orig/debian/patches/03_auto_load_driver.diff +++ xorg-server-1.4.2/debian/patches/03_auto_load_driver.diff @@ -0,0 +1,335 @@ +Index: xorg-server/hw/xfree86/common/xf86AutoConfig.c +=================================================================== +--- xorg-server.orig/hw/xfree86/common/xf86AutoConfig.c ++++ xorg-server/hw/xfree86/common/xf86AutoConfig.c +@@ -39,6 +39,7 @@ + #include "xf86Config.h" + #include "xf86Priv.h" + #include "xf86_OSlib.h" ++#include "dirent.h" + + /* Sections for the default built-in configuration. */ + +@@ -292,3 +293,207 @@ + + return (ret == CONFIG_OK); + } ++ ++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; ++ } ++} ++ ++GDevPtr ++autoConfigDevice(GDevPtr preconf_device) ++{ ++ GDevPtr ptr = NULL; ++ confScreenPtr scrn = NULL; ++ ++ if (!xf86configptr) { ++ return NULL; ++ } ++ ++ /* If there's a configured section with no driver chosen, use it */ ++ if (preconf_device) { ++ ptr = preconf_device; ++ } else { ++ ptr = (GDevPtr)xalloc(sizeof(GDevRec)); ++ if (!ptr) { ++ return NULL; ++ } ++ memset((GDevPtr)ptr, 0, sizeof(GDevRec)); ++ ptr->chipID = -1; ++ ptr->chipRev = -1; ++ ptr->irq = -1; ++ ++ ptr->active = TRUE; ++ ptr->claimed = FALSE; ++ ptr->identifier = "Autoconfigured Video Device"; ++ ptr->driver = NULL; ++ } ++ if (!ptr->driver) { ++ ptr->driver = chooseVideoDriver(); ++ } ++ ++ /* TODO Handle multiple screen sections */ ++ if (xf86ConfigLayout.screens && !xf86ConfigLayout.screens->screen->device) { ++ xf86ConfigLayout.screens->screen->device = ptr; ++ ptr->myScreenSection = xf86ConfigLayout.screens->screen; ++ } ++ xf86Msg(X_DEFAULT, "Assigned the driver to the xf86ConfigLayout\n"); ++ ++ return ptr; ++} ++ ++char* ++chooseVideoDriver(void) ++{ ++ pciVideoPtr *pciptr, info = NULL; ++ DIR *idsdir; ++ FILE *fp; ++ struct dirent *direntry; ++ char *line = NULL; ++ char *chosen_driver = NULL; ++ size_t len; ++ ssize_t read; ++ char path_name[256], vendor_str[5], chip_str[5]; ++ int vendor, chip; ++ int i, j; ++ char *matches[20]; /* If we have more than 20 drivers we're in trouble */ ++ ++ for (i=0 ; i<20 ; i++) ++ matches[i] = NULL; ++ ++ /* Find the primary device, and get some information about it. */ ++ if (xf86PciVideoInfo) { ++ for (pciptr = xf86PciVideoInfo; (info = *pciptr); pciptr++) { ++ if (xf86IsPrimaryPci(info)) { ++ break; ++ } ++ } ++ if (!info) { ++ ErrorF("Primary device is not PCI\n"); ++ } ++ } else { ++ ErrorF("xf86PciVideoInfo is not set\n"); ++ } ++ ++ if (!info) { ++ ErrorF("Could not get primary PCI info\n"); ++ goto end; ++ } ++ ++ idsdir = opendir("/usr/share/xserver-xorg/pci"); ++ if (idsdir) { ++ 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 */ ++ strncpy(path_name, "/usr/share/xserver-xorg/pci/", 256); ++ strncat(path_name, direntry->d_name, (256 - strlen(path_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 */ ++ while ((read = getline(&line, &len, fp)) != -1) { ++ xchomp(line); ++ if (isdigit(line[0])) { ++ strncpy(vendor_str, line, 4); ++ vendor_str[4] = '\0'; ++ 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 */ ++ strncpy(chip_str, &line[4], 4); ++ chip_str[4] = '\0'; ++ chip = (int)strtol(chip_str, NULL, 16); ++ } ++ } ++ if (vendor == info->vendor && ++ (chip == info->chipType || chip == -1)) { ++ i = 0; ++ while (matches[i]) { ++ i++; ++ } ++ matches[i] = (char*)xalloc(sizeof(char) * strlen(direntry->d_name) - 3); ++ if (!matches[i]) { ++ 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] == '.') { ++ matches[i][j] = '\0'; ++ break; ++ } else { ++ matches[i][j] = direntry->d_name[j]; ++ } ++ } ++ xf86Msg(X_INFO, "Matched %s from file name %s in autoconfig\n", matches[i], direntry->d_name); ++ ++ } ++ } else { ++ /* TODO Handle driver overrides here */ ++ } ++ } ++ fclose(fp); ++ } ++ direntry = readdir(idsdir); ++ } ++ } ++ ++ /* TODO Handle multiple drivers claiming to support the same PCI ID */ ++ if (matches[0]) { ++ chosen_driver = matches[0]; ++ } else { ++ #if defined __i386__ || defined __amd64__ || defined __hurd__ ++ chosen_driver = "vesa"; ++ #elif defined __alpha__ ++ chosen_driver = "vga"; ++ #elif defined __sparc__ ++ chosen_driver = "sunffb"; ++ #else ++ chosen_driver = "fbdev"; ++ #endif ++ } ++ ++ xf86Msg(X_DEFAULT, "Matched %s for the autoconfigured driver\n", chosen_driver); ++ ++ end: ++ i = 0; ++ while (matches[i]) { ++ if (matches[i] != chosen_driver) { ++ xfree(matches[i]); ++ } ++ i++; ++ } ++ xfree(line); ++ closedir(idsdir); ++ ++ return chosen_driver; ++} +Index: xorg-server/hw/xfree86/common/xf86Config.c +=================================================================== +--- xorg-server.orig/hw/xfree86/common/xf86Config.c ++++ xorg-server/hw/xfree86/common/xf86Config.c +@@ -1928,8 +1928,10 @@ + return FALSE; + } + screenp->device = xnfcalloc(1, sizeof(GDevRec)); +- configDevice(screenp->device,conf_screen->scrn_device, TRUE); +- screenp->device->myScreenSection = screenp; ++ if (configDevice(screenp->device,conf_screen->scrn_device, TRUE)) ++ screenp->device->myScreenSection = screenp; ++ else ++ screenp->device = NULL; + screenp->options = conf_screen->scrn_option_lst; + + /* +@@ -2218,13 +2220,17 @@ + { + int i; + ++ if (!conf_device) { ++ return FALSE; ++ } ++ + if (active) + 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; +Index: xorg-server/hw/xfree86/common/xf86Config.h +=================================================================== +--- xorg-server.orig/hw/xfree86/common/xf86Config.h ++++ xorg-server/hw/xfree86/common/xf86Config.h +@@ -34,6 +34,8 @@ + #define _xf86_config_h + + #include "xf86Optrec.h" ++#include "xf86Parser.h" ++#include "xf86str.h" + + #ifdef HAVE_PARSER_DECLS + /* +@@ -76,5 +78,8 @@ + ConfigStatus xf86HandleConfigFile(Bool); + + Bool xf86AutoConfig(void); ++GDevPtr autoConfigDevice(GDevPtr preconf_device); ++char* chooseVideoDriver(void); ++int xchomp(char *line); + + #endif /* _xf86_config_h */ +Index: xorg-server/hw/xfree86/common/xf86Init.c +=================================================================== +--- xorg-server.orig/hw/xfree86/common/xf86Init.c ++++ xorg-server/hw/xfree86/common/xf86Init.c +@@ -347,6 +347,16 @@ + } + + /* 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*/ ++ GDevPtr 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); + xfree(modulelist); +Index: xorg-server/hw/xfree86/parser/Screen.c +=================================================================== +--- xorg-server.orig/hw/xfree86/parser/Screen.c ++++ xorg-server/hw/xfree86/parser/Screen.c +@@ -526,15 +526,7 @@ + } + } + +- device = xf86findDevice (screen->scrn_device_str, p->conf_device_lst); +- if (!device) +- { +- xf86validationError (UNDEFINED_DEVICE_MSG, +- screen->scrn_device_str, screen->scrn_identifier); +- return (FALSE); +- } +- else +- screen->scrn_device = device; ++ screen->scrn_device= xf86findDevice (screen->scrn_device_str, p->conf_device_lst); + + adaptor = screen->scrn_adaptor_lst; + while (adaptor) +Index: xorg-server/hw/xfree86/parser/read.c +=================================================================== +--- xorg-server.orig/hw/xfree86/parser/read.c ++++ xorg-server/hw/xfree86/parser/read.c +@@ -80,8 +80,8 @@ + static int + xf86validateConfig (XF86ConfigPtr p) + { +- if (!xf86validateDevice (p)) +- return FALSE; ++ /*if (!xf86validateDevice (p)) ++ return FALSE;*/ + if (!xf86validateScreen (p)) + return FALSE; + if (!xf86validateInput (p)) --- xorg-server-1.4.2.orig/debian/patches/43_allow_override_BIOS_EDID_preferred_mode.diff +++ xorg-server-1.4.2/debian/patches/43_allow_override_BIOS_EDID_preferred_mode.diff @@ -0,0 +1,131 @@ +https://bugs.freedesktop.org/show_bug.cgi?id=10625 + +From Keith Packard. +Prefers user-specified PreferredMode over EDID/BIOS specified preferred modes. +It should cause the config file to override the EDID/BIOS detected preferred modes. + +# modified: hw/xfree86/common/xf86str.h +# modified: hw/xfree86/modes/xf86Crtc.c +# modified: hw/xfree86/modes/xf86Crtc.h +# +Index: xorg-server/hw/xfree86/common/xf86str.h +=================================================================== +--- xorg-server.orig/hw/xfree86/common/xf86str.h ++++ xorg-server/hw/xfree86/common/xf86str.h +@@ -132,6 +132,7 @@ + # 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 */ + + /* Video mode */ + typedef struct _DisplayModeRec { +Index: xorg-server/hw/xfree86/modes/xf86Crtc.c +=================================================================== +--- xorg-server.orig/hw/xfree86/modes/xf86Crtc.c ++++ xorg-server/hw/xfree86/modes/xf86Crtc.c +@@ -711,7 +711,8 @@ + for (mode = output->probed_modes; mode; mode = mode->next) + { + int dpi; +- int preferred = (mode->type & M_T_PREFERRED) != 0; ++ int preferred = (((mode->type & M_T_PREFERRED) != 0) + ++ ((mode->type & M_T_USERPREF) != 0)); + int diff; + + if (xf86ModeWidth (mode, output->initial_rotation) > width || +@@ -1431,7 +1432,7 @@ + mode->prev = NULL; + output->probed_modes = mode; + } +- mode->type |= M_T_PREFERRED; ++ mode->type |= (M_T_PREFERRED|M_T_USERPREF); + } + else + mode->type &= ~M_T_PREFERRED; +@@ -1548,6 +1549,7 @@ + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + int o, c; + DisplayModePtr target_mode = NULL; ++ int target_preferred = 0; + Rotation target_rotation = RR_Rotate_0; + xf86CrtcPtr *crtcs; + DisplayModePtr *modes; +@@ -1588,43 +1590,34 @@ + } + + /* +- * Let outputs with preferred modes drive screen size ++ * User preferred > preferred > other modes + */ + for (o = 0; o < config->num_output; o++) + { +- xf86OutputPtr output = config->output[o]; ++ xf86OutputPtr output = config->output[o]; ++ DisplayModePtr default_mode; ++ int default_preferred; + +- if (enabled[o] && +- xf86OutputHasPreferredMode (output, width, height)) ++ if (!enabled[o]) ++ continue; ++ default_mode = xf86DefaultMode (output, 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 = xf86DefaultMode (output, width, height); ++ target_mode = default_mode; ++ target_preferred = default_preferred; + target_rotation = output->initial_rotation; +- if (target_mode) +- { +- modes[o] = target_mode; +- config->compat_output = o; +- break; +- } +- } +- } +- if (!target_mode) +- { +- for (o = 0; o < config->num_output; o++) +- { +- xf86OutputPtr output = config->output[o]; +- if (enabled[o]) +- { +- target_mode = xf86DefaultMode (output, width, height); +- target_rotation = output->initial_rotation; +- if (target_mode) +- { +- modes[o] = target_mode; +- config->compat_output = o; +- break; +- } +- } ++ config->compat_output = o; + } + } ++ if (target_mode) ++ modes[config->compat_output] = target_mode; ++ /* ++ * Fill in other output modes ++ */ + for (o = 0; o < config->num_output; o++) + { + xf86OutputPtr output = config->output[o]; +Index: xorg-server/hw/xfree86/modes/xf86Crtc.h +=================================================================== +--- xorg-server.orig/hw/xfree86/modes/xf86Crtc.h ++++ xorg-server/hw/xfree86/modes/xf86Crtc.h +@@ -39,6 +39,9 @@ + #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 --- xorg-server-1.4.2.orig/debian/patches/50_Make-RandRQueryVersion-return-1.1-for-swapped-client.patch +++ xorg-server-1.4.2/debian/patches/50_Make-RandRQueryVersion-return-1.1-for-swapped-client.patch @@ -0,0 +1,31 @@ +From 40090eca032d602c78223abaa13ca4702db86b74 Mon Sep 17 00:00:00 2001 +From: Julien Cristau +Date: Sun, 24 Aug 2008 17:44:10 +0200 +Subject: [PATCH] Make RandRQueryVersion return 1.1 for swapped clients + +Don't pretend we support randr 1.2 when queried by swapped clients. +The dispatch code for RandR 1.2 requests would return BadImplementation +anyway. +--- + randr/rrdispatch.c | 5 +++++ + 1 files changed, 5 insertions(+), 0 deletions(-) + +diff --git a/randr/rrdispatch.c b/randr/rrdispatch.c +index 5525427..83deb6b 100644 +--- a/randr/rrdispatch.c ++++ b/randr/rrdispatch.c +@@ -55,6 +55,11 @@ ProcRRQueryVersion (ClientPtr client) + rep.majorVersion = SERVER_RANDR_MAJOR; + rep.minorVersion = SERVER_RANDR_MINOR; + if (client->swapped) { ++ /* ++ * We return BadImplementation for swapped clients on 1.2 requests, ++ * let's not do that ++ */ ++ rep.minorVersion = 1; + swaps(&rep.sequenceNumber, n); + swapl(&rep.length, n); + swapl(&rep.majorVersion, n); +-- +1.5.6.3 + --- xorg-server-1.4.2.orig/debian/patches/15_X86EMU-added-blacklist-for-I-O-port-in-0-0xFF-range.patch +++ xorg-server-1.4.2/debian/patches/15_X86EMU-added-blacklist-for-I-O-port-in-0-0xFF-range.patch @@ -0,0 +1,190 @@ +From 6061612987ebba7ca65835e658b8d969be13a22d Mon Sep 17 00:00:00 2001 +From: Bart Trojanowski +Date: Fri, 11 Jan 2008 11:52:59 -0500 +Subject: [PATCH] X86EMU: added blacklist for I/O port in 0-0xFF range + +Signed-off-by: Bart Trojanowski + +Work funded by: Symbio Technologies + +There seems to be an inconsistency between what the x86emu gets from the +PCI handling code and by accessing hardware directly. x86emu relies on +a set of functions to emulate PCI access. When things goes wrong, the +emulator is asked to execute an OUT instruction on port 0x20. + +I've put together a patch against xserver-xorg package that prevents +accesses to BAD registers. This turns a freeze into a segfault in X. + +http://www.jukie.net/~bart/patches/xorg-server/20080111/0001-X86EMU- +added-blacklist-for-I-O-port-in-0-0xFF-range.patch + +It does not address the DDC not working, I hope that after fixing the +bugs in x86emu, things may improve. + +Anyway, I am continuing to investigate the real cause of the PCI access +issue. To find out more read this thread: + +http://lists.freedesktop.org/archives/xorg/2008-January/031811.html + +-Bart + + +diff -Nurp xorg-server-1.4.1~git20080118/hw/xfree86/int10/helper_exec.c xorg-server-1.4.1~git20080118-working/hw/xfree86/int10/helper_exec.c +--- xorg-server-1.4.1~git20080118/hw/xfree86/int10/helper_exec.c 2008-01-18 13:23:40.000000000 -0800 ++++ xorg-server-1.4.1~git20080118-working/hw/xfree86/int10/helper_exec.c 2008-01-22 09:53:27.000000000 -0800 +@@ -21,6 +21,8 @@ + #define PRINT_PORT 0 + + #include ++#include ++#include + + #include + #include "xf86.h" +@@ -210,6 +212,72 @@ stack_trace(xf86Int10InfoPtr pInt) + xf86ErrorFVerb(3, "\n"); + } + ++enum port_action_e { ++ PORT_ACTION_PERMIT, ++ PORT_ACTION_WARN, ++ PORT_ACTION_BAIL, ++ PORT_ACTION_MAX ++}; ++ ++static const struct port_range { ++ CARD16 start, end; ++ enum port_action_e access; ++} port_range_table[] = { ++ // NOTE: port ranges are non overlapping and sorted ++ { 0x00, 0x1f, PORT_ACTION_BAIL }, // DMA ++ { 0x20, 0x21, PORT_ACTION_BAIL }, // PIC ++ { 0x40, 0x47, PORT_ACTION_BAIL }, // PIT 1&2 ++ { 0x50, 0x53, PORT_ACTION_BAIL }, ++ { 0x70, 0x77, PORT_ACTION_BAIL }, // CMOS/RTC ++ { 0x81, 0x8f, PORT_ACTION_BAIL }, // DIAG REGS ++ { 0xa0, 0xa1, PORT_ACTION_BAIL }, // PIC2 ++ { 0xc0, 0xdf, PORT_ACTION_BAIL }, // DMA ++}; ++#define ARRAY_SIZE(X) (sizeof((X)) / (sizeof(*(X)))) ++#define ARRAY_END(X) (&((X)[ARRAY_SIZE(X)])) ++ ++static void assert_port_access_allowed (CARD16 port, CARD16 width) ++{ ++ CARD16 access_start, access_end; ++ const struct port_range *pr, *pr_start, *pr_end; ++ ++ access_start = port; ++ access_end = port + width - 1; ++ ++ // TODO: if the list gets too long we should do a binary search ++ // or convert the port list to a bitmap representation ++ pr_start = port_range_table; ++ pr_end = ARRAY_END(port_range_table); ++ ++ for (pr = pr_start; pr < pr_end; pr++) { ++ if (access_end < pr->start) ++ continue; ++ if (access_start > pr->end) ++ break; ++ ++ // we are in the pr range now ++ switch (pr->access) { ++ default: ++ continue; ++ case PORT_ACTION_BAIL: ++ case PORT_ACTION_WARN: ++ break; ++ } ++ ++ ErrorF("Emulator asked to make a suspect %saccess to " ++ "port %u (0x%04x)%s\n", ++ (width == 1) ? "byte " : ++ (width == 2) ? "word " : ++ (width == 4) ? "long " : "", ++ port, port, ++ (pr->access == PORT_ACTION_BAIL) ++ ? "; terminating." : "ignoring."); ++ ++ if (pr->access == PORT_ACTION_BAIL) ++ kill(getpid(), SIGSEGV); ++ } ++} ++ + int + port_rep_inb(xf86Int10InfoPtr pInt, + CARD16 port, CARD32 base, int d_f, CARD32 count) +@@ -319,7 +387,7 @@ x_inb(CARD16 port) + ErrorF(" inb(%#x) = %2.2x\n", port, val); + #ifdef __NOT_YET__ + } else if (port < 0x0100) { /* Don't interfere with mainboard */ +- val = 0; ++ val = 0; + xf86DrvMsgVerb(Int10Current->scrnIndex, X_NOT_IMPLEMENTED, 2, + "inb 0x%4.4x\n", port); + if (xf86GetVerbosity() > 3) { +@@ -327,10 +395,14 @@ x_inb(CARD16 port) + stack_trace(Int10Current); + } + #endif /* __NOT_YET__ */ +- } else if (!pciCfg1inb(port, &val)) { +- val = inb(Int10Current->ioBase + port); +- if (PRINT_PORT && DEBUG_IO_TRACE()) +- ErrorF(" inb(%#x) = %2.2x\n", port, val); ++ } else { ++ assert_port_access_allowed (port, sizeof(val)); ++ ++ if (!pciCfg1inb(port, &val)) { ++ val = inb(Int10Current->ioBase + port); ++ if (PRINT_PORT && DEBUG_IO_TRACE()) ++ ErrorF(" inb(%#x) = %2.2x\n", port, val); ++ } + } + return val; + } +@@ -349,10 +421,14 @@ x_inw(CARD16 port) + */ + X_GETTIMEOFDAY(&tv); + val = (CARD16)(tv.tv_usec / 3); +- } else if (!pciCfg1inw(port, &val)) { +- val = inw(Int10Current->ioBase + port); +- if (PRINT_PORT && DEBUG_IO_TRACE()) +- ErrorF(" inw(%#x) = %4.4x\n", port, val); ++ } else { ++ assert_port_access_allowed (port, sizeof(val)); ++ ++ if (!pciCfg1inw(port, &val)) { ++ val = inw(Int10Current->ioBase + port); ++ if (PRINT_PORT && DEBUG_IO_TRACE()) ++ ErrorF(" inw(%#x) = %4.4x\n", port, val); ++ } + } + return val; + } +@@ -384,6 +460,8 @@ x_outb(CARD16 port, CARD8 val) + } else if (!pciCfg1outb(port, val)) { + if (PRINT_PORT && DEBUG_IO_TRACE()) + ErrorF(" outb(%#x, %2.2x)\n", port, val); ++ ++ assert_port_access_allowed (port, sizeof(val)); + outb(Int10Current->ioBase + port, val); + } + } +@@ -404,6 +482,8 @@ x_inl(CARD16 port) + { + CARD32 val; + ++ assert_port_access_allowed (port, sizeof(val)); ++ + if (!pciCfg1in(port, &val)) { + val = inl(Int10Current->ioBase + port); + if (PRINT_PORT && DEBUG_IO_TRACE()) +@@ -418,6 +498,8 @@ x_outl(CARD16 port, CARD32 val) + if (!pciCfg1out(port, val)) { + if (PRINT_PORT && DEBUG_IO_TRACE()) + ErrorF(" outl(%#x, %8.8x)\n", port, val); ++ ++ assert_port_access_allowed (port, sizeof(val)); + outl(Int10Current->ioBase + port, val); + } + } --- xorg-server-1.4.2.orig/debian/patches/18_glx_initialize_getvisualconfigs_buf.diff +++ xorg-server-1.4.2/debian/patches/18_glx_initialize_getvisualconfigs_buf.diff @@ -0,0 +1,23 @@ +From: Guillaume Melquiond +Subject: GLX: initialize the buffer in GetVisualConfigs + +Backport from edad0a9dfebcce5c54b2f9c32bd9d45549e20c51. + +http://bugs.freedesktop.org/show_bug.cgi?id=13358 +http://bugs.freedesktop.org/show_bug.cgi?id=13863 + +Index: xorg-server/GL/glx/glxcmds.c +=================================================================== +--- xorg-server.orig/GL/glx/glxcmds.c ++++ xorg-server/GL/glx/glxcmds.c +@@ -992,6 +992,10 @@ + buf[p++] = GLX_TRANSPARENT_INDEX_VALUE; + buf[p++] = modes->transparentIndex; + ++ while (p < __GLX_TOTAL_CONFIG) { ++ buf[p++] = 0; ++ } ++ + if ( do_swap ) { + __GLX_SWAP_INT_ARRAY(buf, __GLX_TOTAL_CONFIG); + } --- xorg-server-1.4.2.orig/debian/patches/52_xevie-swap-replies.diff +++ xorg-server-1.4.2/debian/patches/52_xevie-swap-replies.diff @@ -0,0 +1,110 @@ +From b5cdcfa55c399e83d51242e93d4f25d8bc4fec1f Mon Sep 17 00:00:00 2001 +From: Julien Cristau +Date: Mon, 1 Sep 2008 19:45:30 +0200 +Subject: [PATCH] Xevie: swap replies as necessary + +--- + Xext/xevie.c | 27 +++++++++++++++++++++++++++ + 1 files changed, 27 insertions(+), 0 deletions(-) + +Index: xorg-server/Xext/xevie.c +=================================================================== +--- xorg-server.orig/Xext/xevie.c ++++ xorg-server/Xext/xevie.c +@@ -167,6 +167,7 @@ + int ProcQueryVersion (register ClientPtr client) + { + xXevieQueryVersionReply rep; ++ int n; + + REQUEST_SIZE_MATCH (xXevieQueryVersionReq); + rep.type = X_Reply; +@@ -174,6 +175,12 @@ + rep.sequence_number = client->sequence; + rep.server_major_version = XEVIE_MAJOR_VERSION; + rep.server_minor_version = XEVIE_MINOR_VERSION; ++ if (client->swapped) { ++ swaps(&rep.sequence_number, n); ++ swapl(&rep.length, n); ++ swaps(&rep.server_major_version, n); ++ swaps(&rep.server_minor_version, n); ++ } + WriteToClient (client, sizeof (xXevieQueryVersionReply), (char *)&rep); + return client->noClientException; + } +@@ -182,6 +189,7 @@ + int ProcStart (register ClientPtr client) + { + xXevieStartReply rep; ++ int n; + + REQUEST_SIZE_MATCH (xXevieStartReq); + rep.pad1 = 0; +@@ -216,6 +224,10 @@ + rep.length = 0; + rep.type = X_Reply; + rep.sequence_number = client->sequence; ++ if (client->swapped) { ++ swaps(&rep.sequence_number, n); ++ swapl(&rep.length, n); ++ } + WriteToClient (client, sizeof (xXevieStartReply), (char *)&rep); + return client->noClientException; + } +@@ -224,6 +236,7 @@ + int ProcEnd (register ClientPtr client) + { + xXevieEndReply rep; ++ int n; + + if (xevieFlag) { + if (client->index != xevieClientIndex) +@@ -236,6 +249,10 @@ + rep.length = 0; + rep.type = X_Reply; + rep.sequence_number = client->sequence; ++ if (client->swapped) { ++ swaps(&rep.sequence_number, n); ++ swapl(&rep.length, n); ++ } + WriteToClient (client, sizeof (xXevieEndReply), (char *)&rep); + return client->noClientException; + } +@@ -247,6 +264,7 @@ + xXevieSendReply rep; + xEvent *xE; + static unsigned char lastDetail = 0, lastType = 0; ++ int n; + + if (client->index != xevieClientIndex) + return BadAccess; +@@ -255,6 +273,10 @@ + rep.length = 0; + rep.type = X_Reply; + rep.sequence_number = client->sequence; ++ if (client->swapped) { ++ swaps(&rep.sequence_number, n); ++ swapl(&rep.length, n); ++ } + WriteToClient (client, sizeof (xXevieSendReply), (char *)&rep); + + switch(xE->u.u.type) { +@@ -292,6 +314,7 @@ + { + REQUEST (xXevieSelectInputReq); + xXevieSelectInputReply rep; ++ int n; + + if (client->index != xevieClientIndex) + return BadAccess; +@@ -300,6 +323,10 @@ + rep.length = 0; + rep.type = X_Reply; + rep.sequence_number = client->sequence; ++ if (client->swapped) { ++ swaps(&rep.sequence_number, n); ++ swapl(&rep.length, n); ++ } + WriteToClient (client, sizeof (xXevieSelectInputReply), (char *)&rep); + return client->noClientException; + } --- xorg-server-1.4.2.orig/debian/local/xvfb-run +++ xorg-server-1.4.2/debian/local/xvfb-run @@ -0,0 +1,183 @@ +#!/bin/sh + +# $Id: xvfb-run 2027 2004-11-16 14:54:16Z branden $ + +# This script starts an instance of Xvfb, the "fake" X server, runs a command +# with that server available, and kills the X server when done. The return +# value of the command becomes the return value of this script. +# +# If anyone is using this to build a Debian package, make sure the package +# Build-Depends on xvfb, xbase-clients, and xfonts-base. + +set -e + +PROGNAME=xvfb-run +SERVERNUM=99 +AUTHFILE= +ERRORFILE=/dev/null +STARTWAIT=3 +XVFBARGS="-screen 0 640x480x8" +LISTENTCP="-nolisten tcp" +XAUTHPROTO=. + +# Query the terminal to establish a default number of columns to use for +# displaying messages to the user. This is used only as a fallback in the event +# the COLUMNS variable is not set. ($COLUMNS can react to SIGWINCH while the +# script is running, and this cannot, only being calculated once.) +DEFCOLUMNS=$(stty size 2>/dev/null | awk '{print $2}') || true +if ! expr "$DEFCOLUMNS" : "[[:digit:]]\+$" >/dev/null 2>&1; then + DEFCOLUMNS=80 +fi + +# Display a message, wrapping lines at the terminal width. +message () { + echo "$PROGNAME: $*" | fmt -t -w ${COLUMNS:-$DEFCOLUMNS} +} + +# Display an error message. +error () { + message "error: $*" >&2 +} + +# Display a usage message. +usage () { + if [ -n "$*" ]; then + message "usage error: $*" + fi + cat <>"$ERRORFILE" 2>&1 + fi + if [ -n "$XVFB_RUN_TMPDIR" ]; then + if ! rm -r "$XVFB_RUN_TMPDIR"; then + error "problem while cleaning up temporary directory" + exit 5 + fi + fi +} + +# Parse the command line. +ARGS=$(getopt --options +ae:f:hn:lp:s:w: \ + --long auto-servernum,error-file:,auth-file:,help,server-num:,listen-tcp,xauth-protocol:,server-args:,wait: \ + --name "$PROGNAME" -- "$@") +GETOPT_STATUS=$? + +if [ $GETOPT_STATUS -ne 0 ]; then + error "internal error; getopt exited with status $GETOPT_STATUS" + exit 6 +fi + +eval set -- "$ARGS" + +while :; do + case "$1" in + -a|--auto-servernum) SERVERNUM=$(find_free_servernum) ;; + -e|--error-file) ERRORFILE="$2"; shift ;; + -f|--auth-file) AUTHFILE="$2"; shift ;; + -h|--help) SHOWHELP="yes" ;; + -n|--server-num) SERVERNUM="$2"; shift ;; + -l|--listen-tcp) LISTENTCP="" ;; + -p|--xauth-protocol) XAUTHPROTO="$2"; shift ;; + -s|--server-args) XVFBARGS="$2"; shift ;; + -w|--wait) STARTWAIT="$2"; shift ;; + --) shift; break ;; + *) error "internal error; getopt permitted \"$1\" unexpectedly" + exit 6 + ;; + esac + shift +done + +if [ "$SHOWHELP" ]; then + usage + exit 0 +fi + +if [ -z "$*" ]; then + usage "need a command to run" >&2 + exit 2 +fi + +if ! which xauth >/dev/null; then + error "xauth command not found" + exit 3 +fi + +# tidy up after ourselves +trap clean_up EXIT + +# If the user did not specify an X authorization file to use, set up a temporary +# directory to house one. +if [ -z "$AUTHFILE" ]; then + XVFB_RUN_TMPDIR="${TMPDIR:-/tmp}/$PROGNAME.$$" + if ! mkdir -p -m 700 "$XVFB_RUN_TMPDIR"; then + error "temporary directory $XVFB_RUN_TMPDIR already exists" + exit 4 + fi + AUTHFILE=$(tempfile -n "$XVFB_RUN_TMPDIR/Xauthority") +fi + +# Start Xvfb. +MCOOKIE=$(mcookie) +XAUTHORITY=$AUTHFILE xauth add ":$SERVERNUM" "$XAUTHPROTO" "$MCOOKIE" \ + >>"$ERRORFILE" 2>&1 +XAUTHORITY=$AUTHFILE Xvfb ":$SERVERNUM" $XVFBARGS $LISTENTCP >>"$ERRORFILE" \ + 2>&1 & +XVFBPID=$! +sleep "$STARTWAIT" +if ! kill -0 $XVFBPID 2>/dev/null; then + echo "Xvfb failed to start" >&2 + exit 1 +fi + +# Start the command and save its exit status. +set +e +DISPLAY=:$SERVERNUM XAUTHORITY=$AUTHFILE "$@" 2>&1 +RETVAL=$? +set -e + +# Kill Xvfb now that the command has exited. +kill $XVFBPID + +# Return the executed command's exit status. +exit $RETVAL + +# vim:set ai et sts=4 sw=4 tw=80: --- xorg-server-1.4.2.orig/debian/local/xvfb-run.1 +++ xorg-server-1.4.2/debian/local/xvfb-run.1 @@ -0,0 +1,282 @@ +.\" $Id: xvfb-run.1 2138 2005-01-17 23:40:27Z branden $ +.\" +.\" Copyright 1998-2004 Branden Robinson . +.\" +.\" This is free software; you may 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 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 with +.\" the Debian operating system, in /usr/share/common-licenses/GPL; if +.\" not, write to the Free Software Foundation, Inc., 59 Temple Place, +.\" Suite 330, Boston, MA 02111-1307 USA +.\" +.\" We need the URL macro from groff's www macro package, but also want +.\" things to work all right for people who don't have it. So we define +.\" our own URL macro and let the www macro package override it if it's +.\" available. +.de URL +\\$2 \(laURL: \\$1 \(ra\\$3 +.. +.if \n[.g] .mso www.tmac +.TH xvfb\-run 1 "2004\-11\-12" "Debian Project" +.SH NAME +xvfb\-run \- run specified X client or command in a virtual X server environment +.SH SYNOPSIS +.B xvfb\-run +[ +.I options +] +.I command +.SH DESCRIPTION +.B xvfb\-run +is a wrapper for the +.BR Xvfb (1x) +command which simplifies the task of running commands (typically an X +client, or a script containing a list of clients to be run) within a virtual +X server environment. +.PP +.B xvfb\-run +sets up an X authority file (or uses an existing user\-specified one), +writes a cookie to it (see +.BR xauth (1x)) +and then starts the +.B Xvfb +X server as a background process. +The process ID of +.B Xvfb +is stored for later use. +The specified +.I command +is then run using the X display corresponding to the +.B Xvfb +server +just started and the X authority file created earlier. +.PP +When the +.I command +exits, its status is saved, the +.B Xvfb +server is killed (using the process ID stored earlier), the X authority +cookie removed, and the authority file deleted (if the user did not specify +one to use). +.B xvfb\-run +then exits with the exit status of +.IR command . +.PP +.B xvfb\-run +requires the +.B xauth +command to function. +.SH OPTIONS +.TP +.B \-a\fR,\fB \-\-auto\-servernum +Try to get a free server number, starting at 99, or the argument to +.BR \-\-server\-num . +.TP +.BI \-e\ file \fR,\fB\ \-\-error\-file= file +Store output from +.B xauth +and +.B Xvfb +in +.IR file . +The default is +.IR /dev/null . +.TP +.BI \-f\ file \fR,\fB\ \-\-auth\-file= file +Store X authentication data in +.IR file . +By default, a temporary directory called +.IR xvfb\-run. PID +(where PID is the process ID of +.B xvfb\-run +itself) is created in the directory specified by the environment variable +.B TMPDIR +(or +.I /tmp +if that variable is null or unset), and the +.BR tempfile (1) +command is used to create a file in that temporary directory called +.IR Xauthority . +.TP +.B \-h\fR,\fB \-\-help +Display a usage message and exit. +.TP +.BI \-n\ servernumber \fR,\fB\ \-\-server\-num= servernumber +Use +.I servernumber +as the server number (but see the +.B \-a\fR,\fB \-\-auto\-servernum +option above). +The default is 99. +.TP +.B \-l\fR,\fB \-\-listen\-tcp +Enable TCP port listening in the X server. +For security reasons (to avoid denial\-of\-service attacks or exploits), +TCP port listening is disabled by default. +.TP +.BI \-p\ protocolname \fR,\fB\ \-\-xauth\-protocol= protocolname +Use +.I protocolname +as the X authority protocol to use. +The default is \(oq.\(cq, which +.B xauth +interprets as its own default protocol, which is MIT\-MAGIC\-COOKIE\-1. +.TP +.BI \-s\ arguments \fR,\fB\ \-\-server\-args= arguments +Pass +.I arguments +to the +.B Xvfb +server. +Be careful to quote any whitespace characters that may occur within +.I arguments +to prevent them from regarded as separators for +.BR xvfb\-run 's +own arguments. +Also, note that specification of \(oq\-nolisten tcp\(cq in +.I arguments +may override the function of +.BR xvfb\-run 's +own +.B \-l\fR,\fB \-\-listen\-tcp +option, and that specification of the server number (e.g., \(oq:1\(cq) may +be ignored because of the way the X server parses its argument list. +Use the +.B xvfb\-run +option +.BI \-n\ servernumber \fR,\fB\ \-\-server\-num= servernumber +to achieve the latter function. +The default is \(oq\-screen 0 640x480x8\(cq. +.TP +.BI \-w\ delay \fR,\fB\ \-\-wait= delay +Wait +.I delay +seconds after launching +.B Xvfb +before attempting to start the specified command. +The default is 3. +.SH ENVIRONMENT +.TP +.B COLUMNS +indicates the width of the terminal device in character cells. +This value is used for formatting diagnostic messages. +If not set, the terminal is queried using +.BR stty (1) +to determine its width. +If that fails, a value of \(oq80\(cq is assumed. +.TP +.B TMPDIR +specifies the directory in which to place +.BR xvfb\-run 's +temporary directory for storage of the X authority file; only used if the +.B \-f +or +.B \-\-auth\-file +options are not specified. +.SH "OUTPUT FILES" +.PP +Unless the +.B \-f +or +.B \-\-auth\-file +options are specified, a temporary +directory and file within it are created (and deleted) to store the X +authority cookies used by the +.B Xvfb +server and client(s) run under it. +See +.BR tempfile (1). +If \-f or \-\-auth\-file are used, then the specified X authority file is +only written to, not created or deleted (though +.B xauth +creates an authority file itself if told to use use that does not already +exist). +.PP +An error file with a user\-specified name is also created if the +.B \-e +or +.B \-\-error\-file +options are specifed; see above. +.SH "EXIT STATUS" +.B xvfb\-run +uses its exit status as well as output to standard error to communicate +diagnostics. +The exit status of \(oq1\(cq is not used, and should be interpreted as failure +of the specified command. +.TP +0 +.B xvfb\-run +only uses this exit status if the +.B \-h\fR,\fB \-\-help +option is given. +In all other situations, this may be interpreted as success of the specified +command. +.TP +2 +No command to run was specified. +.TP +3 +The +.B xauth +command is not available. +.TP +4 +The temporary directory that was going to be used already exists; since +.B xvfb\-run +produces a uniquely named directory, this may indicate an attempt by another +process on the system to exploit a temporary file race condition. +.TP +5 +A problem was encountered while cleaning up the temporary directory. +.TP +6 +A problem was encountered while using +.BR getopt (1) +to parse the command\-line arguments. +.SH EXAMPLES +.TP +.B xvfb\-run \-\-auto\-servernum \-\-server\-num=1 xlogo +runs the +.BR xlogo (1x) +demonstration client inside the +.B Xvfb +X server on the first available server number greater than or equal to 1. +.TP +.B xvfb\-run \-\-server\-args="\-screen 0 1024x768x24" ico \-faces +runs the +.BR ico (1x) +demonstration client (and passes it the +.B \-faces +argument) inside the +.B Xvfb +X server, configured with a root window of 1024 by 768 pixels and a color +depth of 24 bits. +.PP +Note that the demo X clients used in the above examples will not exit on +their own, so they will have to be killed before +.B xvfb\-run +will exit. +.SH BUGS +See +.URL "http://bugs.debian.org/xvfb" "the Debian Bug Tracking System" . +If you wish to report a bug in +.BR xvfb\-run , +please use the +.BR reportbug (1) +command. +.SH AUTHOR +.B xfvb\-run +was written by Branden Robinson and Jeff Licquia with sponsorship from +Progeny Linux Systems. +.SH "SEE ALSO" +.BR Xvfb (1x), +.BR xauth (1x) +.\" vim:set et tw=80: --- xorg-server-1.4.2.orig/afb/Makefile.in +++ xorg-server-1.4.2/afb/Makefile.in @@ -161,7 +161,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -295,10 +295,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/exa/exa.c +++ xorg-server-1.4.2/exa/exa.c @@ -365,7 +365,7 @@ if (!(*pExaScr->info->PrepareAccess) (pPixmap, index)) { ExaPixmapPriv (pPixmap); - if (pExaPixmap->score != EXA_PIXMAP_SCORE_PINNED) + if (pExaPixmap->score == EXA_PIXMAP_SCORE_PINNED) FatalError("Driver failed PrepareAccess on a pinned pixmap\n"); exaMoveOutPixmap (pPixmap); } --- xorg-server-1.4.2.orig/exa/Makefile.in +++ xorg-server-1.4.2/exa/Makefile.in @@ -154,7 +154,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -291,10 +291,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/dbe/Makefile.in +++ xorg-server-1.4.2/dbe/Makefile.in @@ -153,7 +153,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -287,10 +287,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/fb/Makefile.in +++ xorg-server-1.4.2/fb/Makefile.in @@ -186,7 +186,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -320,10 +320,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/mfb/Makefile.in +++ xorg-server-1.4.2/mfb/Makefile.in @@ -163,7 +163,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -297,10 +297,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/damageext/Makefile.in +++ xorg-server-1.4.2/damageext/Makefile.in @@ -141,7 +141,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -275,10 +275,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/doc/c-extensions +++ xorg-server-1.4.2/doc/c-extensions @@ -0,0 +1,32 @@ +Use of extensions throughout the X server tree +---------------------------------------------- + +Optional extensions: +The server will still build if your toolchain does not support these +extensions, although the results may not be optimal. + + * _X_SENTINEL(x): member x of the passed structure must be NULL, e.g.: + void parseOptions(Option *options _X_SENTINEL(0)); + parseOptions("foo", "bar", NULL); /* this is OK */ + parseOptions("foo", "bar", "baz"); /* this is not */ + This definition comes from Xfuncproto.h in the core + protocol headers. + * _X_ATTRIBUTE_PRINTF(x, y): This function has printf-like semantics; + check the format string when built with + -Wformat (gcc) or similar. + * _X_EXPORT: this function should appear in symbol tables. + * _X_HIDDEN: this function should not appear in the _dynamic_ symbol + table. + * _X_INTERNAL: like _X_HIDDEN, but attempt to ensure that this function + is never called from another module. + * _X_INLINE: inline this functon if possible (generally obeyed unless + disabling optimisations). + * _X_DEPRECATED: warn on use of this function. + +Mandatory extensions: +The server will not build if your toolchain does not support these extensions. + + * named initialisers: explicitly initialising structure members, e.g.: + struct foo bar = { .baz = quux, .brian = "dog" }; + * variadic macros: macros with a variable number of arguments, e.g.: + #define DebugF(x, ...) /**/ --- xorg-server-1.4.2.orig/doc/Makefile.in +++ xorg-server-1.4.2/doc/Makefile.in @@ -138,7 +138,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -272,10 +272,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/randr/Makefile.in +++ xorg-server-1.4.2/randr/Makefile.in @@ -161,7 +161,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -295,10 +295,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/cfb32/Makefile.in +++ xorg-server-1.4.2/cfb32/Makefile.in @@ -155,7 +155,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -289,10 +289,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/composite/Makefile.in +++ xorg-server-1.4.2/composite/Makefile.in @@ -142,7 +142,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -276,10 +276,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/cfb/Makefile.in +++ xorg-server-1.4.2/cfb/Makefile.in @@ -166,7 +166,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -300,10 +300,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/miext/Makefile.in +++ xorg-server-1.4.2/miext/Makefile.in @@ -135,7 +135,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -269,10 +269,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/miext/cw/Makefile.in +++ xorg-server-1.4.2/miext/cw/Makefile.in @@ -141,7 +141,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -275,10 +275,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/miext/damage/Makefile.in +++ xorg-server-1.4.2/miext/damage/Makefile.in @@ -153,7 +153,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -287,10 +287,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/miext/rootless/Makefile.in +++ xorg-server-1.4.2/miext/rootless/Makefile.in @@ -152,7 +152,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -286,10 +286,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/miext/rootless/accel/Makefile.in +++ xorg-server-1.4.2/miext/rootless/accel/Makefile.in @@ -142,7 +142,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -276,10 +276,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/miext/rootless/safeAlpha/Makefile.in +++ xorg-server-1.4.2/miext/rootless/safeAlpha/Makefile.in @@ -141,7 +141,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -275,10 +275,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ --- xorg-server-1.4.2.orig/miext/shadow/Makefile.in +++ xorg-server-1.4.2/miext/shadow/Makefile.in @@ -158,7 +158,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -292,10 +292,13 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@