diff options
author | marha <marha@users.sourceforge.net> | 2009-06-28 22:07:26 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2009-06-28 22:07:26 +0000 |
commit | 3562e78743202e43aec8727005182a2558117eca (patch) | |
tree | 8f9113a77d12470c5c851a2a8e4cb02e89df7d43 /xorg-server/hw/xfree86/xf4bpp | |
download | vcxsrv-3562e78743202e43aec8727005182a2558117eca.tar.gz vcxsrv-3562e78743202e43aec8727005182a2558117eca.tar.bz2 vcxsrv-3562e78743202e43aec8727005182a2558117eca.zip |
Checked in the following released items:
xkeyboard-config-1.4.tar.gz
ttf-bitstream-vera-1.10.tar.gz
font-alias-1.0.1.tar.gz
font-sun-misc-1.0.0.tar.gz
font-sun-misc-1.0.0.tar.gz
font-sony-misc-1.0.0.tar.gz
font-schumacher-misc-1.0.0.tar.gz
font-mutt-misc-1.0.0.tar.gz
font-misc-misc-1.0.0.tar.gz
font-misc-meltho-1.0.0.tar.gz
font-micro-misc-1.0.0.tar.gz
font-jis-misc-1.0.0.tar.gz
font-isas-misc-1.0.0.tar.gz
font-dec-misc-1.0.0.tar.gz
font-daewoo-misc-1.0.0.tar.gz
font-cursor-misc-1.0.0.tar.gz
font-arabic-misc-1.0.0.tar.gz
font-winitzki-cyrillic-1.0.0.tar.gz
font-misc-cyrillic-1.0.0.tar.gz
font-cronyx-cyrillic-1.0.0.tar.gz
font-screen-cyrillic-1.0.1.tar.gz
font-xfree86-type1-1.0.1.tar.gz
font-adobe-utopia-type1-1.0.1.tar.gz
font-ibm-type1-1.0.0.tar.gz
font-bitstream-type1-1.0.0.tar.gz
font-bitstream-speedo-1.0.0.tar.gz
font-bh-ttf-1.0.0.tar.gz
font-bh-type1-1.0.0.tar.gz
font-bitstream-100dpi-1.0.0.tar.gz
font-bh-lucidatypewriter-100dpi-1.0.0.tar.gz
font-bh-100dpi-1.0.0.tar.gz
font-adobe-utopia-100dpi-1.0.1.tar.gz
font-adobe-100dpi-1.0.0.tar.gz
font-util-1.0.1.tar.gz
font-bitstream-75dpi-1.0.0.tar.gz
font-bh-lucidatypewriter-75dpi-1.0.0.tar.gz
font-adobe-utopia-75dpi-1.0.1.tar.gz
font-bh-75dpi-1.0.0.tar.gz
bdftopcf-1.0.1.tar.gz
font-adobe-75dpi-1.0.0.tar.gz
mkfontscale-1.0.6.tar.gz
openssl-0.9.8k.tar.gz
bigreqsproto-1.0.2.tar.gz
xtrans-1.2.2.tar.gz
resourceproto-1.0.2.tar.gz
inputproto-1.4.4.tar.gz
compositeproto-0.4.tar.gz
damageproto-1.1.0.tar.gz
zlib-1.2.3.tar.gz
xkbcomp-1.0.5.tar.gz
freetype-2.3.9.tar.gz
pthreads-w32-2-8-0-release.tar.gz
pixman-0.12.0.tar.gz
kbproto-1.0.3.tar.gz
evieext-1.0.2.tar.gz
fixesproto-4.0.tar.gz
recordproto-1.13.2.tar.gz
randrproto-1.2.2.tar.gz
scrnsaverproto-1.1.0.tar.gz
renderproto-0.9.3.tar.gz
xcmiscproto-1.1.2.tar.gz
fontsproto-2.0.2.tar.gz
xextproto-7.0.3.tar.gz
xproto-7.0.14.tar.gz
libXdmcp-1.0.2.tar.gz
libxkbfile-1.0.5.tar.gz
libfontenc-1.0.4.tar.gz
libXfont-1.3.4.tar.gz
libX11-1.1.5.tar.gz
libXau-1.0.4.tar.gz
libxcb-1.1.tar.gz
xorg-server-1.5.3.tar.gz
Diffstat (limited to 'xorg-server/hw/xfree86/xf4bpp')
48 files changed, 12545 insertions, 0 deletions
diff --git a/xorg-server/hw/xfree86/xf4bpp/Makefile.am b/xorg-server/hw/xfree86/xf4bpp/Makefile.am new file mode 100644 index 000000000..1414a0d0f --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/Makefile.am @@ -0,0 +1,57 @@ +module_LTLIBRARIES = libxf4bpp.la + +sdk_HEADERS = xf4bpp.h + +libxf4bpp_la_LDFLAGS = -avoid-version + +libxf4bpp_la_SOURCES = \ + ppcArea.c \ + ppcClip.c \ + ppcCpArea.c \ + ppcCReduce.c \ + ppcDepth.c \ + ppcFillRct.c \ + ppcWinFS.c \ + ppcPixFS.c \ + ppcGC.c \ + ppcGetSp.c \ + ppcImg.c \ + ppcPixmap.c \ + ppcPolyPnt.c \ + ppcQuery.c \ + ppcRslvC.c \ + ppcSetSp.c \ + ppcWindow.c \ + ppcIO.c \ + emulOpStip.c \ + emulRepAre.c \ + emulTile.c \ + vgaGC.c \ + vgaBitBlt.c \ + vgaImages.c \ + vgaStipple.c \ + vgaSolid.c \ + offscreen.c \ + wm3.c \ + mfbimggblt.c \ + mfbline.c \ + mfbseg.c \ + mfbhrzvert.c \ + mfbbres.c \ + mfbbresd.c \ + mfbfillarc.c \ + mfbzerarc.c \ + vgamodule.c + +EXTRA_DIST = OScompiler.h ibmTrace.h ppcGCstr.h ppcSpMcro.h vgaReg.h \ + vgaVideo.h wm3.h NOTES + +DISTCLEANFILES = mfbseg.c + +mfbseg.c: + echo "#define POLYSEGMENT" > $@ + echo "#include \"$(srcdir)/mfbline.c\"" >> $@ + +INCLUDES = $(XORG_INCS) -I$(srcdir)/../xf1bpp -I$(top_srcdir)/mfb + +AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) diff --git a/xorg-server/hw/xfree86/xf4bpp/Makefile.in b/xorg-server/hw/xfree86/xf4bpp/Makefile.in new file mode 100644 index 000000000..0a242da14 --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/Makefile.in @@ -0,0 +1,791 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = hw/xfree86/xf4bpp +DIST_COMMON = $(sdk_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ + $(top_builddir)/include/xorg-server.h \ + $(top_builddir)/include/dix-config.h \ + $(top_builddir)/include/xgl-config.h \ + $(top_builddir)/include/xorg-config.h \ + $(top_builddir)/include/xkb-config.h \ + $(top_builddir)/include/xwin-config.h \ + $(top_builddir)/include/kdrive-config.h +CONFIG_CLEAN_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(moduledir)" "$(DESTDIR)$(sdkdir)" +moduleLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(module_LTLIBRARIES) +libxf4bpp_la_LIBADD = +am_libxf4bpp_la_OBJECTS = ppcArea.lo ppcClip.lo ppcCpArea.lo \ + ppcCReduce.lo ppcDepth.lo ppcFillRct.lo ppcWinFS.lo \ + ppcPixFS.lo ppcGC.lo ppcGetSp.lo ppcImg.lo ppcPixmap.lo \ + ppcPolyPnt.lo ppcQuery.lo ppcRslvC.lo ppcSetSp.lo ppcWindow.lo \ + ppcIO.lo emulOpStip.lo emulRepAre.lo emulTile.lo vgaGC.lo \ + vgaBitBlt.lo vgaImages.lo vgaStipple.lo vgaSolid.lo \ + offscreen.lo wm3.lo mfbimggblt.lo mfbline.lo mfbseg.lo \ + mfbhrzvert.lo mfbbres.lo mfbbresd.lo mfbfillarc.lo \ + mfbzerarc.lo vgamodule.lo +libxf4bpp_la_OBJECTS = $(am_libxf4bpp_la_OBJECTS) +libxf4bpp_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libxf4bpp_la_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libxf4bpp_la_SOURCES) +DIST_SOURCES = $(libxf4bpp_la_SOURCES) +sdkHEADERS_INSTALL = $(INSTALL_HEADER) +HEADERS = $(sdk_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ +ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +APPDEFAULTDIR = @APPDEFAULTDIR@ +APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ +APP_MAN_DIR = @APP_MAN_DIR@ +APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASE_FONT_PATH = @BASE_FONT_PATH@ +BUILD_DATE = @BUILD_DATE@ +BUILD_TIME = @BUILD_TIME@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DARWIN_LIBS = @DARWIN_LIBS@ +DBUS_CFLAGS = @DBUS_CFLAGS@ +DBUS_LIBS = @DBUS_LIBS@ +DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ +DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ +DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DGA_CFLAGS = @DGA_CFLAGS@ +DGA_LIBS = @DGA_LIBS@ +DIX_CFLAGS = @DIX_CFLAGS@ +DLLTOOL = @DLLTOOL@ +DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ +DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ +DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ +DMXMODULES_LIBS = @DMXMODULES_LIBS@ +DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ +DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ +DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ +DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ +DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ +DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ +DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ +DRIPROTO_LIBS = @DRIPROTO_LIBS@ +DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ +DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ +DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ +DSYMUTIL = @DSYMUTIL@ +DTRACE = @DTRACE@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +FILE_MAN_DIR = @FILE_MAN_DIR@ +FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ +FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ +FREETYPE_LIBS = @FREETYPE_LIBS@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ +GLX_DEFINES = @GLX_DEFINES@ +GL_CFLAGS = @GL_CFLAGS@ +GL_LIBS = @GL_LIBS@ +GREP = @GREP@ +HAL_CFLAGS = @HAL_CFLAGS@ +HAL_LIBS = @HAL_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ +KDRIVE_INCS = @KDRIVE_INCS@ +KDRIVE_LIBS = @KDRIVE_LIBS@ +KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ +KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ +KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ +LAUNCHD = @LAUNCHD@ +LDFLAGS = @LDFLAGS@ +LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ +LIBDRM_LIBS = @LIBDRM_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_MAN_DIR = @LIB_MAN_DIR@ +LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ +LINUXDOC = @LINUXDOC@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MAKE_HTML = @MAKE_HTML@ +MAKE_PDF = @MAKE_PDF@ +MAKE_PS = @MAKE_PS@ +MAKE_TEXT = @MAKE_TEXT@ +MESA_SOURCE = @MESA_SOURCE@ +MISC_MAN_DIR = @MISC_MAN_DIR@ +MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ +MKDIR_P = @MKDIR_P@ +MKFONTDIR = @MKFONTDIR@ +MKFONTSCALE = @MKFONTSCALE@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCCLD = @OBJCCLD@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJCLINK = @OBJCLINK@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ +OPENSSL_LIBS = @OPENSSL_LIBS@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ +PCIACCESS_LIBS = @PCIACCESS_LIBS@ +PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ +PERL = @PERL@ +PKG_CONFIG = @PKG_CONFIG@ +PROJECTROOT = @PROJECTROOT@ +PS2PDF = @PS2PDF@ +RANLIB = @RANLIB@ +RAWCPP = @RAWCPP@ +RAWCPPFLAGS = @RAWCPPFLAGS@ +SED = @SED@ +SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@ +SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ +STRIP = @STRIP@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ +VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@ +VENDOR_NAME = @VENDOR_NAME@ +VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ +VENDOR_RELEASE = @VENDOR_RELEASE@ +VERSION = @VERSION@ +X11APP_ARCHS = @X11APP_ARCHS@ +X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ +X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ +XDMCP_CFLAGS = @XDMCP_CFLAGS@ +XDMCP_LIBS = @XDMCP_LIBS@ +XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ +XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ +XDMX_CFLAGS = @XDMX_CFLAGS@ +XDMX_LIBS = @XDMX_LIBS@ +XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ +XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@ +XEGL_LIBS = @XEGL_LIBS@ +XEGL_SYS_LIBS = @XEGL_SYS_LIBS@ +XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ +XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@ +XEPHYR_INCS = @XEPHYR_INCS@ +XEPHYR_LIBS = @XEPHYR_LIBS@ +XF86CONFIGFILE = @XF86CONFIGFILE@ +XF86MISC_CFLAGS = @XF86MISC_CFLAGS@ +XF86MISC_LIBS = @XF86MISC_LIBS@ +XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@ +XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@ +XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@ +XGLMODULES_LIBS = @XGLMODULES_LIBS@ +XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@ +XGLXMODULES_LIBS = @XGLXMODULES_LIBS@ +XGLX_LIBS = @XGLX_LIBS@ +XGLX_SYS_LIBS = @XGLX_SYS_LIBS@ +XGL_LIBS = @XGL_LIBS@ +XGL_MODULE_PATH = @XGL_MODULE_PATH@ +XGL_SYS_LIBS = @XGL_SYS_LIBS@ +XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ +XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ +XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ +XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ +XLIB_CFLAGS = @XLIB_CFLAGS@ +XLIB_LIBS = @XLIB_LIBS@ +XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ +XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ +XNEST_LIBS = @XNEST_LIBS@ +XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ +XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@ +XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@ +XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@ +XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@ +XORG_CFLAGS = @XORG_CFLAGS@ +XORG_INCS = @XORG_INCS@ +XORG_LIBS = @XORG_LIBS@ +XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ +XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ +XORG_OS = @XORG_OS@ +XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XORG_SYS_LIBS = @XORG_SYS_LIBS@ +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@ +XSDL_LIBS = @XSDL_LIBS@ +XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ +XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ +XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ +XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ +XSERVER_LIBS = @XSERVER_LIBS@ +XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ +XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ +XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ +XVFB_LIBS = @XVFB_LIBS@ +XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ +XWINMODULES_LIBS = @XWINMODULES_LIBS@ +XWIN_LIBS = @XWIN_LIBS@ +XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ +XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +__XCONFIGFILE__ = @__XCONFIGFILE__@ +abi_ansic = @abi_ansic@ +abi_extension = @abi_extension@ +abi_font = @abi_font@ +abi_videodrv = @abi_videodrv@ +abi_xinput = @abi_xinput@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +driverdir = @driverdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +extdir = @extdir@ +ft_config = @ft_config@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +launchagentsdir = @launchagentsdir@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +logdir = @logdir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +moduledir = @moduledir@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sdkdir = @sdkdir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +xglmoduledir = @xglmoduledir@ +xpconfigdir = @xpconfigdir@ +module_LTLIBRARIES = libxf4bpp.la +sdk_HEADERS = xf4bpp.h +libxf4bpp_la_LDFLAGS = -avoid-version +libxf4bpp_la_SOURCES = \ + ppcArea.c \ + ppcClip.c \ + ppcCpArea.c \ + ppcCReduce.c \ + ppcDepth.c \ + ppcFillRct.c \ + ppcWinFS.c \ + ppcPixFS.c \ + ppcGC.c \ + ppcGetSp.c \ + ppcImg.c \ + ppcPixmap.c \ + ppcPolyPnt.c \ + ppcQuery.c \ + ppcRslvC.c \ + ppcSetSp.c \ + ppcWindow.c \ + ppcIO.c \ + emulOpStip.c \ + emulRepAre.c \ + emulTile.c \ + vgaGC.c \ + vgaBitBlt.c \ + vgaImages.c \ + vgaStipple.c \ + vgaSolid.c \ + offscreen.c \ + wm3.c \ + mfbimggblt.c \ + mfbline.c \ + mfbseg.c \ + mfbhrzvert.c \ + mfbbres.c \ + mfbbresd.c \ + mfbfillarc.c \ + mfbzerarc.c \ + vgamodule.c + +EXTRA_DIST = OScompiler.h ibmTrace.h ppcGCstr.h ppcSpMcro.h vgaReg.h \ + vgaVideo.h wm3.h NOTES + +DISTCLEANFILES = mfbseg.c +INCLUDES = $(XORG_INCS) -I$(srcdir)/../xf1bpp -I$(top_srcdir)/mfb +AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/xf4bpp/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign hw/xfree86/xf4bpp/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-moduleLTLIBRARIES: $(module_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(moduledir)" || $(MKDIR_P) "$(DESTDIR)$(moduledir)" + @list='$(module_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(moduledir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(moduledir)/$$f"; \ + else :; fi; \ + done + +uninstall-moduleLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(module_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(moduledir)/$$p'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(moduledir)/$$p"; \ + done + +clean-moduleLTLIBRARIES: + -test -z "$(module_LTLIBRARIES)" || rm -f $(module_LTLIBRARIES) + @list='$(module_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libxf4bpp.la: $(libxf4bpp_la_OBJECTS) $(libxf4bpp_la_DEPENDENCIES) + $(libxf4bpp_la_LINK) -rpath $(moduledir) $(libxf4bpp_la_OBJECTS) $(libxf4bpp_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/emulOpStip.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/emulRepAre.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/emulTile.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbbres.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbbresd.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbfillarc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbhrzvert.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbimggblt.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbline.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbseg.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbzerarc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/offscreen.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcArea.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcCReduce.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcClip.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcCpArea.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcDepth.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcFillRct.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcGC.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcGetSp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcIO.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcImg.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcPixFS.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcPixmap.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcPolyPnt.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcQuery.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcRslvC.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcSetSp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcWinFS.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcWindow.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vgaBitBlt.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vgaGC.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vgaImages.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vgaSolid.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vgaStipple.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vgamodule.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wm3.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-sdkHEADERS: $(sdk_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(sdkdir)" || $(MKDIR_P) "$(DESTDIR)$(sdkdir)" + @list='$(sdk_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(sdkHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(sdkdir)/$$f'"; \ + $(sdkHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(sdkdir)/$$f"; \ + done + +uninstall-sdkHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(sdk_HEADERS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(sdkdir)/$$f'"; \ + rm -f "$(DESTDIR)$(sdkdir)/$$f"; \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(moduledir)" "$(DESTDIR)$(sdkdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-moduleLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-moduleLTLIBRARIES install-sdkHEADERS + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-moduleLTLIBRARIES uninstall-sdkHEADERS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-moduleLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-moduleLTLIBRARIES install-pdf install-pdf-am \ + install-ps install-ps-am install-sdkHEADERS install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-moduleLTLIBRARIES \ + uninstall-sdkHEADERS + + +mfbseg.c: + echo "#define POLYSEGMENT" > $@ + echo "#include \"$(srcdir)/mfbline.c\"" >> $@ +# 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: diff --git a/xorg-server/hw/xfree86/xf4bpp/NOTES b/xorg-server/hw/xfree86/xf4bpp/NOTES new file mode 100644 index 000000000..e3b77dcfd --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/NOTES @@ -0,0 +1,194 @@ +This code originally hails from IBM. It was ported to an early XFree86 by +Gertjan Akkerman, whose BUGS file I append here. + +In turn, this is a port of Gertjan's work to the new server design. Among the +changes are: + +- The removal of almost all unreferenced code. +- The removal of this code's own copy of mfb (xf1bpp is used instead). +- The removal of banking support (mibank is used instead). +- External symbols were made static where this was sufficient. +- The remaining external names were renamed to xf4bpp*. +- Several minor cleanups too many to mention here. + +To understate the matter, this code is >UGLY<. This seems inherent in IBM's +corporate culture. Be that as it may, it *does* survive X11R4's xtest +(whatever that means these days...). For now, this is sufficient for 4bpp +support in the new design, but at some point, I'll have to sit down and +rewrite this from scratch. A more technical justification for a rewrite is +that the pixmap format is 8bpp, instead of 4bpp, which is causing me to +pepper the rest of the server with unclean accomodations. + +Marc. + +=============================================================================== +Section 1: From IBM's X11R4 contribution towards XFree86. + +This section describes what I did to obtain a 16 colour vga server. + +I started with the SYSV, ppc, vga and common directories from IBM's X11R4 +contribution. Those directories have the following function: +1. SYSV implements the mouse and keyboard. +2. ppc is a generic layer implementing ddx in terms of drawing operations + through rectangles. (With spans as a boundary case: height = 1.) +3. vga implements a layer of operations drawing through rectangles. +4. common implements ddx initialization and quitting, and screen saving. + +I eliminated SYSV and common since the functionality provided therein is +already provided in XFree86. Since XFree86 is actively being ported to +new operating systems, while X11R4 is out of date, I preferred the XFree86 +code here above the SYSV and common code. +Whatever functionality was still needed from common (default colormap +initialization -- not much code) was moved into ppc. + +Since XFree86 uses the mi-provided software cursor code, IBM's software +cursor code was deleted from ppc and vga. This is a pity, since it is +expected that it is more efficient than mi's code, but the XFree86 mouse and +keyboard code directly call mi, and I do not want to maintain the XFree86 +mouse and keyboard code. + +Since we cannot support a monolithic multi-screen server using all of the +x11r4 contributed code yet, all multi screen code was deleted. This includes +one header file containing a nasty copyright statement. + +Since glyph handling has changed between X11R4 and X11R5, the code handling +glyphs was replaced by appropriate calls to mi. +I hope it can be modified and put back one day. + +Provisionally, some code was added (viz. file vga/offscreen.c) to intercept +calls to the rectangle drawing code when we are switched out of the VT. +I hope this can be replaced by some window tree invalidation and GC validation +scheme. + + +Section 2: BUGS + +This section describes fixed and still unfixed bugs in this code. +All bugs not labeled otherwise also occur in IBM's X11R4 code, and may be of +interest to anybody using that code. + +1. (Fixed.) +I found (and provisionally fixed) a bug in the IBM bitblit code: +In file ddx/ibm/vga/vgaImages.c a function vgaReadColorImage is defined. +When this function is used to read less than 8 pixels starting on a byte +boundary it will always read precisely 8 pixels. +Thus, when space is allocated for 4 or less pixels, it will write beyond +the allocated space. +Since the code is rather convoluted, this may not be apparent at first sight, +but going through the code with an example shows the error. + +2. (Fixed.) +In ppcPixmapFS.c, function ppcStipplePixmapFS there was a bug +regarding the stipple origin: The horizontal origin is added while +the vertical one is subtracted. The horizontal origin should be subtracted +instead of added here. +This bug gets visible when backing-store is enabled and one uses twm: +the submenu icons get truncated on their left hand side. +(In case you wonder why this bug appears: under those circumstances +twm prepares its menus by drawing into an unmapped window. +The miCopyPlane function uses the ppcStipplePixmap (and many others) +to get the plane copied.) +I also fixed this bug in the other routines (ppcOpStipplePixmapFS, +ppcTilePixmapFS) in this file, although I had no visible clues for this. +I hope this is appropriate. + +3. (Fixed.) +I find it suspect that ppcSetSpans gives different output when one +claims that an actually sorted list of spans is unsorted. +The unsorted code is wrong, and should be made to look more like the sorted +code. I.e., use ( xStart - ppt->x ) instead of ( xStart - pbox->x1 ) + +4. (Fixed.) +There used to be another bug that became visible when using twm and backing +store: popping up a submenu, and moving the cursor upwards til it leaves the +submenu, the submenu would disappears, as it should. +But the submenu icon would not get restored, while it should be. +10b. By replacing the clip-computing code in ppcValidateGC by that in +cfbValidateGC, I *finally* fixed the disappearing twm menu icon problem. + +5. Added mfbRegisterCopyplaneProc call. [Its omission was an error on my + part.] + Fixing a server core dump in XTest. + +6. Fixed not-very-high tile bug in function ppcTileRect, file emulTile.c + (I.e., if the tile was higher than the area to be tiled, far too much + was drawn, causing server core dumps in XTest.) + Actually, "savey" ought to be used to determine the height of the tiles in + the top line to be tiled, instead of "pTile->drawable.height". +7. A use of height where width was intended was fixed in ppcTileRect: + "savehcount = w / pTile->drawable.height;" should use "... .width" and + "savehcount = ( x + w - htarget ) / pTile->drawable.height;" too. + +8. Deleted overly clever code in ppcCReduce.c + (All code that tried to pre-compute how alu's could be replaced by + other alu's with inverted colors, etc. was deleted. I think it is + at least wrong for FillSolid.) + +9. Looked at suspicious code in ppcSetSp.c + "tmpx = *pdst;" was never updated during the loop. We took it out of the + initialization position of the for and moved it into the loop. + +10. Add xSrc := GC->patOrg.x + pDrawable.x and ySrc := ... in ppcPixmapFS.c, + functions ppcStipplePixmapFS, ppcOpStipplePixmapFS, and ppcTilePixmapFS. + This because stipple and tile origins are taken relative to the drawable. + Also use a "modulo" function that gets the cases of a negative stipple + or tile offset right. (When the stipple origin is to the right of or + below the origin of the drawable.) + +11. File vgaSolid.c, function vgaFillSolid: + Inverting is XORing with all ones. Not with the color we want to AND/OR + later. So we'll have to set the color to VGA_ALLPLANES + whenever we want to invert existing data, and reset it before the + AND/OR is done. + Also we replaced an outb( 0x3CF, tmp2 ) by the SetVideoGraphicsData( tmp2 ) + it is representing. (Just a cosmetic replacement.) + +12. File vgaImages, function vgaDrawColorImage. + Moved a line "invert_existing_data = TRUE;" two lines down, past a case + label. Now it is also part of the code executed for GXorReverse, as it + should be. + +13. The pixmap FillSpans routines (file ppcPixmapFS.c) got somewhat better + after importing some code from ddx/ibm/vga. (A getbits function that does + wrapping.) + They were wrong for the FillStippled and FillOpaqueStippled modes. + I don't understand the old code. How could it handle stipples of a size not + an exact multiple of 32? (or 8, for that matter.) + +14. In function vgaBitBlt file vgaBitBlt.c, in the shortcuts for + GXSet, GXClear and GXInvert, the source (x0,y0) is accidentally operated + upon by vgaFillSolid, instead of the destination (x1,y1). + +15. Notice that in DoMonoSingle and DoMonoMany in file vgaStipple.c, the left + edge of the square to be stippled is treated wrong. + Correct would be to get the bits with getbits using offset xshift, and + to shift them right (x & 07) places. + [One might wish to use the variable tmp1 at this place, since it had been + set to (x & 07) at this place; but that is already re-used at this point.] + Also note that NeedValX is set wrong: The implicit assumption was that + stipples are more than 8 wide. + This only fixes the problem when miPushPixel is used instead of ppcPushPixel. + I think I should look some more into this. + +16. I took out some code of the CopyArea function, in which a no-op function + was called while a real one was needed. My fix does not completely work, + although it improved the behaviour of GetImage somewhat. + +17. After finding three kinds of errors in this single function, + -- the new kinds being the right side not being always written due to + an incorrect if scope, and the lower end not always being written due + to variables being updated at the wrong place -- + (requiring modifications to be made at at least 10 places, + I decided to REWRITE the body of the ppcTileRect function from scratch. + This version simply computes all relevant margins in advance, and does + not try to reuse temporary variables. I leave that to the compiler. + (This was a maintenance and robustness nightmare anyway.) + +MORE NOTES: + It is funny that there are two files in mi that require compilation + with the proper #defines ( -DXF86VGA16 in my case ): + Besides the obvious mibitblt.c, there is also mipushpxl.c. + + + +$XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/NOTES,v 1.1.2.2 1998/06/27 15:15:45 dawes Exp $ diff --git a/xorg-server/hw/xfree86/xf4bpp/OScompiler.h b/xorg-server/hw/xfree86/xf4bpp/OScompiler.h new file mode 100644 index 000000000..8a8bbb59c --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/OScompiler.h @@ -0,0 +1,58 @@ +/* + * Copyright IBM Corporation 1987,1988,1989 + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * +*/ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#ifndef __COMPILER_DEPENDANCIES__ +#define __COMPILER_DEPENDANCIES__ + +#define MOVE( src, dst, length ) memcpy( dst, src, length) +#define MAX(a,b) (((a)>(b))?(a):(b)) +#define MIN(a,b) (((a)<(b))?(a):(b)) +#define ABS(x) (((x)>0)?(x):-(x)) + +#include "misc.h" +#include "compiler.h" + +#ifdef lint +/* So that lint doesn't complain about constructs it doesn't understand */ +#ifdef volatile +#undef volatile +#endif +#define volatile +#ifdef const +#undef const +#endif +#define const +#ifdef signed +#undef signed +#endif +#define signed +#ifdef _ANSI_DECLS_ +#undef _ANSI_DECLS_ +#endif +#endif + +#endif /* !__COMPILER_DEPENDANCIES__ */ diff --git a/xorg-server/hw/xfree86/xf4bpp/emulOpStip.c b/xorg-server/hw/xfree86/xf4bpp/emulOpStip.c new file mode 100644 index 000000000..542e9d394 --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/emulOpStip.c @@ -0,0 +1,102 @@ +/* + * Copyright IBM Corporation 1987,1988,1989 + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * +*/ + +/* ppc OpaqueStipple + * + * Based on the private stipple; does a foreground, and then an inverted + * on the background + * + */ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include "xf4bpp.h" +#include "OScompiler.h" +#include "mfbmap.h" +#include "mfb.h" + +void +xf4bppOpaqueStipple( pWin, pStipple, fg, bg, alu, planes, x, y, w, h, xSrc, ySrc ) +WindowPtr pWin; /* GJA */ +register PixmapPtr pStipple ; +unsigned long int fg ; +unsigned long int bg ; +int alu ; +unsigned long int planes ; +register int x, y, w, h ; +int xSrc, ySrc ; +{ + /* DO BACKGROUND */ + switch ( alu ) { + /* Easy Cases -- i.e. Final Result Doesn't Depend On Initial Dest. */ + case GXclear: /* 0x0 Zero 0 */ + case GXset: /* 0xf 1 */ + /* Foreground And Background Are Both The Same !! */ + xf4bppFillSolid( pWin, bg, alu, planes, x, y, w, h ) ; + case GXnoop: /* 0x5 dst */ + break ; + case GXcopy: /* 0x3 src */ + case GXcopyInverted: /* 0xc NOT src */ + { /* Special Case Code */ + register int vtarget, htarget ; + + /* We Can Draw Just One Copy Then Blit The Rest !! */ + /* Draw The One Copy */ + htarget = MIN( w, pStipple->drawable.width ) ; + vtarget = MIN( h, pStipple->drawable.height ) ; + + /* First The Background */ + xf4bppFillSolid( pWin, bg, alu, planes, x, y, + htarget, vtarget ) ; + /* Then The Foreground */ + xf4bppFillStipple( pWin, pStipple, fg, alu, planes, + x, y, htarget, vtarget, + xSrc, ySrc ) ; + + /* Here We Double The Size Of The BLIT Each Iteration */ + xf4bppReplicateArea(pWin, x, y, planes, w, h, htarget, vtarget); + } + break ; + default: + /* Hard Cases -- i.e. Final Result DOES Depend On Initial Dest. */ + { /* Do The Background */ + register int i, j; + register PixmapPtr pInvPixmap = xf4bppCopyPixmap( pStipple ) ; + register unsigned char *data = pInvPixmap->devPrivate.ptr ; + + /* INVERT PIXMAP OK, jeff, this is for you */ + for ( i = pInvPixmap->drawable.height ; i-- ; ) + for ( j = pInvPixmap->devKind ; j-- ; data++ ) + *data = ~ ( *data ) ; + + xf4bppFillStipple( pWin, pInvPixmap, bg, alu, planes, x, y, w, h, xSrc, ySrc ); + mfbDestroyPixmap( pInvPixmap ) ; + /* DO FOREGROUND */ + xf4bppFillStipple( pWin, pStipple, fg, alu, planes, x, y, w, h, xSrc, ySrc ); + } + break ; + } + return; +} diff --git a/xorg-server/hw/xfree86/xf4bpp/emulRepAre.c b/xorg-server/hw/xfree86/xf4bpp/emulRepAre.c new file mode 100644 index 000000000..20fff1e0c --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/emulRepAre.c @@ -0,0 +1,69 @@ +/* + * Copyright IBM Corporation 1987,1988,1989 + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * +*/ + +/* ppc Replicate Area -- A Divide & Conquer Algorithm + * a "ppc" Helper Function For Stipples And Tiling + * P. Shupak 1/88 + */ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include "xf4bpp.h" + +void xf4bppReplicateArea( pWin, x, y, planeMask, goalWidth, goalHeight, + currentHoriz, currentVert) +WindowPtr pWin; /* GJA */ +register int x, y, planeMask ; +int goalWidth, goalHeight ; +int currentHoriz, currentVert ; +{ + for ( ; + currentHoriz <= ( goalWidth >> 1 ) ; + currentHoriz <<= 1 ) { + xf4bppBitBlt( pWin, GXcopy, planeMask, + x, y, + x + currentHoriz, y, + currentHoriz, currentVert ) ; + } + if ( goalWidth - currentHoriz ) + xf4bppBitBlt( pWin, GXcopy, planeMask, + x, y, + x + currentHoriz, y, + goalWidth - currentHoriz, currentVert ) ; + for ( ; + currentVert <= ( goalHeight >> 1 ) ; + currentVert <<= 1 ) { + xf4bppBitBlt( pWin, GXcopy, planeMask, + x, y, + x, y + currentVert, + goalWidth, currentVert ) ; + } + if ( goalHeight - currentVert ) + xf4bppBitBlt( pWin, GXcopy, planeMask, + x, y, + x, y + currentVert, + goalWidth, goalHeight - currentVert ) ; +return ; +} diff --git a/xorg-server/hw/xfree86/xf4bpp/emulTile.c b/xorg-server/hw/xfree86/xf4bpp/emulTile.c new file mode 100644 index 000000000..2f2a758f2 --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/emulTile.c @@ -0,0 +1,352 @@ +/* + * Copyright IBM Corporation 1987,1988,1989 + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * +*/ + +/* ppc Tile + * P. Shupak 11/87 + * Modified From original ppc Tile + * T. Paquin 9/87 + * Uses private imageFill a bunch of times + */ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include "xf4bpp.h" +#include "OScompiler.h" +#include "ibmTrace.h" + +static void +DrawFirstTile +( + WindowPtr pWin, /* GJA */ + register PixmapPtr pTile, + register int x, + register int y, + int w, + int h, + int alu, + unsigned long int planes, + int xOffset, + int yOffset +) +{ +register int htarget ; +register int vtarget ; + + if ( xOffset ) { /* Not X-Aligned */ + if ( yOffset ) { /* Nor Y-Aligned */ + htarget = MIN( pTile->drawable.width - xOffset, w ), + vtarget = MIN( pTile->drawable.height - yOffset, h ), + yOffset *= pTile->devKind ; + xf4bppDrawColorImage( pWin,x, y, + htarget, + vtarget, + (unsigned char *)pTile->devPrivate.ptr + yOffset + xOffset, + pTile->devKind, + alu, planes ) ; + if ( w > htarget ) { + w = MIN( w, pTile->drawable.width ) ; + if ( h > vtarget ) { + h = MIN( h, pTile->drawable.height ) ; + xf4bppDrawColorImage( pWin, x, y + vtarget, + htarget, + h - vtarget, + (unsigned char *)pTile->devPrivate.ptr + xOffset, + pTile->devKind, + alu, planes ) ; + xf4bppDrawColorImage( pWin, x + htarget, y, + w - htarget, + vtarget, + (unsigned char *)pTile->devPrivate.ptr + yOffset, + pTile->devKind, + alu, planes ) ; + xf4bppDrawColorImage( pWin, x + htarget, + y + vtarget, + w - htarget, + h - vtarget, + pTile->devPrivate.ptr, + pTile->devKind, + alu, planes ) ; + } + else { /* h <= vtarget */ + xf4bppDrawColorImage( pWin, x + htarget, y, + w - htarget, + vtarget, + (unsigned char *)pTile->devPrivate.ptr + yOffset, + pTile->devKind, + alu, planes ) ; + } + } + else if ( h > vtarget ) { + xf4bppDrawColorImage( pWin, x, y + vtarget, + htarget, + MIN( h, pTile->drawable.height ) - vtarget, + (unsigned char *)pTile->devPrivate.ptr + xOffset, + pTile->devKind, + alu, planes ) ; + vtarget = pTile->drawable.height ; + } + } + else { /* No Y Offset */ + xf4bppDrawColorImage( pWin, x, y, + htarget = MIN( pTile->drawable.width - xOffset, w ), + vtarget = MIN( pTile->drawable.height, h ), + (unsigned char *)pTile->devPrivate.ptr + xOffset, + pTile->devKind, + alu, planes ) ; + if ( w > htarget ) { + xf4bppDrawColorImage( pWin, x + htarget, y, + MIN( pTile->drawable.width, w ) - htarget, + vtarget, + pTile->devPrivate.ptr, + pTile->devKind, + alu, planes ) ; + } + } + } + else if ( yOffset ) { + xf4bppDrawColorImage( pWin, x, y, + htarget = MIN( pTile->drawable.width, w ), + vtarget = MIN( pTile->drawable.height - yOffset, h ), + (unsigned char *)pTile->devPrivate.ptr + ( yOffset * pTile->devKind ), + pTile->devKind, + alu, planes ) ; + if ( h > vtarget ) { + xf4bppDrawColorImage( pWin, x, y + vtarget, + htarget, + MIN( pTile->drawable.height, h ) - vtarget, + pTile->devPrivate.ptr, + pTile->devKind, + alu, planes ) ; + } + } + else { /* NO Offset */ + xf4bppDrawColorImage( pWin, x, y, + htarget = MIN( pTile->drawable.width, w ), + vtarget = MIN( pTile->drawable.height, h ), + pTile->devPrivate.ptr, + pTile->devKind, + alu, planes ) ; + } + + return ; +} + +/* GJA -- + * After finding three kinds of errors in this single function, + * (requiring modifications to be made at at least 10 places, + * I decided to REWRITE the body of the xf4bppTileRect function from scratch. + * This version simply computes all relevant margins in advance, and does + * not try to reuse temporary variables. I leave that to the compiler. + * (This was a maintenance and robustness nightmare anyway.) + * The code is pretty obvious: all margins, coordinates, and numbers of tiles + * are computed before drawing starts. + * Notice that the margins consist of incompletely drawn tiles. Therefore + * we need offsets in the data for the left and upper margins. + * The right and lower margins are also incomplete, but start at offset 0 + * in the data. They just end at awkward offsets. + * The center block, by definition, consists of fully drawn tiles. + * Perhaps we could leave out some if's. But why bother? It would decrease + * robustness. + */ +void +xf4bppTileRect( pWin, pTile, alu, planes, x0, y0, w, h, xSrc, ySrc ) +WindowPtr pWin; /* GJA */ +register PixmapPtr pTile ; +const int alu ; +const unsigned long int planes ; +register int x0, y0, w, h ; +int xSrc ; +int ySrc ; +{ +int xOffset ; +int yOffset ; +int width, height; + +TRACE( ( "xf4bppTileRect(pTile=x%x,alu=x%x,planes=x%02x,x0=%d,y0=%d,w=%d,h=%d,xSrc=%d,ySrc=%d\n", + pTile, alu, planes, x0, y0, w, h, xSrc, ySrc ) ) ; + + switch ( alu ) { + case GXclear: /* 0x0 Zero 0 */ + case GXinvert: /* 0xa NOT dst */ + case GXset: /* 0xf 1 */ + xf4bppFillSolid + ( pWin, 0xFF, alu, planes, x0, y0, w, h ) ; + case GXnoop: /* 0x5 dst */ + return ; + default: + break ; +} + + width = pTile->drawable.width; + if ( ( xOffset = ( x0 - xSrc ) ) > 0 ) + xOffset %= width ; + else + xOffset = width - (( - xOffset ) % width ) ; + if ( xOffset == width ) xOffset = 0; /* For else case */ + + height = pTile->drawable.height; + if ( ( yOffset = ( y0 - ySrc ) ) > 0 ) + yOffset %= height ; + else + yOffset = height - (( - yOffset ) % height ) ; + if ( yOffset == height ) yOffset = 0; /* For else case */ + + switch ( alu ) { + case GXcopyInverted: /* 0xc NOT src */ + case GXcopy: /* 0x3 src */ + /* Special Case Code */ + DrawFirstTile( pWin, pTile, x0, y0, w, h, + alu, planes, xOffset, yOffset ) ; + /* Here We Double The Size Of The BLIT Each Iteration */ + xf4bppReplicateArea( pWin, x0, y0, planes, w, h, + MIN( w, pTile->drawable.width ), + MIN( h, pTile->drawable.height ) ) ; + break ; + case GXnor: /* 0x8 NOT src AND NOT dst */ + case GXandReverse: /* 0x2 src AND NOT dst */ + case GXorReverse: /* 0xb src OR NOT dst */ + case GXnand: /* 0xe NOT src OR NOT dst */ + case GXandInverted: /* 0x4 NOT src AND dst */ + case GXand: /* 0x1 src AND dst */ + case GXequiv: /* 0x9 NOT src XOR dst */ + case GXxor: /* 0x6 src XOR dst */ + case GXorInverted: /* 0xd NOT src OR dst */ + case GXor: /* 0x7 src OR dst */ + default: + { + register unsigned char *data ; + register int hcount, vcount ; /* Number of tiles in center */ + int xcount, ycount; /* Temporaries */ + int x1, y1; /* Left upper corner of center */ + int x2, y2; /* Left upper corner of lower right margin */ + int leftmgn, rightmgn, topmgn, botmgn; /* Margins */ + + int htarget, vtarget ; + + data = pTile->devPrivate.ptr; + + /* Compute the various sizes and coordinates. */ + leftmgn = MIN( w, width - xOffset ) ; + x1 = x0 + leftmgn; + topmgn = MIN( h, height - yOffset ) ; + y1 = y0 + topmgn; + + rightmgn = (w - leftmgn) % width; + hcount = (w - leftmgn) / width; + x2 = x0 + w - rightmgn; + botmgn = (h - topmgn) % height; + vcount = (h - topmgn) / height; + y2 = y0 + h - botmgn; + + /* We'll use yOffset as offset in data. + * This requires yOffset != height (ditto xOffset). + */ + yOffset *= pTile->devKind; + + /* Draw top margin, including corners */ + if ( topmgn ) { + if ( leftmgn ) { + xf4bppDrawColorImage( pWin, x0, y0, leftmgn, topmgn, + data + yOffset + xOffset, + pTile->devKind, alu, planes ) ; + } + for ( xcount = hcount, htarget = x1; + xcount ; + xcount--, htarget += width ) + { + xf4bppDrawColorImage( pWin, htarget, y0, width, topmgn, + data + yOffset, + pTile->devKind, alu, planes ) ; + } + if ( rightmgn ) { + xf4bppDrawColorImage( pWin, x2, y0, rightmgn, topmgn, + data + yOffset, + pTile->devKind, alu, planes ) ; + } + } + + /* Draw bottom margin, including corners */ + if ( botmgn ) { + if ( leftmgn ) { + xf4bppDrawColorImage( pWin, x0, y2, leftmgn, botmgn, + data + xOffset, + pTile->devKind, alu, planes ) ; + } + for ( xcount = hcount, htarget = x1; + xcount ; + xcount--, htarget += width ) + { + xf4bppDrawColorImage( pWin, htarget, y2, width, botmgn, + data, + pTile->devKind, alu, planes ) ; + } + if ( rightmgn ) { + xf4bppDrawColorImage( pWin, x2, y2, rightmgn, botmgn, + data, + pTile->devKind, alu, planes ) ; + } + } + + /* Draw left margin, excluding corners */ + if ( leftmgn ) { + for ( ycount = vcount, vtarget = y1 ; + ycount ; + ycount--, vtarget += height ) + { + xf4bppDrawColorImage( pWin, x0, vtarget, leftmgn, height, + data + xOffset, + pTile->devKind, alu, planes ) ; + } + } + + /* Draw right margin, excluding corners */ + if ( rightmgn ) { + for ( ycount = vcount, vtarget = y1 ; + ycount ; + ycount--, vtarget += height ) + { + xf4bppDrawColorImage( pWin, x2, vtarget, rightmgn, height, + data, + pTile->devKind, alu, planes ) ; + } + } + + /* Draw center consisting of full tiles */ + for ( ycount = vcount, vtarget = y1 ; + ycount ; + ycount--, vtarget += height ) + { + for ( xcount = hcount, htarget = x1 ; + xcount ; + xcount--, htarget += width ) + { + xf4bppDrawColorImage( pWin, htarget, vtarget, width, height, + data, + pTile->devKind, alu, planes ) ; + + } + } + } } /* Block + switch */ +} diff --git a/xorg-server/hw/xfree86/xf4bpp/ibmTrace.h b/xorg-server/hw/xfree86/xf4bpp/ibmTrace.h new file mode 100644 index 000000000..f1d88406d --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/ibmTrace.h @@ -0,0 +1 @@ +#define TRACE(x) /* empty */ diff --git a/xorg-server/hw/xfree86/xf4bpp/mfbbres.c b/xorg-server/hw/xfree86/xf4bpp/mfbbres.c new file mode 100644 index 000000000..09d7ee288 --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/mfbbres.c @@ -0,0 +1,164 @@ +/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ +/*********************************************************** + +Copyright (c) 1987 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 +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the 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. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ +/* GJA -- modified this file for vga16 */ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include "xf4bpp.h" +#include "OScompiler.h" +#include "mfbmap.h" +#include "mfb.h" +#include "maskbits.h" +#include "miline.h" +#include "wm3.h" + +/* Solid bresenham line */ +/* NOTES + e2 is used less often than e1, so it's not in a register +*/ + +void +xf4bppBresS(addrlbase, nlwidth, signdx, signdy, axis, x1, y1, e, e1, e2, len) +PixelType *addrlbase; /* pointer to base of bitmap */ +int nlwidth; /* width in longwords of bitmap */ +int signdx, signdy; /* signs of directions */ +int axis; /* major axis (Y_AXIS or X_AXIS) */ +int x1, y1; /* initial point */ +register int e; /* error accumulator */ +register int e1; /* bresenham increments */ +int e2; +int len; /* length of line */ +{ + register int yinc; /* increment to next scanline, in bytes */ + register PixelType *addrl; /* bitmask long pointer + *dont* * cast to char pointer */ + register PixelType bit; /* current bit being set/cleared/etc. */ + PixelType leftbit = mfbGetmask(0); /* leftmost bit to process in new word */ + PixelType rightbit = mfbGetmask(PPW-1); /* rightmost bit to process in new word */ + + register int e3 = e2-e1; + + /* point to longword containing first point */ + addrl = mfbScanline(addrlbase, x1, y1, nlwidth); + yinc = signdy * nlwidth; + e = e-e1; /* to make looping easier */ + bit = mfbGetmask(x1 & PIM); + + if (!len) + return; + + if (axis == X_AXIS) + { + if (signdx > 0) + { + while(len--) + { + UPDRW(addrl,bit); + e += e1; + if (e >= 0) + { + addrl += yinc; + e += e3; + } + bit = SCRRIGHT(bit,1); + if (!bit) { bit = leftbit; addrl++; } + } + } + else + { + while(len--) + { + UPDRW(addrl,bit); + e += e1; + if (e >= 0) + { + addrl += yinc; + e += e3; + } + bit = SCRLEFT(bit,1); + if (!bit) { bit = rightbit; addrl--; } + } + } + } /* if X_AXIS */ + else + { + if (signdx > 0) + { + while(len--) + { + UPDRW(addrl,bit); + e += e1; + if (e >= 0) + { + bit = SCRRIGHT(bit,1); + if (!bit) { bit = leftbit; addrl++; } + e += e3; + } + addrl += yinc; + } + } + else + { + while(len--) + { + UPDRW(addrl,bit); + e += e1; + if (e >= 0) + { + bit = SCRLEFT(bit,1); + if (!bit) { bit = rightbit; addrl--; } + e += e3; + } + addrl += yinc; + } + } + } /* else Y_AXIS */ +} diff --git a/xorg-server/hw/xfree86/xf4bpp/mfbbresd.c b/xorg-server/hw/xfree86/xf4bpp/mfbbresd.c new file mode 100644 index 000000000..318d4f5da --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/mfbbresd.c @@ -0,0 +1,205 @@ +/*********************************************************** + +Copyright (c) 1987 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 +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the 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. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ +/* GJA -- modified this file for vga16 */ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include "xf4bpp.h" +#include "OScompiler.h" +#include "mfbmap.h" +#include "mfb.h" +#include "maskbits.h" +#include "miline.h" +#include "wm3.h" +#include "xf86.h" + +/* Dashed bresenham line */ + +#define NO_INK (-1) /* GJA -- means: dash is off */ + +#define StepDash\ + if (!--dashRemaining) { \ + if (++ dashIndex == numInDashList) \ + dashIndex = 0; \ + dashRemaining = pDash[dashIndex]; \ + ink = fgink; \ + if (dashIndex & 1) \ + ink = bgink; \ + if (isDoubleDash) \ + WM3_SET_INK(ink); \ + } + +void +xf4bppBresD(pDrawable, fgink, bgink, + pdashIndex, pDash, numInDashList, pdashOffset, isDoubleDash, + addrlbase, nlwidth, + signdx, signdy, axis, x1, y1, e, e1, e2, len) +DrawablePtr pDrawable; +int fgink, bgink; +int *pdashIndex; /* current dash */ +unsigned char *pDash; /* dash list */ +int numInDashList; /* total length of dash list */ +int *pdashOffset; /* offset into current dash */ +int isDoubleDash; +PixelType *addrlbase; /* pointer to base of bitmap */ +int nlwidth; /* width in longwords of bitmap */ +int signdx, signdy; /* signs of directions */ +int axis; /* major axis (Y_AXIS or X_AXIS) */ +int x1, y1; /* initial point */ +register int e; /* error accumulator */ +register int e1; /* bresenham increments */ +int e2; +int len; /* length of line */ +{ + IOADDRESS REGBASE = + xf86Screens[pDrawable->pScreen->myNum]->domainIOBase + 0x300; + register int yinc; /* increment to next scanline, in bytes */ + register PixelType *addrl; + register int e3 = e2-e1; + register unsigned long bit; + PixelType leftbit = mfbGetmask(0); /* leftmost bit to process in new word */ + PixelType rightbit = mfbGetmask(PPW-1); /* rightmost bit to process in new word */ + int dashIndex; + int dashOffset; + int dashRemaining; + int ink; + + fgink &= 0x0F; bgink &= 0x0F; /* GJA -- so they're != NO_INK */ + + dashOffset = *pdashOffset; + dashIndex = *pdashIndex; + dashRemaining = pDash[dashIndex] - dashOffset; + ink = fgink; + if (!isDoubleDash) + bgink = NO_INK; + if (dashIndex & 1) + ink = bgink; + if ( ink != NO_INK ) WM3_SET_INK(ink); + + /* point to longword containing first point */ + addrl = mfbScanline(addrlbase, x1, y1, nlwidth); + yinc = signdy * nlwidth; + e = e-e1; /* to make looping easier */ + bit = mfbGetmask(x1 & PIM); + if (axis == X_AXIS) + { + if (signdx > 0) + { + while(len--) + { + if ( ink != NO_INK ) UPDRW(addrl,bit); + e += e1; + if (e >= 0) + { + addrl += yinc; + e += e3; + } + bit = SCRRIGHT(bit,1); + if (!bit) { bit = leftbit; addrl++; } + StepDash + } + } + else + { + while(len--) + { + + if ( ink != NO_INK ) UPDRW(addrl,bit); + e += e1; + if (e >= 0) + { + addrl += yinc; + e += e3; + } + bit = SCRLEFT(bit,1); + if (!bit) { bit = rightbit; addrl--; } + StepDash + } + } + } /* if X_AXIS */ + else + { + if (signdx > 0) + { + while(len--) + { + if ( ink != NO_INK ) UPDRW(addrl,bit); + e += e1; + if (e >= 0) + { + bit = SCRRIGHT(bit,1); + if (!bit) { bit = leftbit; addrl++; } + e += e3; + } + addrl += yinc; + StepDash + } + } + else + { + while(len--) + { + + if ( ink != NO_INK ) UPDRW(addrl,bit); + e += e1; + if (e >= 0) + { + bit = SCRLEFT(bit,1); + if (!bit) { bit = rightbit; addrl--; } + e += e3; + } + addrl += yinc; + StepDash + } + } + } /* else Y_AXIS */ + *pdashIndex = dashIndex; + *pdashOffset = pDash[dashIndex] - dashRemaining; +} diff --git a/xorg-server/hw/xfree86/xf4bpp/mfbfillarc.c b/xorg-server/hw/xfree86/xf4bpp/mfbfillarc.c new file mode 100644 index 000000000..89aeadd2b --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/mfbfillarc.c @@ -0,0 +1,301 @@ +/************************************************************ + +Copyright (c) 1989 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 +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the 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. + +********************************************************/ + +/* GJA -- Took mfb code and modified it. */ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include "xf4bpp.h" +#include "OScompiler.h" +#include "mfbmap.h" +#include "mfb.h" +#include "maskbits.h" +#include "mi.h" +#include "mifillarc.h" +#include "wm3.h" + +#include "xf86str.h" /* for pScrn->vtSema */ +extern ScrnInfoPtr *xf86Screens; + +static void +v16FillEllipseSolid +( + DrawablePtr pDraw, + xArc *arc +) +{ + int x, y, e; + int yk, xk, ym, xm, dx, dy, xorg, yorg; + register int slw; + miFillArcRec info; + int *addrlt, *addrlb; + register int *addrl; + register int n; + int nlwidth; + register int xpos; + int startmask, endmask, nlmiddle; + + if (pDraw->type == DRAWABLE_WINDOW) + { + addrlt = (int *) + (((PixmapPtr)(pDraw->pScreen->devPrivate))->devPrivate.ptr); + nlwidth = (int) + (((PixmapPtr)(pDraw->pScreen->devPrivate))->devKind) >> 2; + } + else + { + addrlt = (int *)(((PixmapPtr)pDraw)->devPrivate.ptr); + nlwidth = (int)(((PixmapPtr)pDraw)->devKind) >> 2; + } + + miFillArcSetup(arc, &info); + MIFILLARCSETUP(); + xorg += pDraw->x; + yorg += pDraw->y; + addrlb = addrlt; + addrlt += nlwidth * (yorg - y); + addrlb += nlwidth * (yorg + y + dy); + while (y) + { + addrlt += nlwidth; + addrlb -= nlwidth; + MIFILLARCSTEP(slw); + if (!slw) + continue; + xpos = xorg - x; + addrl = addrlt + (xpos >> PWSH); + if (((xpos & PIM) + slw) < PPW) + { + maskpartialbits(xpos, slw, startmask); + UPDRW(addrl,startmask); + if (miFillArcLower(slw)) + { + addrl = addrlb + (xpos >> PWSH); + UPDRW(addrl,startmask); + } + continue; + } + maskbits(xpos, slw, startmask, endmask, nlmiddle); + if (startmask) + { + UPDRW(addrl,startmask); addrl++; + } + n = nlmiddle; + while (n--) { + UPDRW(addrl,~0); addrl++; + } + if (endmask) + { + UPDRW(addrl,endmask); + } + if (!miFillArcLower(slw)) + continue; + addrl = addrlb + (xpos >> PWSH); + if (startmask) + { + UPDRW(addrl,startmask); addrl++; + } + n = nlmiddle; + while (n--) { + UPDRW(addrl,~0); addrl++; + } + if (endmask) + { + UPDRW(addrl,endmask); + } + } +} + +#define FILLSPAN(xl,xr,addr) \ + if (xr >= xl) \ + { \ + width = xr - xl + 1; \ + addrl = addr + (xl >> PWSH); \ + if (((xl & PIM) + width) < PPW) \ + { \ + maskpartialbits(xl, width, startmask); \ + UPDRW(addrl,startmask); \ + } \ + else \ + { \ + maskbits(xl, width, startmask, endmask, nlmiddle); \ + if (startmask) \ + { \ + UPDRW(addrl,startmask); addrl++; \ + } \ + n = nlmiddle; \ + while (n--) { \ + UPDRW(addrl,~0); addrl++; \ + } \ + if (endmask) \ + { \ + UPDRW(addrl,endmask); \ + } \ + } \ + } + +#define FILLSLICESPANS(flip,addr) \ + if (!flip) \ + { \ + FILLSPAN(xl, xr, addr); \ + } \ + else \ + { \ + xc = xorg - x; \ + FILLSPAN(xc, xr, addr); \ + xc += slw - 1; \ + FILLSPAN(xl, xc, addr); \ + } + +static void +v16FillArcSliceSolidCopy +( + DrawablePtr pDraw, + GCPtr pGC, + xArc *arc +) +{ + register int *addrl; + register int n; + int yk, xk, ym, xm, dx, dy, xorg, yorg, slw; + register int x, y, e; + miFillArcRec info; + miArcSliceRec slice; + int xl, xr, xc; + int *addrlt, *addrlb; + int nlwidth; + int width; + int startmask, endmask, nlmiddle; + + if (pDraw->type == DRAWABLE_WINDOW) + { + addrlt = (int *) + (((PixmapPtr)(pDraw->pScreen->devPrivate))->devPrivate.ptr); + nlwidth = (int) + (((PixmapPtr)(pDraw->pScreen->devPrivate))->devKind) >> 2; + } + else + { + addrlt = (int *)(((PixmapPtr)pDraw)->devPrivate.ptr); + nlwidth = (int)(((PixmapPtr)pDraw)->devKind) >> 2; + } + + miFillArcSetup(arc, &info); + miFillArcSliceSetup(arc, &slice, pGC); + MIFILLARCSETUP(); + xorg += pDraw->x; + yorg += pDraw->y; + addrlb = addrlt; + addrlt += nlwidth * (yorg - y); + addrlb += nlwidth * (yorg + y + dy); + slice.edge1.x += pDraw->x; + slice.edge2.x += pDraw->x; + while (y > 0) + { + addrlt += nlwidth; + addrlb -= nlwidth; + MIFILLARCSTEP(slw); + MIARCSLICESTEP(slice.edge1); + MIARCSLICESTEP(slice.edge2); + if (miFillSliceUpper(slice)) + { + MIARCSLICEUPPER(xl, xr, slice, slw); + FILLSLICESPANS(slice.flip_top, addrlt); + } + if (miFillSliceLower(slice)) + { + MIARCSLICELOWER(xl, xr, slice, slw); + FILLSLICESPANS(slice.flip_bot, addrlb); + } + } +} + +static void +xf4bppPolyFillArcSolid +( + register DrawablePtr pDraw, + GCPtr pGC, + int narcs, + xArc *parcs +) +{ + register xArc *arc; + register int i; + BoxRec box; + RegionPtr cclip; +#if 0 + mfbPrivGC *priv; + int rop; + + priv = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + mfbGetGCPrivateKey()); + rop = priv->rop; + if ((rop == RROP_NOP) || !(pGC->planemask & 1)) +#else + if ( !(pGC->planemask & 0x0F)) +#endif + return; + cclip = pGC->pCompositeClip; + for (arc = parcs, i = narcs; --i >= 0; arc++) + { + if (miFillArcEmpty(arc)) + continue; + if (miCanFillArc(arc)) + { + box.x1 = arc->x + pDraw->x; + box.y1 = arc->y + pDraw->y; + box.x2 = box.x1 + (int)arc->width + 1; + box.y2 = box.y1 + (int)arc->height + 1; + if (RECT_IN_REGION(pDraw->pScreen, cclip, &box) == rgnIN) + { + if ((arc->angle2 >= FULLCIRCLE) || + (arc->angle2 <= -FULLCIRCLE)) + DO_WM3(pGC,v16FillEllipseSolid(pDraw, arc)) + else + DO_WM3(pGC,v16FillArcSliceSolidCopy(pDraw, pGC, arc)) + continue; + } + } + miPolyFillArc(pDraw, pGC, 1, arc); + } +} + +void +xf4bppPolyFillArc(pDraw, pGC, narcs, parcs) + register DrawablePtr pDraw; + GCPtr pGC; + int narcs; + xArc *parcs; +{ + if ( !xf86Screens[pDraw->pScreen->myNum]->vtSema || (pGC->fillStyle != FillSolid) ) { + miPolyFillArc(pDraw, pGC, narcs, parcs); + } else { + xf4bppPolyFillArcSolid(pDraw, pGC, narcs, parcs); + } +} diff --git a/xorg-server/hw/xfree86/xf4bpp/mfbhrzvert.c b/xorg-server/hw/xfree86/xf4bpp/mfbhrzvert.c new file mode 100644 index 000000000..3444f48f5 --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/mfbhrzvert.c @@ -0,0 +1,135 @@ +/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ +/*********************************************************** + +Copyright (c) 1987 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 +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the 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. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ +/* GJA -- modified this file for vga16 */ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include "xf4bpp.h" +#include "OScompiler.h" +#include "mfbmap.h" +#include "mfb.h" +#include "maskbits.h" +#include "wm3.h" + +/* horizontal solid line + abs(len) > 1 +*/ + +void +xf4bppHorzS(addrl, nlwidth, x1, y1, len) +register PixelType *addrl; /* pointer to base of bitmap */ +register int nlwidth; /* width in longwords of bitmap */ +int x1; /* initial point */ +int y1; +int len; /* length of line */ +{ + register PixelType startmask; + register PixelType endmask; + register int nlmiddle; + + + /* force the line to go left to right + but don't draw the last point + */ + if (len < 0) + { + x1 += len; + x1 += 1; + len = -len; + } + + addrl = mfbScanline(addrl, x1, y1, nlwidth); + + /* all bits inside same longword */ + if ( ((x1 & PIM) + len) < PPW) + { + maskpartialbits(x1, len, startmask); + UPDRW(addrl,startmask); + } + else + { + maskbits(x1, len, startmask, endmask, nlmiddle); + if (startmask) { + UPDRW(addrl,startmask); addrl++; + } + Duff (nlmiddle, UPDRW(addrl,~0); addrl++); + if (endmask) { + UPDRW(addrl,endmask); + } + } +} + +/* vertical solid line + this uses do loops because pcc (Ultrix 1.2, bsd 4.2) generates + better code. sigh. we know that len will never be 0 or 1, so + it's OK to use it. +*/ + +void +xf4bppVertS(addrl, nlwidth, x1, y1, len) +register PixelType *addrl; /* pointer to base of bitmap */ +register int nlwidth; /* width in longwords of bitmap */ +int x1, y1; /* initial point */ +register int len; /* length of line */ +{ + register PixelType bitmask; + + addrl = mfbScanline(addrl, x1, y1, nlwidth); + + if (len < 0) + { + nlwidth = -nlwidth; + len = -len; + } + + bitmask = mfbGetmask(x1 & PIM); + Duff(len, UPDRW(addrl,bitmask); addrl += nlwidth); +} diff --git a/xorg-server/hw/xfree86/xf4bpp/mfbimggblt.c b/xorg-server/hw/xfree86/xf4bpp/mfbimggblt.c new file mode 100644 index 000000000..4f9561161 --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/mfbimggblt.c @@ -0,0 +1,505 @@ +/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ +/*********************************************************** + +Copyright (c) 1987 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 +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the 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. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include "xf4bpp.h" +#include "OScompiler.h" +#include "mfbmap.h" +#include "mfb.h" +#include "maskbits.h" +#include "mi.h" +#include "dixfontstr.h" +#include "ppcGCstr.h" +#include "wm3.h" + +#include "xf86str.h" /* for pScrn->vtSema */ +extern ScrnInfoPtr *xf86Screens; + +/* + we should eventually special-case fixed-width fonts for ImageText. + + this works for fonts with glyphs <= 32 bits wide. + + the clipping calculations are done for worst-case fonts. +we make no assumptions about the heights, widths, or bearings +of the glyphs. if we knew that the glyphs are all the same height, +we could clip the tops and bottoms per clipping box, rather +than per character per clipping box. if we knew that the glyphs' +left and right bearings were wlle-behaved, we could clip a single +character at the start, output until the last unclipped +character, and then clip the last one. this is all straightforward +to determine based on max-bounds and min-bounds from the font. + there is some inefficiency introduced in the per-character +clipping to make what's going on clearer. + + (it is possible, for example, for a font to be defined in which the +next-to-last character in a font would be clipped out, but the last +one wouldn't. the code below deals with this.) + + Image text looks at the bits in the glyph and the fg and bg in the +GC. it paints a rectangle, as defined in the protocol dcoument, +and the paints the characters. + + to avoid source proliferation, this file is compiled +three times: + MFBIMAGEGLYPHBLT OPEQ + mfbImageGlyphBltWhite |= + mfbImageGlyphBltBlack &=~ + + the register allocations for startmask and endmask may not +be the right thing. are there two other deserving candidates? +xoff, pdst, pglyph, and tmpSrc seem like the right things, though. +*/ + +/* Forward declarations -- GJA */ +static void doImageGlyphBlt( + DrawablePtr, + GC *, + int, + int, + unsigned int, + CharInfoPtr *, + unsigned char *, + ExtentInfoRec * +); + +void +xf4bppImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) + DrawablePtr pDrawable; + GC *pGC; + int x, y; + unsigned int nglyph; + CharInfoPtr *ppci; /* array of character info */ + pointer pglyphBase; /* start of array of glyphs */ +{ + ExtentInfoRec info; /* used by QueryGlyphExtents() */ + xRectangle backrect;/* backing rectangle to paint. + in the general case, NOT necessarily + the same as the string's bounding box + */ + /* GJA -- I agree, this ALL should be moved to GC validation. */ + if ( (pDrawable->type != DRAWABLE_WINDOW) || (pGC->alu != GXcopy) || + !xf86Screens[pDrawable->pScreen->myNum]->vtSema || + ((pGC->font) && + (FONTMAXBOUNDS(pGC->font,rightSideBearing) - + FONTMINBOUNDS(pGC->font,leftSideBearing) > 32 || + FONTMINBOUNDS(pGC->font,characterWidth) < 0)) ) { + miImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); + } else { + ppcPrivGC *pPrivGC; + int oldfillStyle, oldfg, oldalu; + + if (!(pGC->planemask & 0x0F)) + return; + + QueryGlyphExtents(pGC->font, ppci, (unsigned long)nglyph, &info); + + backrect.x = x; + backrect.y = y - FONTASCENT(pGC->font); + backrect.width = info.overallWidth; + backrect.height = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font); + + + pPrivGC = (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, + mfbGetGCPrivateKey()); + oldfillStyle = pPrivGC->colorRrop.fillStyle; /* GJA */ + oldfg = pPrivGC->colorRrop.fgPixel; /* GJA */ + oldalu = pPrivGC->colorRrop.alu; /* GJA */ + + pPrivGC->colorRrop.fillStyle = FillSolid; /* GJA */ + pPrivGC->colorRrop.fgPixel = pGC->bgPixel; /* GJA */ + pGC->fgPixel = pGC->bgPixel; + pPrivGC->colorRrop.alu = GXcopy; /* GJA */ + pGC->alu = GXcopy; + + /* Required fields: + * colorRrop.alu, colorRrop.planemask, colorRrop.fgPixel + */ + xf4bppPolyFillRect(pDrawable, pGC, 1, &backrect); + + pPrivGC->colorRrop.fgPixel = oldfg; /* GJA */ + pGC->fgPixel = oldfg; + + /* the faint-hearted can open their eyes now */ + + DO_WM3(pGC,doImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, + pglyphBase,&info)) + + pPrivGC->colorRrop.fillStyle = oldfillStyle; /* GJA */ + pPrivGC->colorRrop.alu = oldalu; /* GJA */ + pGC->alu = oldalu; + } + +} + +static void +doImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase,infop) + DrawablePtr pDrawable; + GC *pGC; + int x, y; + unsigned int nglyph; + CharInfoPtr *ppci; /* array of character info */ + unsigned char *pglyphBase; /* start of array of glyphs */ + ExtentInfoRec* infop; /* used by QueryGlyphExtents() */ +{ + BoxRec bbox; /* string's bounding box */ + + CharInfoPtr pci; + int xorg, yorg; /* origin of drawable in bitmap */ + int widthDst; /* width of dst in longwords */ + + /* these keep track of the character origin */ + CARD32 *pdstBase; + /* points to longword with character origin */ + int xchar; /* xorigin of char (mod 32) */ + + /* these are used for placing the glyph */ + register int xoff; /* x offset of left edge of glyph (mod 32) */ + register CARD32 *pdst; + /* pointer to current longword in dst */ + + int w; /* width of glyph in bits */ + int h; /* height of glyph */ + int widthGlyph; /* width of glyph, in bytes */ + register unsigned char *pglyph; + /* pointer to current row of glyph */ + + /* used for putting down glyph */ + register unsigned int tmpSrc; + /* for getting bits from glyph */ + register int startmask; + register int endmask; + + register int nFirst;/* bits of glyph in current longword */ + + xorg = pDrawable->x; + yorg = pDrawable->y; + if (pDrawable->type == DRAWABLE_WINDOW) + { + pdstBase = (CARD32 *) + (((PixmapPtr)(pDrawable->pScreen->devPrivate))->devPrivate.ptr); + widthDst = (int) + (((PixmapPtr)(pDrawable->pScreen->devPrivate))->devKind) >> 2; + } + else + { + pdstBase = (CARD32 *)(((PixmapPtr)pDrawable)->devPrivate.ptr); + widthDst = (int)(((PixmapPtr)pDrawable)->devKind) >> 2; + } + + x += xorg; + y += yorg; + bbox.x1 = x + infop->overallLeft; + bbox.x2 = x + infop->overallRight; + bbox.y1 = y - infop->overallAscent; + bbox.y2 = y + infop->overallDescent; + + /* UNCLEAN CODE + we know the mfbPolyFillRect uses only three fields in + devPrivate[mfbGetGCPrivateIndex()].ptr, two of which (the rotated + tile/stipple and the ropFillArea) are + irrelevant for solid filling, so we just poke the FillArea + field. the GC is now in an inconsistent state, but we'll fix + it as soon as PolyFillRect returns. fortunately, the server + is single threaded. + + NOTE: + if you are not using the standard mfbFillRectangle code, you + need to poke any fields in the GC the rectangle stuff need + (probably alu, fgPixel, and fillStyle) and in devPrivate[mfbGetGCPrivateIndex()].ptr + (probably rop or ropFillArea.) You could just call ValidateGC, + but that is usually not a cheap thing to do. + */ + + switch (RECT_IN_REGION(pGC->pScreen, pGC->pCompositeClip, &bbox)) + { + case rgnOUT: + break; + case rgnIN: + pdstBase = pdstBase + (widthDst * y) + (x >> PWSH); + xchar = x & PIM; + + while(nglyph--) + { + pci = *ppci; + pglyph = FONTGLYPHBITS(pglyphBase, pci); + w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing; + h = pci->metrics.ascent + pci->metrics.descent; + widthGlyph = GLYPHWIDTHBYTESPADDED(pci); + + /* start at top scanline of glyph */ + pdst = pdstBase - (pci->metrics.ascent * widthDst); + + /* find correct word in scanline and x offset within it + for left edge of glyph + */ + xoff = xchar + pci->metrics.leftSideBearing; + if (xoff > PIM) + { + pdst++; + xoff &= PIM; + } + else if (xoff < 0) + { + xoff += PPW; + pdst--; + } + + if ((xoff + w) <= PPW) + { + /* glyph all in one longword */ + maskpartialbits(xoff, w, startmask); + + while (h--) + { + getleftbits(pglyph, w, tmpSrc); + UPDRW(pdst,(SCRRIGHT(tmpSrc, xoff) & startmask)); + pglyph += widthGlyph; + pdst += widthDst; + } + } + else + { + /* glyph crosses longword boundary */ + maskPPWbits(xoff, w, startmask, endmask); + nFirst = PPW - xoff; + while (h--) + { + getleftbits(pglyph, w, tmpSrc); + UPDRW(pdst,(SCRRIGHT(tmpSrc, xoff) & startmask)); + UPDRW(&(pdst[1]),(SCRLEFT(tmpSrc, nFirst) & endmask)); + pglyph += widthGlyph; + pdst += widthDst; + } + } /* glyph crosses longwords boundary */ + + /* update character origin */ + x += pci->metrics.characterWidth; + xchar += pci->metrics.characterWidth; + if (xchar > PLST) + { + xchar -= PPW; + pdstBase++; + } + else if (xchar < 0) + { + xchar += PPW; + pdstBase--; + } + ppci++; + } /* while nglyph-- */ + break; + case rgnPART: + { + TEXTPOS *ppos; + int nbox; + BoxPtr pbox; + RegionPtr cclip; + int xpos; /* x position of char origin */ + unsigned int i; + BoxRec clip; + int leftEdge, rightEdge; + int topEdge, bottomEdge; + int glyphRow; /* first row of glyph not wholly + clipped out */ + int glyphCol; /* leftmost visible column of glyph */ +#if GETLEFTBITS_ALIGNMENT > 1 + int getWidth; /* bits to get from glyph */ +#endif + + if(!(ppos = (TEXTPOS *)xalloc(nglyph * sizeof(TEXTPOS)))) + return; + + pdstBase = pdstBase + (widthDst * y) + (x >> PWSH); + xpos = x; + xchar = xpos & PIM; + + for (i=0; i<nglyph; i++) + { + pci = ppci[i]; + + ppos[i].xpos = xpos; + ppos[i].xchar = xchar; + ppos[i].leftEdge = xpos + pci->metrics.leftSideBearing; + ppos[i].rightEdge = xpos + pci->metrics.rightSideBearing; + ppos[i].topEdge = y - pci->metrics.ascent; + ppos[i].bottomEdge = y + pci->metrics.descent; + ppos[i].pdstBase = pdstBase; + ppos[i].widthGlyph = GLYPHWIDTHBYTESPADDED(pci); + + xpos += pci->metrics.characterWidth; + xchar += pci->metrics.characterWidth; + if (xchar > PLST) + { + xchar &= PIM; + pdstBase++; + } + else if (xchar < 0) + { + xchar += PPW; + pdstBase--; + } + } + + cclip = pGC->pCompositeClip; + pbox = REGION_RECTS(cclip); + nbox = REGION_NUM_RECTS(cclip); + + /* HACK ALERT + since we continue out of the loop below so often, it + is easier to increment pbox at the top than at the end. + don't try this at home. + */ + pbox--; + while(nbox--) + { + pbox++; + clip.x1 = max(bbox.x1, pbox->x1); + clip.y1 = max(bbox.y1, pbox->y1); + clip.x2 = min(bbox.x2, pbox->x2); + clip.y2 = min(bbox.y2, pbox->y2); + if ((clip.x2<=clip.x1) || (clip.y2<=clip.y1)) + continue; + + for(i=0; i<nglyph; i++) + { + pci = ppci[i]; + xchar = ppos[i].xchar; + + /* clip the left and right edges */ + if (ppos[i].leftEdge < clip.x1) + leftEdge = clip.x1; + else + leftEdge = ppos[i].leftEdge; + + if (ppos[i].rightEdge > clip.x2) + rightEdge = clip.x2; + else + rightEdge = ppos[i].rightEdge; + + w = rightEdge - leftEdge; + if (w <= 0) + continue; + + /* clip the top and bottom edges */ + if (ppos[i].topEdge < clip.y1) + topEdge = clip.y1; + else + topEdge = ppos[i].topEdge; + + if (ppos[i].bottomEdge > clip.y2) + bottomEdge = clip.y2; + else + bottomEdge = ppos[i].bottomEdge; + + h = bottomEdge - topEdge; + if (h <= 0) + continue; + + glyphRow = (topEdge - y) + pci->metrics.ascent; + widthGlyph = ppos[i].widthGlyph; + pglyph = FONTGLYPHBITS(pglyphBase, pci); + pglyph += (glyphRow * widthGlyph); + + pdst = ppos[i].pdstBase - ((y-topEdge) * widthDst); + + glyphCol = (leftEdge - ppos[i].xpos) - + (pci->metrics.leftSideBearing); +#if GETLEFTBITS_ALIGNMENT > 1 + getWidth = w + glyphCol; +#endif + xoff = xchar + (leftEdge - ppos[i].xpos); + if (xoff > PLST) + { + xoff &= PIM; + pdst++; + } + else if (xoff < 0) + { + xoff += PPW; + pdst--; + } + + if ((xoff + w) <= PPW) + { + maskpartialbits(xoff, w, startmask); + while (h--) + { + getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc); + UPDRW(pdst,(SCRRIGHT(tmpSrc, xoff) & startmask)); + pglyph += widthGlyph; + pdst += widthDst; + } + } + else + { + maskPPWbits(xoff, w, startmask, endmask); + nFirst = PPW - xoff; + while (h--) + { + getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc); + UPDRW(pdst,(SCRRIGHT(tmpSrc, xoff) & startmask)); + UPDRW(&(pdst[1]),(SCRLEFT(tmpSrc, nFirst) & endmask)); + pglyph += widthGlyph; + pdst += widthDst; + } + } + } /* for each glyph */ + } /* while nbox-- */ + xfree(ppos); + break; + } + default: + break; + } +} + diff --git a/xorg-server/hw/xfree86/xf4bpp/mfbline.c b/xorg-server/hw/xfree86/xf4bpp/mfbline.c new file mode 100644 index 000000000..d2d4e0b0e --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/mfbline.c @@ -0,0 +1,976 @@ +/*********************************************************** + +Copyright (c) 1987 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 +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the 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. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ +/* GJA -- modified this file for vga16 */ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include <stdlib.h> + +#include "xf4bpp.h" +#include "OScompiler.h" +#include "mfbmap.h" +#include "mfb.h" +#include "maskbits.h" +#include "mi.h" +#include "miline.h" +#include "vgaVideo.h" +#include "wm3.h" + +#include "xf86str.h" /* for pScrn->vtSema */ +extern ScrnInfoPtr *xf86Screens; + +/* single-pixel lines on a color frame buffer + + NON-SLOPED LINES + horizontal lines are always drawn left to right; we have to +move the endpoints right by one after they're swapped. + horizontal lines will be confined to a single band of a +region. the code finds that band (giving up if the lower +bound of the band is above the line we're drawing); then it +finds the first box in that band that contains part of the +line. we clip the line to subsequent boxes in that band. + vertical lines are always drawn top to bottom (y-increasing.) +this requires adding one to the y-coordinate of each endpoint +after swapping. + + SLOPED LINES + when clipping a sloped line, we bring the second point inside +the clipping box, rather than one beyond it, and then add 1 to +the length of the line before drawing it. this lets us use +the same box for finding the outcodes for both endpoints. since +the equation for clipping the second endpoint to an edge gives us +1 beyond the edge, we then have to move the point towards the +first point by one step on the major axis. + eventually, there will be a diagram here to explain what's going +on. the method uses Cohen-Sutherland outcodes to determine +outsideness, and a method similar to Pike's layers for doing the +actual clipping. + +*/ +#ifdef POLYSEGMENT +static void DoV16SegmentSS( + DrawablePtr, GCPtr, int, xSegment* +); + +void +xf4bppSegmentSS (pDrawable, pGC, nseg, pSeg) + DrawablePtr pDrawable; + GCPtr pGC; + int nseg; + register xSegment *pSeg; +{ + if ( ! xf86Screens[pDrawable->pScreen->myNum]->vtSema ) { + miPolySegment(pDrawable, pGC, nseg, pSeg); + } else { + DO_WM3(pGC,DoV16SegmentSS (pDrawable, pGC, nseg, pSeg)); + } +} + +#else +static void DoV16LineSS( + DrawablePtr, GCPtr, int, int, DDXPointPtr +); + +void +xf4bppLineSS (pDrawable, pGC, mode, npt, pptInit) + DrawablePtr pDrawable; + GCPtr pGC; + int mode; /* Origin or Previous */ + int npt; /* number of points */ + DDXPointPtr pptInit; +{ + if ( ! xf86Screens[pDrawable->pScreen->myNum]->vtSema ) { + miZeroLine(pDrawable, pGC, mode, npt, pptInit); + } else { + DO_WM3(pGC,DoV16LineSS (pDrawable, pGC, mode, npt, pptInit)); + } +} +#endif + +static void +#ifdef POLYSEGMENT +DoV16SegmentSS (pDrawable, pGC, nseg, pSeg) + DrawablePtr pDrawable; + GCPtr pGC; + int nseg; + register xSegment *pSeg; +#else +DoV16LineSS (pDrawable, pGC, mode, npt, pptInit) + DrawablePtr pDrawable; + GCPtr pGC; + int mode; /* Origin or Previous */ + int npt; /* number of points */ + DDXPointPtr pptInit; +#endif +{ + int nboxInit; + register int nbox; + BoxPtr pboxInit; + register BoxPtr pbox; +#ifndef POLYSEGMENT + register DDXPointPtr ppt; /* pointer to list of translated points */ +#endif + + unsigned int oc1; /* outcode of point 1 */ + unsigned int oc2; /* outcode of point 2 */ + + PixelType *addrlBase; /* pointer to start of drawable */ +#ifndef POLYSEGMENT + PixelType *addrl; /* address of destination pixmap */ +#endif + int nlwidth; /* width in longwords of destination pixmap */ + int xorg, yorg; /* origin of window */ + + 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; + unsigned int bias = miGetZeroLineBias(pDrawable->pScreen); + + /* a bunch of temporaries */ + register int y1, y2; + register int x1, x2; + RegionPtr cclip; +#ifndef POLYSEGMENT + int alu = pGC->alu; /* GJA */ +#endif + + if (!(pGC->planemask & 0x0F)) + return; + + cclip = pGC->pCompositeClip; + pboxInit = REGION_RECTS(cclip); + nboxInit = REGION_NUM_RECTS(cclip); + + nlwidth = BYTES_PER_LINE(pDrawable) >> 2; /* GJA */ + addrlBase = (PixelType *)VIDBASE(pDrawable); /* GJA */ + + xorg = pDrawable->x; + yorg = pDrawable->y; +#ifdef POLYSEGMENT + while (nseg--) +#else + ppt = pptInit; + x2 = ppt->x + xorg; + y2 = ppt->y + yorg; + while(--npt) +#endif + { + nbox = nboxInit; + pbox = pboxInit; + +#ifdef POLYSEGMENT + x1 = pSeg->x1 + xorg; + y1 = pSeg->y1 + yorg; + x2 = pSeg->x2 + xorg; + y2 = pSeg->y2 + yorg; + pSeg++; +#else + x1 = x2; + y1 = y2; + ++ppt; + if (mode == CoordModePrevious) + { + xorg = x1; + yorg = y1; + } + x2 = ppt->x + xorg; + y2 = ppt->y + yorg; +#endif + + if (x1 == x2) /* vertical line */ + { + /* make the line go top to bottom of screen, keeping + endpoint semantics + */ + if (y1 > y2) + { + register int tmp; + + tmp = y2; + y2 = y1 + 1; + y1 = tmp + 1; +#ifdef POLYSEGMENT + if (pGC->capStyle != CapNotLast) + y1--; +#endif + } +#ifdef POLYSEGMENT + else if (pGC->capStyle != CapNotLast) + y2++; +#endif + /* get to first band that might contain part of line */ + while ((nbox) && (pbox->y2 <= y1)) + { + pbox++; + nbox--; + } + + if (nbox) + { + /* stop when lower edge of box is beyond end of line */ + while((nbox) && (y2 >= pbox->y1)) + { + if ((x1 >= pbox->x1) && (x1 < pbox->x2)) + { + int y1t, y2t; + /* this box has part of the line in it */ + y1t = max(y1, pbox->y1); + y2t = min(y2, pbox->y2); + if (y1t != y2t) + { + xf4bppVertS (addrlBase, nlwidth, + x1, y1t, y2t-y1t); + } + } + nbox--; + pbox++; + } + } +#ifndef POLYSEGMENT + y2 = ppt->y + yorg; +#endif + } + else if (y1 == y2) /* horizontal line */ + { + /* force line from left to right, keeping + endpoint semantics + */ + if (x1 > x2) + { + register int tmp; + + tmp = x2; + x2 = x1 + 1; + x1 = tmp + 1; +#ifdef POLYSEGMENT + if (pGC->capStyle != CapNotLast) + x1--; +#endif + } +#ifdef POLYSEGMENT + else if (pGC->capStyle != CapNotLast) + x2++; +#endif + + /* find the correct band */ + while( (nbox) && (pbox->y2 <= y1)) + { + pbox++; + nbox--; + } + + /* try to draw the line, if we haven't gone beyond it */ + if ((nbox) && (pbox->y1 <= y1)) + { + int tmp; + + /* when we leave this band, we're done */ + tmp = pbox->y1; + while((nbox) && (pbox->y1 == tmp)) + { + int x1t, x2t; + + if (pbox->x2 <= x1) + { + /* skip boxes until one might contain start point */ + nbox--; + pbox++; + continue; + } + + /* stop if left of box is beyond right of line */ + if (pbox->x1 >= x2) + { + nbox = 0; + break; + } + + x1t = max(x1, pbox->x1); + x2t = min(x2, pbox->x2); + if (x1t != x2t) + { + xf4bppHorzS (addrlBase, nlwidth, + x1t, y1, x2t-x1t); + } + nbox--; + pbox++; + } + } +#ifndef POLYSEGMENT + x2 = ppt->x + xorg; +#endif + } + else /* sloped line */ + { + CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy, + 1, 1, octant); + + if (adx > ady) + { + axis = X_AXIS; + e1 = ady << 1; + e2 = e1 - (adx << 1); + e = e1 - adx; + } + else + { + axis = Y_AXIS; + e1 = adx << 1; + e2 = e1 - (ady << 1); + e = e1 - ady; + SetYMajorOctant(octant); + } + + FIXUP_ERROR(e, octant, bias); + + /* we have bresenham parameters and two points. + all we have to do now is clip and draw. + */ + + while(nbox--) + { + oc1 = 0; + oc2 = 0; + OUTCODES(oc1, x1, y1, pbox); + OUTCODES(oc2, x2, y2, pbox); + if ((oc1 | oc2) == 0) + { + if (axis == X_AXIS) + len = adx; + else + len = ady; +#ifdef POLYSEGMENT + if (pGC->capStyle != CapNotLast) + len++; +#endif + xf4bppBresS (addrlBase, nlwidth, + signdx, signdy, axis, x1, y1, + e, e1, e2, 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); +#ifdef POLYSEGMENT + if (clip2 != 0 || pGC->capStyle != CapNotLast) + len++; +#else + len += (clip2 != 0); +#endif + if (len) + { + /* unwind bresenham error term to first point */ + if (clip1) + { + clipdx = abs(new_x1 - x1); + clipdy = abs(new_y1 - y1); + if (axis == X_AXIS) + err = e+((clipdy*e2) + ((clipdx-clipdy)*e1)); + else + err = e+((clipdx*e2) + ((clipdy-clipdx)*e1)); + } + else + err = e; + xf4bppBresS (addrlBase, nlwidth, + signdx, signdy, axis, new_x1, new_y1, + err, e1, e2, len); + } + pbox++; + } + } /* while (nbox--) */ + } /* sloped line */ + } /* while (nline--) */ + +#ifndef POLYSEGMENT + + /* paint the last point if the end style isn't CapNotLast. + (Assume that a projecting, butt, or round cap that is one + pixel wide is the same as the single pixel of the endpoint.) + */ + + if ((pGC->capStyle != CapNotLast) && + ((ppt->x + xorg != pptInit->x + pDrawable->x) || + (ppt->y + yorg != pptInit->y + pDrawable->y) || + (ppt == pptInit + 1))) + { + PixelType _mask; + + if (alu == RROP_BLACK) + _mask = mfbGetrmask(x2 & PIM); + else + _mask = mfbGetmask(x2 & PIM); + + nbox = nboxInit; + pbox = pboxInit; + while (nbox--) + { + if ((x2 >= pbox->x1) && + (y2 >= pbox->y1) && + (x2 < pbox->x2) && + (y2 < pbox->y2)) + { + addrl = mfbScanline(addrlBase, x2, y2, nlwidth); + UPDRW(addrl,_mask); + break; + } + else + pbox++; + } + } +#endif +} + +/* + * Draw dashed 1-pixel lines. + */ + +#ifdef POLYSEGMENT +static void DoV16SegmentSD( + DrawablePtr, GCPtr, int, xSegment* +); + +void +xf4bppSegmentSD (pDrawable, pGC, nseg, pSeg) + DrawablePtr pDrawable; + GCPtr pGC; + int nseg; + register xSegment *pSeg; +{ + if ( ! xf86Screens[pDrawable->pScreen->myNum]->vtSema ) { + miPolySegment(pDrawable, pGC, nseg, pSeg); + } else { + DO_WM3(pGC,DoV16SegmentSD (pDrawable, pGC, nseg, pSeg)); + } +} + +#else +static void DoV16LineSD( + DrawablePtr, GCPtr, int, int, DDXPointPtr +); + +void +xf4bppLineSD (pDrawable, pGC, mode, npt, pptInit) + DrawablePtr pDrawable; + GCPtr pGC; + int mode; /* Origin or Previous */ + int npt; /* number of points */ + DDXPointPtr pptInit; +{ + if ( ! xf86Screens[pDrawable->pScreen->myNum]->vtSema ) { + miZeroDashLine(pDrawable, pGC, mode, npt, pptInit); + } else { + DO_WM3(pGC,DoV16LineSD (pDrawable, pGC, mode, npt, pptInit)); + } +} +#endif + +static void +#ifdef POLYSEGMENT +DoV16SegmentSD (pDrawable, pGC, nseg, pSeg) + DrawablePtr pDrawable; + register GCPtr pGC; + int nseg; + register xSegment *pSeg; +#else +DoV16LineSD( pDrawable, pGC, mode, npt, pptInit) + DrawablePtr pDrawable; + register GCPtr pGC; + int mode; /* Origin or Previous */ + int npt; /* number of points */ + DDXPointPtr pptInit; +#endif +{ + int nboxInit; + register int nbox; + BoxPtr pboxInit; + register BoxPtr pbox; +#ifndef POLYSEGMENT + register DDXPointPtr ppt; /* pointer to list of translated points */ +#endif + + register unsigned int oc1; /* outcode of point 1 */ + register unsigned int oc2; /* outcode of point 2 */ + + PixelType *addrl; /* address of destination pixmap */ + int nlwidth; /* width in longwords of destination pixmap */ + int xorg, yorg; /* origin of window */ + + 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; + unsigned int bias = miGetZeroLineBias(pDrawable->pScreen); + int x1, x2, y1, y2; + RegionPtr cclip; + int fgink, bgink; /* GJA */ + unsigned char *pDash; + int dashOffset; + int numInDashList; + int dashIndex; + int isDoubleDash; + int dashIndexTmp, dashOffsetTmp; + int unclippedlen; + + if (!(pGC->planemask & 0x0F)) + return; + + cclip = pGC->pCompositeClip; + fgink = bgink = pGC->fgPixel; /* GJA */ + pboxInit = REGION_RECTS(cclip); + nboxInit = REGION_NUM_RECTS(cclip); + + nlwidth = BYTES_PER_LINE(pDrawable) >> 2; /* GJA */ + addrl = (PixelType *)VIDBASE(pDrawable); /* GJA */ + + /* compute initial dash values */ + + pDash = (unsigned char *) pGC->dash; + numInDashList = pGC->numInDashList; + isDoubleDash = (pGC->lineStyle == LineDoubleDash); + dashIndex = 0; + dashOffset = 0; + miStepDash ((int)pGC->dashOffset, &dashIndex, pDash, + numInDashList, &dashOffset); + + if (isDoubleDash) + bgink = pGC->bgPixel; /* GJA */ + + xorg = pDrawable->x; + yorg = pDrawable->y; +#ifdef POLYSEGMENT + while (nseg--) +#else + ppt = pptInit; + x2 = ppt->x + xorg; + y2 = ppt->y + yorg; + while(--npt) +#endif + { + nbox = nboxInit; + pbox = pboxInit; + +#ifdef POLYSEGMENT + x1 = pSeg->x1 + xorg; + y1 = pSeg->y1 + yorg; + x2 = pSeg->x2 + xorg; + y2 = pSeg->y2 + yorg; + pSeg++; +#else + x1 = x2; + y1 = y2; + ++ppt; + if (mode == CoordModePrevious) + { + xorg = x1; + yorg = y1; + } + x2 = ppt->x + xorg; + y2 = ppt->y + yorg; +#endif + + CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy, 1, 1, octant); + + if (adx > ady) + { + axis = X_AXIS; + e1 = ady << 1; + e2 = e1 - (adx << 1); + e = e1 - adx; + unclippedlen = adx; + } + else + { + axis = Y_AXIS; + e1 = adx << 1; + e2 = e1 - (ady << 1); + e = e1 - ady; + unclippedlen = ady; + SetYMajorOctant(octant); + } + + FIXUP_ERROR(e, octant, bias); + + /* we have bresenham parameters and two points. + all we have to do now is clip and draw. + */ + + while(nbox--) + { + oc1 = 0; + oc2 = 0; + OUTCODES(oc1, x1, y1, pbox); + OUTCODES(oc2, x2, y2, pbox); + if ((oc1 | oc2) == 0) + { +#ifdef POLYSEGMENT + if (pGC->capStyle != CapNotLast) + unclippedlen++; + dashIndexTmp = dashIndex; + dashOffsetTmp = dashOffset; + xf4bppBresD (pDrawable, fgink, bgink, + &dashIndexTmp, pDash, numInDashList, + &dashOffsetTmp, isDoubleDash, + addrl, nlwidth, + signdx, signdy, axis, x1, y1, + e, e1, e2, unclippedlen); + break; +#else + xf4bppBresD (pDrawable, fgink, bgink, + &dashIndex, pDash, numInDashList, + &dashOffset, isDoubleDash, + addrl, nlwidth, + signdx, signdy, axis, x1, y1, + e, e1, e2, unclippedlen); + goto dontStep; +#endif + } + else if (oc1 & oc2) + { + pbox++; + } + else /* have to clip */ + { + 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; + } + dashIndexTmp = dashIndex; + dashOffsetTmp = dashOffset; + if (clip1) + { + int dlen; + + if (axis == X_AXIS) + dlen = abs(new_x1 - x1); + else + dlen = abs(new_y1 - y1); + miStepDash (dlen, &dashIndexTmp, pDash, + numInDashList, &dashOffsetTmp); + } + if (axis == X_AXIS) + len = abs(new_x2 - new_x1); + else + len = abs(new_y2 - new_y1); +#ifdef POLYSEGMENT + if (clip2 != 0 || pGC->capStyle != CapNotLast) + len++; +#else + len += (clip2 != 0); +#endif + if (len) + { + /* unwind bresenham error term to first point */ + if (clip1) + { + clipdx = abs(new_x1 - x1); + clipdy = abs(new_y1 - y1); + if (axis == X_AXIS) + err = e+((clipdy*e2) + ((clipdx-clipdy)*e1)); + else + err = e+((clipdx*e2) + ((clipdy-clipdx)*e1)); + } + else + err = e; + xf4bppBresD (pDrawable, fgink, bgink, + &dashIndexTmp, pDash, numInDashList, + &dashOffsetTmp, isDoubleDash, + addrl, nlwidth, + signdx, signdy, axis, new_x1, new_y1, + err, e1, e2, len); + } + pbox++; + } + } /* while (nbox--) */ +#ifndef POLYSEGMENT + /* + * walk the dash list around to the next line + */ + miStepDash (unclippedlen, &dashIndex, pDash, + numInDashList, &dashOffset); +dontStep: ; +#endif + } /* while (nline--) */ + +#ifndef POLYSEGMENT + /* paint the last point if the end style isn't CapNotLast. + (Assume that a projecting, butt, or round cap that is one + pixel wide is the same as the single pixel of the endpoint.) + */ + + if ((pGC->capStyle != CapNotLast) && + ((dashIndex & 1) == 0 || isDoubleDash) && + ((ppt->x + xorg != pptInit->x + pDrawable->x) || + (ppt->y + yorg != pptInit->y + pDrawable->y) || + (ppt == pptInit + 1))) + { + nbox = nboxInit; + pbox = pboxInit; + while (nbox--) + { + if ((x2 >= pbox->x1) && + (y2 >= pbox->y1) && + (x2 < pbox->x2) && + (y2 < pbox->y2)) + { + unsigned long _mask; + + _mask = mfbGetmask(x2 & PIM); + addrl = mfbScanline(addrl, x2, y2, nlwidth); + UPDRW(addrl,_mask); + break; + } + else + pbox++; + } + } +#endif +} + + +#if 0 +#ifndef POLYSEGMENT +/* + the clipping code could be cleaned up some; most of its +mess derives from originally being inline in the line code, +then pulled out to make clipping dashes easier. +*/ + +int +mfbClipLine(pbox, box, + ppt1Orig, ppt1, ppt2, + adx, ady, signdx, signdy, axis, + pclip1, pclip2) +BoxPtr pbox; /* box to clip to */ +BoxRec box; /* box to do calculations with */ +DDXPointPtr ppt1Orig, ppt1, ppt2; +int adx, ady; +int signdx, signdy; +register int axis; +int *pclip1, *pclip2; +{ + DDXPointRec pt1Orig, pt1, pt2; + register int swapped = 0; + int clipDone = 0; + register unsigned int utmp; + register int oc1, oc2; + int clip1, clip2; + + pt1Orig = *ppt1Orig; + pt1 = *ppt1; + pt2 = *ppt2; + clip1 = 0; + clip2 = 0; + + do + { + oc1 = 0; + oc2 = 0; + OUTCODES(oc1, pt1.x, pt1.y, pbox); + OUTCODES(oc2, pt2.x, pt2.y, pbox); + + if (oc1 & oc2) + clipDone = -1; + else if ((oc1 | oc2) == 0) + { + clipDone = 1; + if (swapped) + { + SWAPPT(pt1, pt2); + SWAPINT(oc1, oc2); + SWAPINT(clip1, clip2); + } + } + else /* have to clip */ + { + /* only clip one point at a time */ + if (!oc1) + { + SWAPPT(pt1, pt2); + SWAPINT(oc1, oc2); + SWAPINT(clip1, clip2); + swapped = !swapped; + } + + clip1 |= oc1; + if (oc1 & OUT_LEFT) + { + pt1.x = box.x1; + utmp = abs(box.x1 - pt1Orig.x); + utmp *= ady; + if(axis==X_AXIS) + { + pt1.y = pt1Orig.y + SignTimes(signdy, round(utmp, adx)); + } + else + { + utmp <<= 1; + if (swapped) + utmp += ady; + else + utmp -= ady; + pt1.y = pt1Orig.y + SignTimes(signdy, ceiling(utmp, 2*adx)); + if (swapped) + pt1.y -= signdy; + } + } + else if (oc1 & OUT_ABOVE) + { + pt1.y = box.y1; + utmp = abs(box.y1 - pt1Orig.y); + utmp *= adx; + if (axis == Y_AXIS) + { + pt1.x = pt1Orig.x + SignTimes(signdx, round(utmp, ady)); + } + else + { + utmp <<= 1; + if (swapped) + utmp += adx; + else + utmp -= adx; + pt1.x = pt1Orig.x + SignTimes(signdx, ceiling(utmp, 2*ady)); + if (swapped) + pt1.x -= signdx; + } + } + else if (oc1 & OUT_RIGHT) + { + pt1.x = box.x2; + utmp = abs(pt1Orig.x - box.x2); + utmp *= ady; + if (axis == X_AXIS) + { + pt1.y = pt1Orig.y + SignTimes(signdy, round(utmp, adx)); + } + else + { + utmp <<= 1; + if (swapped) + utmp += ady; + else + utmp -= ady; + pt1.y = pt1Orig.y + SignTimes(signdy, ceiling(utmp, 2*adx)); + if (swapped) + pt1.y -= signdy; + } + } + else if (oc1 & OUT_BELOW) + { + pt1.y = box.y2; + utmp = abs(pt1Orig.y - box.y2); + utmp *= adx; + if (axis == Y_AXIS) + { + pt1.x = pt1Orig.x + SignTimes(signdx, round(utmp, ady)); + } + else + { + utmp <<= 1; + if (swapped) + utmp += adx; + else + utmp -= adx; + pt1.x = pt1Orig.x + SignTimes(signdx, ceiling(utmp, 2*ady)); + if (swapped) + pt1.x -= signdx; + } + } + } /* else have to clip */ + } while(!clipDone); + *ppt1 = pt1; + *ppt2 = pt2; + *pclip1 = clip1; + *pclip2 = clip2; + + return clipDone; +} +#endif +#endif diff --git a/xorg-server/hw/xfree86/xf4bpp/mfbseg.c b/xorg-server/hw/xfree86/xf4bpp/mfbseg.c new file mode 100644 index 000000000..3af37d817 --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/mfbseg.c @@ -0,0 +1,2 @@ +#define POLYSEGMENT +#include "./mfbline.c" diff --git a/xorg-server/hw/xfree86/xf4bpp/mfbzerarc.c b/xorg-server/hw/xfree86/xf4bpp/mfbzerarc.c new file mode 100644 index 000000000..61fc7b184 --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/mfbzerarc.c @@ -0,0 +1,267 @@ +/************************************************************ + +Copyright (c) 1989 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 +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the 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. + +********************************************************/ +/* GJA -- Took mfb code and modified it. */ + +/* Derived from: + * "Algorithm for drawing ellipses or hyperbolae with a digital plotter" + * by M. L. V. Pitteway + * The Computer Journal, November 1967, Volume 10, Number 3, pp. 282-289 + */ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include "xf4bpp.h" +#include "OScompiler.h" +#include "mfbmap.h" +#include "mfb.h" +#include "maskbits.h" +#include "mi.h" +#include "mizerarc.h" +#include "wm3.h" + +#include "xf86str.h" /* for pScrn->vtSema */ +extern ScrnInfoPtr *xf86Screens; + +/* + * Note, LEFTMOST must be the bit leftmost in the actual screen + * representation. This depends on both BITMAP_BIT_ORDER and + * IMAGE_BYTE_ORDER + * DHD 10/92 + */ + +#if (BITMAP_BIT_ORDER == MSBFirst) +#if (IMAGE_BYTE_ORDER == MSBFirst) +#define LEFTMOST ((unsigned int) 0x80000000) +#else +#define LEFTMOST ((unsigned int) 0x80) +#endif +#else +#if (IMAGE_BYTE_ORDER == LSBFirst) +#define LEFTMOST ((unsigned int) 1) +#else +#define LEFTMOST ((unsigned int) 0x1000000) +#endif +#endif + +#define PixelateWhite(addr,off) \ +{ \ + register int *tmpaddr = &((addr)[(off)>>PWSH]); \ + UPDRW(tmpaddr,SCRRIGHT (LEFTMOST, ((off) & PIM))); \ +} +#define PixelateBlack(addr,off) \ +{ \ + register int *tmpaddr = &((addr)[(off)>>PWSH]); \ + UPDRW(tmpaddr,~(SCRRIGHT (LEFTMOST, ((off) & PIM)))); \ +} + +#define Pixelate(base,off) \ +{ \ + paddr = base + ((off)>>PWSH); \ + pmask = SCRRIGHT(LEFTMOST, (off) & PIM); \ + UPDRW(paddr,(pixel & pmask)); \ +} + +#define DoPix(bit,base,off) if (msk & bit) Pixelate(base,off); + +static void +v16ZeroArcSS +( + DrawablePtr pDraw, + GCPtr pGC, + xArc *arc +) +{ + miZeroArcRec info; + Bool do360; + register int x, y, a, b, d, msk; + register int k1, k3, dx, dy; + int *addrl; + int *yorgl, *yorgol; + unsigned long pixel; + int nlwidth, yoffset, dyoffset; + int pmask; + register int *paddr; + + if (((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + mfbGetGCPrivateKey()))->rop == + RROP_BLACK) + pixel = 0; + else + pixel = ~0UL; + + if (pDraw->type == DRAWABLE_WINDOW) + { + addrl = (int *) + (((PixmapPtr)(pDraw->pScreen->devPrivate))->devPrivate.ptr); + nlwidth = (int) + (((PixmapPtr)(pDraw->pScreen->devPrivate))->devKind) >> 2; + } + else + { + addrl = (int *)(((PixmapPtr)pDraw)->devPrivate.ptr); + nlwidth = (int)(((PixmapPtr)pDraw)->devKind) >> 2; + } + + do360 = miZeroArcSetup(arc, &info, TRUE); + yorgl = addrl + ((info.yorg + pDraw->y) * nlwidth); + yorgol = addrl + ((info.yorgo + pDraw->y) * nlwidth); + info.xorg += pDraw->x; + info.xorgo += pDraw->x; + MIARCSETUP(); + yoffset = y ? nlwidth : 0; + dyoffset = 0; + msk = info.initialMask; + if (!(arc->width & 1)) + { + DoPix(2, yorgl, info.xorgo); + DoPix(8, yorgol, info.xorgo); + } + if (!info.end.x || !info.end.y) + { + msk = info.end.mask; + info.end = info.altend; + } + if (do360 && (arc->width == arc->height) && !(arc->width & 1)) + { + int xoffset = nlwidth; + int *yorghl = yorgl + (info.h * nlwidth); + int xorghp = info.xorg + info.h; + int xorghn = info.xorg - info.h; + + while (1) + { + PixelateWhite(yorgl + yoffset, info.xorg + x); + PixelateWhite(yorgl + yoffset, info.xorg - x); + PixelateWhite(yorgol- yoffset, info.xorg - x); + PixelateWhite(yorgol - yoffset, info.xorg + x); + if (a < 0) + break; + PixelateWhite(yorghl - xoffset, xorghp - y); + PixelateWhite(yorghl - xoffset, xorghn + y); + PixelateWhite(yorghl + xoffset, xorghn + y); + PixelateWhite(yorghl + xoffset, xorghp - y); + xoffset += nlwidth; + MIARCCIRCLESTEP(yoffset += nlwidth;); + } + x = info.w; + yoffset = info.h * nlwidth; + } + else if (do360) + { + while (y < info.h || x < info.w) + { + MIARCOCTANTSHIFT(dyoffset = nlwidth;); + Pixelate(yorgl + yoffset, info.xorg + x); + Pixelate(yorgl + yoffset, info.xorgo - x); + Pixelate(yorgol - yoffset, info.xorgo - x); + Pixelate(yorgol - yoffset, info.xorg + x); + MIARCSTEP(yoffset += dyoffset;, yoffset += nlwidth;); + } + } + else + { + while (y < info.h || x < info.w) + { + MIARCOCTANTSHIFT(dyoffset = nlwidth;); + if ((x == info.start.x) || (y == info.start.y)) + { + msk = info.start.mask; + info.start = info.altstart; + } + DoPix(1, yorgl + yoffset, info.xorg + x); + DoPix(2, yorgl + yoffset, info.xorgo - x); + DoPix(4, yorgol - yoffset, info.xorgo - x); + DoPix(8, yorgol - yoffset, info.xorg + x); + if ((x == info.end.x) || (y == info.end.y)) + { + msk = info.end.mask; + info.end = info.altend; + } + MIARCSTEP(yoffset += dyoffset;, yoffset += nlwidth;); + } + } + if ((x == info.start.x) || (y == info.start.y)) + msk = info.start.mask; + DoPix(1, yorgl + yoffset, info.xorg + x); + DoPix(4, yorgol - yoffset, info.xorgo - x); + if (arc->height & 1) + { + DoPix(2, yorgl + yoffset, info.xorgo - x); + DoPix(8, yorgol - yoffset, info.xorg + x); + } +} + +static void +xf4bppZeroPolyArcSS +( + DrawablePtr pDraw, + GCPtr pGC, + int narcs, + xArc *parcs +) +{ + register xArc *arc; + register int i; + BoxRec box; + RegionPtr cclip; + + if (!pGC->planemask & 0x0F) + return; + cclip = pGC->pCompositeClip; + for (arc = parcs, i = narcs; --i >= 0; arc++) + { + if (miCanZeroArc(arc)) + { + box.x1 = arc->x + pDraw->x; + box.y1 = arc->y + pDraw->y; + box.x2 = box.x1 + (int)arc->width + 1; + box.y2 = box.y1 + (int)arc->height + 1; + if (RECT_IN_REGION(pDraw->pScreen, cclip, &box) == rgnIN) + v16ZeroArcSS(pDraw, pGC, arc); + else + miZeroPolyArc(pDraw, pGC, 1, arc); + } + else + miPolyArc(pDraw, pGC, 1, arc); + } +} + +void +xf4bppZeroPolyArc(pDraw, pGC, narcs, parcs) + DrawablePtr pDraw; + GCPtr pGC; + int narcs; + xArc *parcs; +{ + if ( !xf86Screens[pDraw->pScreen->myNum]->vtSema ) { + miZeroPolyArc(pDraw, pGC, narcs, parcs); + } else { + DO_WM3(pGC,xf4bppZeroPolyArcSS(pDraw, pGC, narcs, parcs)); + } +} diff --git a/xorg-server/hw/xfree86/xf4bpp/offscreen.c b/xorg-server/hw/xfree86/xf4bpp/offscreen.c new file mode 100644 index 000000000..3160e7ef8 --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/offscreen.c @@ -0,0 +1,342 @@ +/* + * Copyright 1993 Gerrit Jan Akkerman + * + * 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 Gerrit Jan Akkerman not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * GERRIT JAN AKKERMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, + * IN NO EVENT SHALL GERRIT JAN AKKERMAN BE LIABLE FOR ANY SPECIAL, INDIRECT + * OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF + * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * +*/ +/* + * Copyright IBM Corporation 1987,1988,1989 + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * +*/ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include "xf4bpp.h" +#include "vgaVideo.h" +#include "pixmapstr.h" +#include "scrnintstr.h" +#include "windowstr.h" + +#define saved_screen(pWin) \ + ((unsigned char *)(((PixmapPtr)((pWin)->drawable.pScreen->devPrivate))->devPrivate.ptr)) + +#define SAVEDSCREEN(pWin, x, y) \ + (*(saved_screen(pWin) + (y) * (BYTES_PER_LINE(pWin)) + (x))) + +#define DO_ROP(src,dst,alu,planes) \ + ((dst) = do_rop((src),(dst),(alu),(planes))) + +/* NOTE: + * The following to functions don't do anything. They're just there to + * provide a stable interface to the rest of the system. + */ + +static int +do_rop +( + int src, + int dst, + int alu, + const unsigned long planes +) +{ + int _dst; /* New dst */ + + switch ( alu ) { + case GXclear: /* 0x0 Zero 0 */ + _dst = 0; break ; + case GXinvert: /* 0xa NOT dst */ + _dst = ~dst; break ; + case GXset: /* 0xf 1 */ + _dst = src; break ; + default: + case GXnoop: /* 0x5 dst */ + return dst; + case GXnor: /* 0x8 NOT src AND NOT dst */ + _dst = ~src & ~dst; break ; + case GXandInverted: /* 0x4 NOT src AND dst */ + _dst = ~src & dst; break ; + case GXand: /* 0x1 src AND dst */ + _dst = src & dst; break ; + case GXequiv: /* 0x9 NOT src XOR dst */ + _dst = ~src ^ dst; break ; + case GXxor: /* 0x6 src XOR dst */ + _dst = src ^ dst; break ; + case GXandReverse: /* 0x2 src AND NOT dst */ + _dst = src & ~dst; break ; + case GXnand: /* 0xe NOT src OR NOT dst */ + _dst = ~src | ~dst; break ; + case GXorReverse: /* 0xb src OR NOT dst */ + _dst = src | ~dst; break ; + case GXorInverted: /* 0xd NOT src OR dst */ + _dst = ~src | dst; break ; + case GXor: /* 0x7 src OR dst */ + _dst = src | dst; break ; + case GXcopyInverted: /* 0xc NOT src */ + _dst = ~src; break ; + case GXcopy: /* 0x3 src */ + _dst = src; break ; + } + return (dst & ~planes) | (_dst & planes); +} + +/* File vgaBitBlt.c */ +void +xf4bppOffBitBlt( pWin, alu, writeplanes, x0, y0, x1, y1, w, h ) +WindowPtr pWin; /* GJA */ +const int alu, writeplanes ; +register int x0 ; +int y0 ; +register int x1 ; +int y1 ; +register int w, h ; +{ + int x,y; + + switch ( alu ) { + case GXclear: /* 0x0 Zero 0 */ + case GXinvert: /* 0xa NOT dst */ + case GXset: /* 0xf 1 */ + xf4bppOffFillSolid( pWin, VGA_ALLPLANES, alu, writeplanes, + x0, y0, w, h ) ; + case GXnoop: /* 0x5 dst */ + return ; + default: + break ; + } + + if ( (w <= 0) || (h <= 0) ) return; + + for ( y = 0 ; y < h ; y++ ) { + for ( x = 0 ; x < w ; x++ ) { + DO_ROP(SAVEDSCREEN(pWin,x0+x,y0+y),SAVEDSCREEN(pWin,x1+x,y1+y), + alu,writeplanes); + } + } +} + +/* for file vgaImages.c */ + +void +xf4bppOffDrawColorImage( pWin, x, y, w, h, data, RowIncrement, alu, planes ) +WindowPtr pWin; /* GJA */ +int x, y ; +register int w, h ; +unsigned char *data ; +register int RowIncrement ; +const int alu ; +const unsigned long int planes ; +{ + int dx,dy; + + for ( dy = 0 ; dy < h ; dy++ ) { + for ( dx = 0 ; dx < w ; dx++ ) { + DO_ROP( data[dy * RowIncrement + dx], + SAVEDSCREEN(pWin,x+dx,y+dy), alu, planes); + } + } +} + +void +xf4bppOffReadColorImage( pWin, x, y, lx, ly, data, RowIncrement ) +WindowPtr pWin; /* GJA */ +int x, y ; +int lx, ly ; +unsigned char *data ; +int RowIncrement ; +{ + int dx, dy; + + if ( ( lx <= 0 ) || ( ly <= 0 ) ) + return ; + + for ( dy = 0 ; dy < ly ; dy++ ) { + for ( dx = 0 ; dx < lx ; dx++ ) { + data[dy*RowIncrement+dx] = SAVEDSCREEN(pWin,x+dx,y+dy); + } + } +} + +/* For file vgaSolid.c */ + +void xf4bppOffFillSolid( pWin, color, alu, planes, x0, y0, lx, ly ) +WindowPtr pWin; /* GJA */ +unsigned long int color ; +const int alu ; +unsigned long int planes ; +register int x0 ; +register const int y0 ; +register int lx ; +register const int ly ; /* MUST BE > 0 !! */ +{ + int dx, dy; + + if ( ( lx == 0 ) || ( ly == 0 ) ) + return; + + for ( dy = 0 ; dy < ly ; dy++ ) { + for ( dx = 0 ; dx < lx ; dx++ ) { + DO_ROP(color,SAVEDSCREEN(pWin, x0+dx,y0+dy),alu,planes); + } + } +} + +/* For file vgaStipple.c */ + +/* GJA -- modified this to take both Width and Height, and to + * reduce x and y to Width and Height by taking remainders. + */ +static unsigned char +xygetbits +( + register int x, + register int y, + register const unsigned int Width, + register const unsigned int paddedByteWidth, + register const unsigned int Height, + register const unsigned char * const data +) +{ + register unsigned char bits ; + unsigned const char *lineptr, *cptr ; + register int shift ; + register int wrap ; + + x = x % Width; + y = y % Height; + + lineptr = data + (y * paddedByteWidth); + cptr = lineptr + (x >> 3) ; + bits = *cptr ; + if ((shift = x & 7)) + bits = SCRLEFT8( bits, shift ) | + SCRRIGHT8( cptr[1], ( 8 - shift ) ) ; + if ( ( wrap = x + 8 - Width ) > 0 ) { + bits &= SCRLEFT8( 0xFF, wrap ) ; + bits |= SCRRIGHT8( *lineptr, ( 8 - wrap ) ) ; + } + + return bits ; +} + +static void +DoMono +( + WindowPtr pWin, /* GJA */ + int w, + int x, + int y, + register const unsigned char *mastersrc, + int h, + unsigned int width, + register unsigned int paddedByteWidth, + unsigned int height, + int xshift, + int yshift, + int alu, + int planes, + int fg +) +{ + int dy, dx, i; + int byte; + + for ( dy = 0 ; dy < h ; dy++ ) { + for ( dx = 0; dx <= w - 8 ; dx += 8 ) { + /* get next byte */ + byte = xygetbits(dx+xshift,dy+yshift,width, + paddedByteWidth, height, mastersrc); + for ( i = 0 ; i < 8 ; i++ ) { + if ( byte & (128 >> i) ) { + DO_ROP(fg,SAVEDSCREEN(pWin,x+dx+i,y+dy), + alu,planes); + } + } + } + /* get last bits */ + byte = xygetbits(dx+xshift,dy+yshift,width, + paddedByteWidth, height, mastersrc); + for ( i = 0 ; i < (w - dx) ; i++ ) { + if ( byte & (128 >> i) ) { + DO_ROP(fg,SAVEDSCREEN(pWin,x+dx+i,y+dy), + alu,planes); + } + } + } +} + +void +xf4bppOffFillStipple( pWin, pStipple, fg, alu, planes, x, y, w, h, xSrc, ySrc ) +WindowPtr pWin; /* GJA */ +register PixmapPtr const pStipple ; +unsigned long int fg ; +const int alu ; +unsigned long int planes ; +int x, y, w, h ; +const int xSrc, ySrc ; +{ + unsigned int width ; + unsigned int height ; + int xshift ; + int yshift ; + + if ( ( alu == GXnoop ) || !( planes &= VGA_ALLPLANES ) ) + return ; + + /* Figure Bit Offsets & Source Address */ + width = pStipple->drawable.width ; + if ( ( xshift = ( x - xSrc ) ) < 0 ) + xshift = width - ( ( - xshift ) % width ) ; + else + xshift %= width ; + + height = pStipple->drawable.height ; + if ( ( yshift = ( y - ySrc ) ) < 0 ) + yshift = height - ( ( - yshift ) % height ) ; + else + yshift %= height ; + + DoMono( pWin, w, x, y, + (const unsigned char *) pStipple->devPrivate.ptr, + h, + width, + ( ( width + 31 ) & (unsigned)(~31) ) >> 3, + height, + xshift, yshift, + alu, (int)planes, (int)fg ) ; + return ; +} diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcArea.c b/xorg-server/hw/xfree86/xf4bpp/ppcArea.c new file mode 100644 index 000000000..df7856a35 --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/ppcArea.c @@ -0,0 +1,97 @@ +/* + * Copyright IBM Corporation 1987,1988,1989 + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * +*/ + +/* + * ppc solid area fill + * + * Tom Paquin 8/87 + */ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include "xf4bpp.h" +#include "mfbmap.h" +#include "mfb.h" +#include "ppcGCstr.h" +#include "ibmTrace.h" + +void +xf4bppFillArea( pWin, nboxes, pBox, pGC ) + register WindowPtr pWin ; + register int nboxes ; + register BoxPtr pBox ; + GCPtr pGC ; +{ +register int x, y, w, h ; +int alu ; +unsigned long int fg, bg, pm ; +int xSrc, ySrc ; +PixmapPtr pPixmap ; +ppcPrivGC *pPrivGC = dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()); + +TRACE( ( "xf4bppFillArea(0x%x,%d,0x%x,0x%x)\n", pWin, nboxes, pBox, pGC ) ) ; + +if ( ( alu = pPrivGC->colorRrop.alu ) == GXnoop || !nboxes ) + return ; + +xSrc = pGC->patOrg.x + pWin->drawable.x ; +ySrc = pGC->patOrg.y + pWin->drawable.y ; + +pm = pPrivGC->colorRrop.planemask ; +fg = pPrivGC->colorRrop.fgPixel ; +bg = pPrivGC->colorRrop.bgPixel ; + +nboxes++ ; +switch ( pPrivGC->colorRrop.fillStyle ) { + case FillTiled: + for ( pPixmap = pGC->tile.pixmap ; --nboxes ; pBox++ ) + if ( ( w = pBox->x2 - ( x = pBox->x1 ) ) + && ( h = pBox->y2 - ( y = pBox->y1 ) ) ) + xf4bppTileRect( pWin, pPixmap, alu, pm, + x, y, w, h, xSrc, ySrc ) ; + break ; + case FillOpaqueStippled: + for ( pPixmap = pGC->stipple ; --nboxes ; pBox++ ) + if ( ( w = pBox->x2 - ( x = pBox->x1 ) ) + && ( h = pBox->y2 - ( y = pBox->y1 ) ) ) + xf4bppOpaqueStipple( pWin, pPixmap, fg, bg, alu, pm, + x, y, w, h, xSrc, ySrc ) ; + break ; + case FillStippled: + for ( pPixmap = pGC->stipple ; --nboxes ; pBox++ ) + if ( ( w = pBox->x2 - ( x = pBox->x1 ) ) + && ( h = pBox->y2 - ( y = pBox->y1 ) ) ) + xf4bppFillStipple( pWin, pPixmap, fg, alu, pm, + x, y, w, h, xSrc, ySrc ) ; + break ; + case FillSolid: + for ( ; --nboxes ; pBox++ ) + if ( ( w = pBox->x2 - ( x = pBox->x1 ) ) + && ( h = pBox->y2 - ( y = pBox->y1 ) ) ) + xf4bppFillSolid( pWin, fg, alu, pm, x, y, w, h ) ; + break ; +} + +} diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcCReduce.c b/xorg-server/hw/xfree86/xf4bpp/ppcCReduce.c new file mode 100644 index 000000000..c567e6fd1 --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/ppcCReduce.c @@ -0,0 +1,237 @@ +/* + * Copyright IBM Corporation 1987,1988,1989 + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * +*/ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include "xf4bpp.h" +#include "ppcGCstr.h" + +/* xf4bppGetReducedColorRrop( pGC, drawableDepth, returnLoc ) + * An attempt to do "strength reduction" on color raster-ops + * P. Shupak 1/88 + */ + +static void +ppcReduceGeneral +( + register int alu, + register unsigned long pm, + register unsigned long fg, + register unsigned long bg, + register int fillStyle, + int drawableDepth, + ppcReducedRrop *returnLoc +) +{ + +if ( ( alu == GXnoop ) + || !( pm &= ( ( 1 << drawableDepth ) - 1 ) ) ) { + returnLoc->alu = GXnoop ; + return ; +} + +#ifdef DELETE_THIS +switch ( fillStyle ) { + case FillTiled: + switch ( alu ) { + case GXclear: /* 0x0 Zero 0 */ + case GXinvert: /* 0xa NOT dst */ + case GXset: /* 0xf 1 */ + fillStyle = FillSolid ; + default: /* We Can't Do Much Here */ + break ; + } + break ; + case FillOpaqueStippled: + if ( ( fg & pm ) != ( bg & pm ) ) { /* else FillSolid */ + switch ( alu ) { + case GXclear: /* 0x0 Zero 0 */ + case GXset: /* 0xf 1 */ + case GXinvert: /* 0xa NOT dst */ + fillStyle = FillSolid ; + break ; + case GXnor: /* 0x8 NOT src AND NOT dst */ + case GXnand: /* 0xe NOT src OR NOT dst */ + case GXcopy: /* 0x3 src */ + break ; + case GXandReverse: /* 0x2 src AND NOT dst */ + fg = ~fg ; + bg = ~bg ; + alu = GXnor ; + break ; + case GXandInverted: /* 0x4 NOT src AND dst */ + fg = ~fg ; + bg = ~bg ; + alu = GXand ; /* Fall Through */ + case GXand: /* 0x1 src AND dst */ + pm &= ~( fg & bg ) ; + if ( ( bg & pm ) == pm ) { + fillStyle = FillStippled ; + alu = GXclear ; + } + break ; + case GXequiv: /* 0x9 NOT src XOR dst */ + fg = ~fg ; + bg = ~bg ; + alu = GXxor ; /* Fall Through */ + case GXxor: /* 0x6 src XOR dst */ + pm &= ( fg | bg ) ; + if ( !( bg & pm ) ) { + fillStyle = FillStippled ; + alu = GXinvert ; + } + break ; + case GXorReverse: /* 0xb src OR NOT dst */ + fg = ~fg ; + bg = ~bg ; + alu = GXnand ; + break ; + case GXcopyInverted: /* 0xc NOT src */ + fg = ~fg ; + bg = ~bg ; + alu = GXcopy ; + break ; + case GXorInverted: /* 0xd NOT src OR dst */ + fg = ~fg ; + bg = ~bg ; + alu = GXor ; /* Fall Through */ + case GXor: /* 0x7 src OR dst */ + pm &= ( fg | bg ) ; + if ( !( bg & pm ) ) { + fillStyle = FillStippled ; + alu = GXset ; + } + break ; + default: + ErrorF( + "xf4bppGetReducedColorRrop: Unknown Alu Raster-Op" ) ; + break ; + } + break ; /* Don't Fall Through */ + } + else + fillStyle = FillSolid ; + /* Fall Through */ + case FillStippled: + case FillSolid: + switch ( alu ) { + case GXclear: /* 0x0 Zero 0 */ + case GXset: /* 0xf 1 */ + case GXinvert: /* 0xa NOT dst */ + break ; + case GXand: /* 0x1 src AND dst */ + pm &= ~fg ; + alu = GXclear ; + break ; + case GXandReverse: /* 0x2 src AND NOT dst */ + fg = ~fg ; + alu = GXnor ; /* Fall Through */ + case GXnor: /* 0x8 NOT src AND NOT dst */ + if ( !( fg & pm ) ) + alu = GXclear ; + else if ( ( fg & pm ) == pm ) + alu = GXinvert ; + break ; + case GXandInverted: /* 0x4 NOT src AND dst */ + pm &= fg ; + alu = GXclear ; + break ; + case GXxor: /* 0x6 src XOR dst */ + pm &= fg ; + alu = GXinvert ; + break ; + case GXor: /* 0x7 src OR dst */ + pm &= fg ; + alu = GXset ; + break ; + case GXequiv: /* 0x9 NOT src XOR dst */ + pm &= ~fg ; + alu = GXinvert ; + break ; + case GXorReverse: /* 0xb src OR NOT dst */ + fg = ~fg ; + alu = GXnand ; /* Fall Through */ + case GXnand: /* 0xe NOT src OR NOT dst */ + if ( !( fg & pm ) ) + alu = GXset ; + else if ( ( fg & pm ) == pm ) + alu = GXinvert ; + break ; + case GXcopyInverted: /* 0xc NOT src */ + fg = ~fg ; + alu = GXcopy ; /* Fall Through */ + case GXcopy: /* 0x3 src */ + if ( !( fg & pm ) ) + alu = GXclear ; + else if ( ( fg & pm ) == pm ) + alu = GXset ; + break ; + case GXorInverted: /* 0xd NOT src OR dst */ + pm &= ~fg ; + alu = GXset ; + break ; + default: + ErrorF( + "xf4bppGetReducedColorRrop: Unknown Alu Raster-Op" ) ; + break ; + } + break; + default: + ErrorF("xf4bppGetReducedColorRrop: Bad Fillstyle\n"); + break; +} +#endif + +/* Final Test On Restricted Plane Mask */ +if ( !pm ) + alu = GXnoop ; + +/* Set Actual Returned Values */ +returnLoc->planemask = pm ; +returnLoc->fgPixel = fg ; +returnLoc->bgPixel = bg ; +returnLoc->alu = alu ; +returnLoc->fillStyle = fillStyle ; + +return ; +} + +void +xf4bppGetReducedColorRrop( pGC, drawableDepth, returnLoc ) +GC *pGC ; +int drawableDepth ; +ppcReducedRrop *returnLoc ; +{ + +ppcReduceGeneral( pGC->alu, + pGC->planemask, + pGC->fgPixel, + pGC->bgPixel, + pGC->fillStyle, + drawableDepth, + returnLoc ) ; + +return ; +} diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcClip.c b/xorg-server/hw/xfree86/xf4bpp/ppcClip.c new file mode 100644 index 000000000..899dba683 --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/ppcClip.c @@ -0,0 +1,157 @@ +/* + +Copyright (c) 1987 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 furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the 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. + + +Copyright IBM Corporation 1987,1988,1989 +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of IBM not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +*/ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include <stdlib.h> + +#include "xf4bpp.h" +#include "mfbmap.h" +#include "mfb.h" +#include "scrnintstr.h" + +void +xf4bppDestroyClip(pGC) + GCPtr pGC; +{ + if(pGC->clientClipType == CT_NONE) + return; + else if (pGC->clientClipType == CT_PIXMAP) + { + mfbDestroyPixmap((PixmapPtr)(pGC->clientClip)); + } + else + { + /* we know we'll never have a list of rectangles, since + ChangeClip immediately turns them into a region + */ + REGION_DESTROY(pGC->pScreen, pGC->clientClip); + } + pGC->clientClip = NULL; + pGC->clientClipType = CT_NONE; +} + +void +xf4bppChangeClip(pGC, type, pvalue, nrects) + GCPtr pGC; + int type; + pointer pvalue; + int nrects; +{ + xf4bppDestroyClip(pGC); + if(type == CT_PIXMAP) + { + /* convert the pixmap to a region */ + pGC->clientClip = (pointer) (*pGC->pScreen->BitmapToRegion)((PixmapPtr)pvalue); + /* you wouldn't do this if you were leaving the pixmap in + rather than converting it. + */ + (*pGC->pScreen->DestroyPixmap)(pvalue); + } + else if (type == CT_REGION) + { + /* stuff the region in the GC */ + pGC->clientClip = pvalue; + } + else if (type != CT_NONE) + { + pGC->clientClip = (pointer) RECTS_TO_REGION(pGC->pScreen, nrects, + (xRectangle *)pvalue, + type); + xfree(pvalue); + } + pGC->clientClipType = (type != CT_NONE && pGC->clientClip) ? CT_REGION : + CT_NONE; + pGC->stateChanges |= GCClipMask; +} + +void +xf4bppCopyClip (pgcDst, pgcSrc) + GCPtr pgcDst, pgcSrc; +{ + RegionPtr prgnNew; + + switch(pgcSrc->clientClipType) + { + case CT_PIXMAP: + ((PixmapPtr) pgcSrc->clientClip)->refcnt++; + /* Fall through !! */ + case CT_NONE: + xf4bppChangeClip(pgcDst, pgcSrc->clientClipType, pgcSrc->clientClip, 0); + break; + case CT_REGION: + prgnNew = REGION_CREATE(pgcSrc->pScreen, NULL, 1); + REGION_COPY(pgcSrc->pScreen, prgnNew, (RegionPtr)(pgcSrc->clientClip)); + xf4bppChangeClip(pgcDst, CT_REGION, (pointer)prgnNew, 0); + break; + } +} diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcCpArea.c b/xorg-server/hw/xfree86/xf4bpp/ppcCpArea.c new file mode 100644 index 000000000..9bdaf89e3 --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/ppcCpArea.c @@ -0,0 +1,470 @@ +/* + * Copyright IBM Corporation 1987,1988,1989 + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * +*/ + +/*********************************************************** +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include <stdlib.h> + +#include "xf4bpp.h" +#include "mfbmap.h" +#define PSZ 8 +#include "mfb.h" +#include "mergerop.h" +#include "mi.h" +#include "pixmapstr.h" +#include "scrnintstr.h" + +/* + * Graft in the DoBitblt from cfb. It does everything correctly. + */ +static void +vga16DoBitblt +( + DrawablePtr pSrc, + DrawablePtr pDst, + int alu, + RegionPtr prgnDst, + DDXPointPtr pptSrc, + unsigned long planemask +) +{ + int widthSrc, widthDst; /* add to get to same position in next line */ + BoxPtr pbox; + int nbox; + BoxPtr pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2; + /* temporaries for shuffling rectangles */ + DDXPointPtr pptTmp, pptNew1, pptNew2; + /* shuffling boxes entails shuffling the + source points too */ + int w, h; + int careful; + + widthSrc = mfbGetPixelWidth(pSrc); + widthDst = mfbGetPixelWidth(pDst); + + /* XXX we have to err on the side of safety when both are windows, + * because we don't know if IncludeInferiors is being used. + */ + careful = ((pSrc == pDst) || + ((pSrc->type == DRAWABLE_WINDOW) && + (pDst->type == DRAWABLE_WINDOW))); + + pbox = REGION_RECTS(prgnDst); + nbox = REGION_NUM_RECTS(prgnDst); + + pboxNew1 = NULL; + pptNew1 = NULL; + pboxNew2 = NULL; + pptNew2 = NULL; + if (careful && (pptSrc->y < pbox->y1)) + { + /* walk source botttom to top */ + widthSrc = -widthSrc; + widthDst = -widthDst; + + if (nbox > 1) + { + /* keep ordering in each band, reverse order of bands */ + pboxNew1 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox); + if(!pboxNew1) + return; + pptNew1 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox); + if(!pptNew1) + { + xfree(pboxNew1); + return; + } + pboxBase = pboxNext = pbox+nbox-1; + while (pboxBase >= pbox) + { + while ((pboxNext >= pbox) && + (pboxBase->y1 == pboxNext->y1)) + pboxNext--; + pboxTmp = pboxNext+1; + pptTmp = pptSrc + (pboxTmp - pbox); + while (pboxTmp <= pboxBase) + { + *pboxNew1++ = *pboxTmp++; + *pptNew1++ = *pptTmp++; + } + pboxBase = pboxNext; + } + pboxNew1 -= nbox; + pbox = pboxNew1; + pptNew1 -= nbox; + pptSrc = pptNew1; + } + } + + if (careful && (pptSrc->x < pbox->x1)) + { + if (nbox > 1) + { + /* reverse order of rects in each band */ + pboxNew2 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox); + pptNew2 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox); + if(!pboxNew2 || !pptNew2) + { + if (pptNew2) xfree(pptNew2); + if (pboxNew2) xfree(pboxNew2); + if (pboxNew1) + { + xfree(pptNew1); + xfree(pboxNew1); + } + return; + } + pboxBase = pboxNext = pbox; + while (pboxBase < pbox+nbox) + { + while ((pboxNext < pbox+nbox) && + (pboxNext->y1 == pboxBase->y1)) + pboxNext++; + pboxTmp = pboxNext; + pptTmp = pptSrc + (pboxTmp - pbox); + while (pboxTmp != pboxBase) + { + *pboxNew2++ = *--pboxTmp; + *pptNew2++ = *--pptTmp; + } + pboxBase = pboxNext; + } + pboxNew2 -= nbox; + pbox = pboxNew2; + pptNew2 -= nbox; + pptSrc = pptNew2; + } + } + + while(nbox--) + { + w = pbox->x2 - pbox->x1; + h = pbox->y2 - pbox->y1; + + if( pSrc->type == DRAWABLE_WINDOW ) + xf4bppBitBlt( (WindowPtr)pDst, alu, planemask, + pptSrc->x, /* x0 */ + pptSrc->y, /* y0 */ + pbox->x1, /* x1 */ + pbox->y1, /* y1 */ + w, h ); /* w, h */ + else /* DRAWABLE_PIXMAP */ + xf4bppDrawColorImage( (WindowPtr)pDst, + pbox->x1, pbox->y1, + w, + h, + ((unsigned char *)((PixmapPtr)pSrc)->devPrivate.ptr + + pptSrc->x + (pptSrc->y*((PixmapPtr)pSrc)->devKind)), + ((PixmapPtr)pSrc)->devKind, + alu, planemask ) ; + pbox++; + pptSrc++; + } + if (pboxNew2) + { + xfree(pptNew2); + xfree(pboxNew2); + } + if (pboxNew1) + { + xfree(pptNew1); + xfree(pboxNew1); + } +} + + +/* + * Graft in the CopyArea from mfb/cfb. It does everything correctly. + */ + +RegionPtr +xf4bppCopyArea(pSrcDrawable, pDstDrawable, + pGC, srcx, srcy, width, height, dstx, dsty) +register DrawablePtr pSrcDrawable; +register DrawablePtr pDstDrawable; +register GC *pGC; +int srcx, srcy; +int width, height; +int dstx, dsty; +{ + RegionPtr prgnSrcClip = NULL; /* may be a new region, or just a copy */ + Bool freeSrcClip = FALSE; + + RegionPtr prgnExposed; + RegionRec rgnDst; + DDXPointPtr pptSrc; + register DDXPointPtr ppt; + register BoxPtr pbox; + int i; + register int dx; + register int dy; + xRectangle origSource; + DDXPointRec origDest; + int numRects; + BoxRec fastBox; + int fastClip = 0; /* for fast clipping with pixmap source */ + int fastExpose = 0; /* for fast exposures with pixmap source */ + + if ( pDstDrawable->type != DRAWABLE_WINDOW ) + return miCopyArea( pSrcDrawable, pDstDrawable, pGC, + srcx, srcy, width, height, dstx, dsty ) ; + + /* Begin code from mfb/cfbCopyArea */ + + origSource.x = srcx; + origSource.y = srcy; + origSource.width = width; + origSource.height = height; + origDest.x = dstx; + origDest.y = dsty; + + if ((pSrcDrawable != pDstDrawable) && + pSrcDrawable->pScreen->SourceValidate) + { + (*pSrcDrawable->pScreen->SourceValidate) (pSrcDrawable, srcx, srcy, width, height); + } + + srcx += pSrcDrawable->x; + srcy += pSrcDrawable->y; + + /* clip the source */ + + if (pSrcDrawable->type == DRAWABLE_PIXMAP) + { + if ((pSrcDrawable == pDstDrawable) && + (pGC->clientClipType == CT_NONE)) + { + prgnSrcClip = pGC->pCompositeClip; + } + else + { + fastClip = 1; + } + } + else + { + if (pGC->subWindowMode == IncludeInferiors) + { + if (!((WindowPtr) pSrcDrawable)->parent) + { + /* + * special case bitblt from root window in + * IncludeInferiors mode; just like from a pixmap + */ + fastClip = 1; + } + else if ((pSrcDrawable == pDstDrawable) && + (pGC->clientClipType == CT_NONE)) + { + prgnSrcClip = pGC->pCompositeClip; + } + else + { + prgnSrcClip = NotClippedByChildren((WindowPtr)pSrcDrawable); + freeSrcClip = TRUE; + } + } + else + { + prgnSrcClip = &((WindowPtr)pSrcDrawable)->clipList; + } + } + + fastBox.x1 = srcx; + fastBox.y1 = srcy; + fastBox.x2 = srcx + width; + fastBox.y2 = srcy + height; + + /* Don't create a source region if we are doing a fast clip */ + if (fastClip) + { + fastExpose = 1; + /* + * clip the source; if regions extend beyond the source size, + * make sure exposure events get sent + */ + if (fastBox.x1 < pSrcDrawable->x) + { + fastBox.x1 = pSrcDrawable->x; + fastExpose = 0; + } + if (fastBox.y1 < pSrcDrawable->y) + { + fastBox.y1 = pSrcDrawable->y; + fastExpose = 0; + } + if (fastBox.x2 > pSrcDrawable->x + (int) pSrcDrawable->width) + { + fastBox.x2 = pSrcDrawable->x + (int) pSrcDrawable->width; + fastExpose = 0; + } + if (fastBox.y2 > pSrcDrawable->y + (int) pSrcDrawable->height) + { + fastBox.y2 = pSrcDrawable->y + (int) pSrcDrawable->height; + fastExpose = 0; + } + } + else + { + REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1); + REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, prgnSrcClip); + } + + dstx += pDstDrawable->x; + dsty += pDstDrawable->y; + + if (pDstDrawable->type == DRAWABLE_WINDOW) + { + if (!((WindowPtr)pDstDrawable)->realized) + { + if (!fastClip) + REGION_UNINIT(pGC->pScreen, &rgnDst); + if (freeSrcClip) + REGION_DESTROY(pGC->pScreen, prgnSrcClip); + return NULL; + } + } + + dx = srcx - dstx; + dy = srcy - dsty; + + /* Translate and clip the dst to the destination composite clip */ + if (fastClip) + { + RegionPtr cclip; + + /* Translate the region directly */ + fastBox.x1 -= dx; + fastBox.x2 -= dx; + fastBox.y1 -= dy; + fastBox.y2 -= dy; + + /* If the destination composite clip is one rectangle we can + do the clip directly. Otherwise we have to create a full + blown region and call intersect */ + cclip = pGC->pCompositeClip; + if (REGION_NUM_RECTS(cclip) == 1) + { + BoxPtr pBox = REGION_RECTS(cclip); + + if (fastBox.x1 < pBox->x1) fastBox.x1 = pBox->x1; + if (fastBox.x2 > pBox->x2) fastBox.x2 = pBox->x2; + if (fastBox.y1 < pBox->y1) fastBox.y1 = pBox->y1; + if (fastBox.y2 > pBox->y2) fastBox.y2 = pBox->y2; + + /* Check to see if the region is empty */ + if (fastBox.x1 >= fastBox.x2 || fastBox.y1 >= fastBox.y2) + { + REGION_NULL(pGC->pScreen, &rgnDst); + } + else + { + REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1); + } + } + else + { + /* We must turn off fastClip now, since we must create + a full blown region. It is intersected with the + composite clip below. */ + fastClip = 0; + REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1); + } + } + else + { + REGION_TRANSLATE(pGC->pScreen, &rgnDst, -dx, -dy); + } + + if (!fastClip) + { + REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, pGC->pCompositeClip); + } + + /* Do bit blitting */ + numRects = REGION_NUM_RECTS(&rgnDst); + if (numRects && width && height) + { + if(!(pptSrc = (DDXPointPtr)xalloc(numRects * + sizeof(DDXPointRec)))) + { + REGION_UNINIT(pGC->pScreen, &rgnDst); + if (freeSrcClip) + REGION_DESTROY(pGC->pScreen, prgnSrcClip); + return NULL; + } + pbox = REGION_RECTS(&rgnDst); + ppt = pptSrc; + for (i = numRects; --i >= 0; pbox++, ppt++) + { + ppt->x = pbox->x1 + dx; + ppt->y = pbox->y1 + dy; + } + + vga16DoBitblt(pSrcDrawable, pDstDrawable, pGC->alu, + &rgnDst, pptSrc, pGC->planemask ); + xfree(pptSrc); + } + + prgnExposed = NULL; + if (pGC->fExpose) + { + /* Pixmap sources generate a NoExposed (we return NULL to do this) */ + if (!fastExpose) + prgnExposed = + miHandleExposures(pSrcDrawable, pDstDrawable, pGC, + origSource.x, origSource.y, + (int)origSource.width, + (int)origSource.height, + origDest.x, origDest.y, (unsigned long)0); + } + REGION_UNINIT(pGC->pScreen, &rgnDst); + if (freeSrcClip) + REGION_DESTROY(pGC->pScreen, prgnSrcClip); + return prgnExposed; +} diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcDepth.c b/xorg-server/hw/xfree86/xf4bpp/ppcDepth.c new file mode 100644 index 000000000..2fa19ff80 --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/ppcDepth.c @@ -0,0 +1,53 @@ +/* + * Copyright IBM Corporation 1987,1988,1989 + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * +*/ + +/* Check to see if the alleged depth is acceptable for the Screen + * + * T. Paquin 9/87 + * + */ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include "xf4bpp.h" +#include "scrnintstr.h" + +Bool +xf4bppDepthOK(pDraw,depth) +register DrawablePtr pDraw; +register int depth; +{ +register ScreenPtr pScreen= pDraw->pScreen; +register int i = pScreen->numDepths; + + if ( ( pDraw->type == DRAWABLE_PIXMAP ) && ( depth == 1 ) ) + return TRUE ; + + while ( i-- ) + if ( depth == pScreen->allowedDepths[i].depth ) + return TRUE ; + + return FALSE ; +} diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcFillRct.c b/xorg-server/hw/xfree86/xf4bpp/ppcFillRct.c new file mode 100644 index 000000000..3422c8092 --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/ppcFillRct.c @@ -0,0 +1,215 @@ +/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ +/*********************************************************** + +Copyright (c) 1987 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 +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the 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. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include "xf4bpp.h" +#include "mfbmap.h" +#include "mfb.h" +#include "maskbits.h" +#include "scrnintstr.h" + +#define MODEQ(a, b) ((a) %= (b)) + +/* + filled rectangles. + translate the rectangles, clip them, and call the +helper function in the GC. +*/ + +#define NUM_STACK_RECTS 1024 + +void +xf4bppPolyFillRect(pDrawable, pGC, nrectFill, prectInit) + DrawablePtr pDrawable; + GCPtr pGC; + int nrectFill; /* number of rectangles to fill */ + xRectangle *prectInit; /* Pointer to first rectangle to fill */ +{ + 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; + + if (!(pGC->planemask & 0x0F)) /* GJA */ + return; + + prgnClip = pGC->pCompositeClip; + + prect = prectInit; + xorg = pDrawable->x; + yorg = pDrawable->y; + if (xorg || yorg) + { + prect = prectInit; + n = nrectFill; + Duff (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) + xf4bppFillArea((WindowPtr)pDrawable, pboxClipped-pboxClippedBase, + pboxClippedBase, pGC); + if (pboxClippedBase != stackRects) + xfree(pboxClippedBase); +} diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcGC.c b/xorg-server/hw/xfree86/xf4bpp/ppcGC.c new file mode 100644 index 000000000..7ef312d39 --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/ppcGC.c @@ -0,0 +1,446 @@ +/* + +Copyright (c) 1987 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 furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the 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. + + +Copyright IBM Corporation 1987,1988,1989 +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of IBM not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +*/ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include <stdlib.h> + +#include "xf4bpp.h" +#include "mfbmap.h" +#include "mfb.h" +#include "mi.h" +#include "scrnintstr.h" +#include "ppcGCstr.h" +#include "vgaVideo.h" +#include "ibmTrace.h" + +#define ppcGCInterestValidateMask \ +( GCLineStyle | GCLineWidth | GCJoinStyle | GCBackground | GCForeground \ +| GCFunction | GCPlaneMask | GCFillStyle | GC_CALL_VALIDATE_BIT \ +| GCClipXOrigin | GCClipYOrigin | GCClipMask | GCSubwindowMode ) + +static void xf4bppValidateGC(GCPtr, unsigned long, DrawablePtr); +static void xf4bppDestroyGC(GC *); + +static GCFuncs vgaGCFuncs = { + xf4bppValidateGC, + (void (*)(GCPtr, unsigned long))NoopDDA, + (void (*)(GCPtr, unsigned long, GCPtr))NoopDDA, + xf4bppDestroyGC, + xf4bppChangeClip, + xf4bppDestroyClip, + xf4bppCopyClip, + { NULL } +}; + + +static ppcPrivGC vgaPrototypeGCPriv = { + GXcopy, /* unsigned char rop */ + 0, /* unsigned char ropOpStip */ + 0, /* unsigned char ropFillArea */ + {0, }, /* unsigned char unused[sizeof(long) - 3] */ + NULL, /* mfbFillAreaProcPtr FillArea */ + { + VGA_ALLPLANES, /* unsigned long planemask */ + 1, /* unsigned long fgPixel */ + 0, /* unsigned long bgPixel */ + GXcopy, /* int alu */ + FillSolid, /* int fillStyle */ + }, /* ppcReducedRrop colorRrop */ + -1, /* short lastDrawableType */ + -1, /* short lastDrawableDepth */ + 0 /* pointer devPriv */ +} ; + +static GCOps vgaGCOps = { + xf4bppSolidWindowFS, /* void (* FillSpans)() */ + xf4bppSetSpans, /* void (* SetSpans)() */ + miPutImage, /* void (* PutImage)() */ + xf4bppCopyArea, /* RegionPtr (* CopyArea)() */ + miCopyPlane, /* void (* CopyPlane)() */ + xf4bppPolyPoint, /* void (* PolyPoint)() */ + miZeroLine, /* void (* Polylines)() */ + miPolySegment, /* void (* PolySegment)() */ + miPolyRectangle, /* void (* PolyRectangle)() */ + xf4bppZeroPolyArc, /* void (* PolyArc)() */ + miFillPolygon, /* void (* FillPolygon)() */ + miPolyFillRect, /* void (* PolyFillRect)() */ + xf4bppPolyFillArc, /* void (* PolyFillArc)() */ + miPolyText8, /* int (* PolyText8)() */ + miPolyText16, /* int (* PolyText16)() */ + miImageText8, /* void (* ImageText8)() */ + miImageText16, /* void (* ImageText16)() */ + xf4bppImageGlyphBlt, /* GJA -- void (* ImageGlyphBlt)() */ + miPolyGlyphBlt, /* GJA -- void (* PolyGlyphBlt)() */ + miPushPixels, /* void (* PushPixels)() */ + {NULL} /* devPrivate */ +}; + +Bool +xf4bppCreateGC( pGC ) +register GCPtr pGC ; +{ + ppcPrivGC *pPriv ; + GCOps *pOps ; + + if ( pGC->depth == 1 ) + { + return (mfbCreateGC(pGC)); + } + + if ( !( pPriv = xalloc( sizeof( ppcPrivGC ) ) ) ) + return FALSE ; + + if ( !( pOps = xalloc( sizeof( GCOps ) ) ) ) { + xfree(pPriv); + return FALSE; + } + + /* Now we initialize the GC fields */ + pGC->miTranslate = 1; + pGC->unused = 0; + pGC->planemask = VGA_ALLPLANES; + pGC->fgPixel = VGA_BLACK_PIXEL; + pGC->bgPixel = VGA_WHITE_PIXEL; + pGC->funcs = &vgaGCFuncs; + /* ops, -- see below */ + + pGC->fExpose = TRUE; + pGC->freeCompClip = FALSE; + + /* GJA: I don't like this code: + * they allocated a mfbPrivGC, ignore the allocated data and place + * a pointer to a ppcPrivGC in its slot. + */ + *pPriv = vgaPrototypeGCPriv; + dixSetPrivate(&pGC->devPrivates, mfbGetGCPrivateKey(), pPriv); + + /* Set the vgaGCOps */ + *pOps = vgaGCOps; + pOps->devPrivate.val = 1; + pGC->ops = pOps; + + return TRUE ; +} + +static void +xf4bppDestroyGC( pGC ) + register GC *pGC ; + +{ + TRACE( ( "xf4bppDestroyGC(pGC=0x%x)\n", pGC ) ) ; + + if ( pGC->freeCompClip && pGC->pCompositeClip ) + REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip); + if(pGC->ops->devPrivate.val) xfree( pGC->ops ); + xfree(dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey())); + return ; +} + +static Mask +ppcChangePixmapGC +( + register GC *pGC, + register Mask changes +) +{ +register ppcPrivGCPtr devPriv = (ppcPrivGCPtr)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()); +register unsigned long int idx ; /* used for stepping through bitfields */ + +#define LOWBIT( x ) ( x & - x ) /* Two's complement */ +while ((idx = LOWBIT(changes))) { + switch ( idx ) { + + case GCLineStyle: + case GCLineWidth: + pGC->ops->Polylines = ( ! pGC->lineWidth ) + ? miZeroLine + : ( ( pGC->lineStyle == LineSolid ) + ? miWideLine : miWideDash ) ; + changes &= ~( GCLineStyle | GCLineWidth ) ; + break ; + + case GCJoinStyle: + changes &= ~ idx ; /* i.e. changes &= ~ GCJoinStyle */ + break ; + + case GCBackground: + if ( pGC->fillStyle != FillOpaqueStippled ) { + changes &= ~ idx ; /* i.e. changes &= ~GCBackground */ + break ; + } /* else Fall Through */ + case GCForeground: + if ( pGC->fillStyle == FillTiled ) { + changes &= ~ idx ; /* i.e. changes &= ~GCForeground */ + break ; + } /* else Fall Through */ + case GCFunction: + case GCPlaneMask: + case GCFillStyle: + { /* new_fill */ + int fillStyle = devPriv->colorRrop.fillStyle ; + /* install a suitable fillspans */ + if ( fillStyle == FillSolid ) + pGC->ops->FillSpans = xf4bppSolidPixmapFS ; + else if ( fillStyle == FillStippled ) + pGC->ops->FillSpans = xf4bppStipplePixmapFS ; + else if ( fillStyle == FillOpaqueStippled ) + pGC->ops->FillSpans = xf4bppOpStipplePixmapFS ; + else /* fillStyle == FillTiled */ + pGC->ops->FillSpans = xf4bppTilePixmapFS ; + changes &= ~( GCBackground | GCForeground + | GCFunction | GCPlaneMask | GCFillStyle ) ; + break ; + } /* end of new_fill */ + + default: + ErrorF( "ppcChangePixmapGC: Unexpected GC Change\n" ) ; + changes &= ~ idx ; /* Remove it anyway */ + break ; + } +} + +return 0 ; +} + +/* Clipping conventions + if the drawable is a window + CT_REGION ==> pCompositeClip really is the composite + CT_other ==> pCompositeClip is the window clip region + if the drawable is a pixmap + CT_REGION ==> pCompositeClip is the translated client region + clipped to the pixmap boundary + CT_other ==> pCompositeClip is the pixmap bounding box +*/ + +static void +xf4bppValidateGC( pGC, changes, pDrawable ) + GCPtr pGC; + unsigned long changes; + DrawablePtr pDrawable; +{ + register ppcPrivGCPtr devPriv ; + WindowPtr pWin ; + + devPriv = (ppcPrivGCPtr)dixLookupPrivate(&pGC->devPrivates, + mfbGetGCPrivateKey()); + if ( pDrawable->type != devPriv->lastDrawableType ) { + devPriv->lastDrawableType = pDrawable->type ; + xf4bppChangeGCtype( pGC, devPriv ) ; + changes = (unsigned)~0 ; + } + + if ( pDrawable->depth == 1 ) { +/* ibmAbort(); */ + xf4bppNeverCalled(); + } + + if ( pDrawable->type == DRAWABLE_WINDOW ) { + pWin = (WindowPtr) pDrawable ; + pGC->lastWinOrg.x = pWin->drawable.x ; + pGC->lastWinOrg.y = pWin->drawable.y ; + } + else { + pWin = (WindowPtr) NULL ; + pGC->lastWinOrg.x = 0 ; + pGC->lastWinOrg.y = 0 ; + } + + changes &= ppcGCInterestValidateMask ; + /* If Nothing REALLY Changed, Just Return */ + if ( pDrawable->serialNumber == (pGC->serialNumber & DRAWABLE_SERIAL_BITS) ) + if ( !( changes &= ~ GC_CALL_VALIDATE_BIT ) ) + return ; + + /* GJA -- start of cfb code */ + /* + * if the client clip is different or moved OR the subwindowMode has + * changed OR the window's clip has changed since the last validation + * we need to recompute the composite clip + */ + + if ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)) || + (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS)) + ) + { + if (pWin) { + RegionPtr pregWin; + Bool freeTmpClip, freeCompClip; + + if (pGC->subWindowMode == IncludeInferiors) { + pregWin = NotClippedByChildren(pWin); + freeTmpClip = TRUE; + } + else { + pregWin = &pWin->clipList; + freeTmpClip = FALSE; + } + freeCompClip = pGC->freeCompClip; + + /* + * if there is no client clip, we can get by with just keeping + * the pointer we got, and remembering whether or not should + * destroy (or maybe re-use) it later. this way, we avoid + * unnecessary copying of regions. (this wins especially if + * many clients clip by children and have no client clip.) + */ + if (pGC->clientClipType == CT_NONE) { + if (freeCompClip) + REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip); + pGC->pCompositeClip = pregWin; + pGC->freeCompClip = freeTmpClip; + } + else { + /* + * we need one 'real' region to put into the composite + * clip. if pregWin the current composite clip are real, + * we can get rid of one. if pregWin is real and the + * current composite clip isn't, use pregWin for the + * composite clip. if the current composite clip is real + * and pregWin isn't, use the current composite clip. if + * neither is real, create a new region. + */ + + REGION_TRANSLATE(pGC->pScreen, pGC->clientClip, + pDrawable->x + pGC->clipOrg.x, + pDrawable->y + pGC->clipOrg.y); + + if (freeCompClip) + { + REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip, + pregWin, pGC->clientClip); + if (freeTmpClip) + REGION_DESTROY(pGC->pScreen, pregWin); + } + else if (freeTmpClip) + { + REGION_INTERSECT(pGC->pScreen, pregWin, pregWin, + pGC->clientClip); + pGC->pCompositeClip = pregWin; + } + else + { + pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, NullBox, 0); + REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip, + pregWin, pGC->clientClip); + } + pGC->freeCompClip = TRUE; + REGION_TRANSLATE(pGC->pScreen, pGC->clientClip, + -(pDrawable->x + pGC->clipOrg.x), + -(pDrawable->y + pGC->clipOrg.y)); + + } + } /* end of composite clip for a window */ + else { + BoxRec pixbounds; + + /* XXX should we translate by drawable.x/y here ? */ + pixbounds.x1 = 0; + pixbounds.y1 = 0; + pixbounds.x2 = pDrawable->width; + pixbounds.y2 = pDrawable->height; + + if (pGC->freeCompClip) { + REGION_RESET(pGC->pScreen, pGC->pCompositeClip, &pixbounds); + } else { + pGC->freeCompClip = TRUE; + pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, &pixbounds, 1); + } + + if (pGC->clientClipType == CT_REGION) + { + REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip, + -pGC->clipOrg.x, -pGC->clipOrg.y); + REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip, + pGC->pCompositeClip, pGC->clientClip); + REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip, + pGC->clipOrg.x, pGC->clipOrg.y); + } + } /* end of composute clip for pixmap */ + } + /* GJA -- End of cfb code */ + + changes &= ~ ( GCClipXOrigin | GCClipYOrigin | GCClipMask | GCSubwindowMode + | GC_CALL_VALIDATE_BIT ) ; + + /* If needed, Calculate the Color Reduced Raster-Op */ + if ( changes & ( GCFillStyle | GCBackground | GCForeground + | GCPlaneMask | GCFunction ) ) + xf4bppGetReducedColorRrop( pGC, pDrawable->depth, + &devPriv->colorRrop ) ; + + (* ( ( pDrawable->type == DRAWABLE_WINDOW ) + ? xf4bppChangeWindowGC + : ppcChangePixmapGC ) )( pGC, changes ) ; + + return ; +} diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcGCstr.h b/xorg-server/hw/xfree86/xf4bpp/ppcGCstr.h new file mode 100644 index 000000000..82d1f2df4 --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/ppcGCstr.h @@ -0,0 +1,71 @@ +/* + * Copyright IBM Corporation 1987,1988,1989 + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * +*/ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include "gc.h" +#include "mfb.h" + +typedef struct { + unsigned long planemask ; + unsigned long fgPixel ; + unsigned long bgPixel ; + int alu ; + int fillStyle ; + } ppcReducedRrop ; + +/* ************************************************************************ */ + +/* private field of GC */ +typedef struct { +/* The next five (5) fields MUST CORRESPOND to + * the fields of a "mfbPrivGC" struct + * ----- BEGINNING OF "DO-NOT-CHANGE" REGION ----- + */ + unsigned char rop ; /* reduction of rasterop to 1 of 3 */ + unsigned char ropOpStip ; /* rop for opaque stipple */ + unsigned char ropFillArea ; /* == alu, rop, or ropOpStip */ + unsigned char unused[sizeof(long) - 3]; + mfbFillAreaProcPtr FillArea; /* fills regions; look at the code */ +/* ----- END OF "DO-NOT-CHANGE" REGION ----- */ + ppcReducedRrop colorRrop ; + short lastDrawableType ; /* was last drawable a window or a pixmap? */ + short lastDrawableDepth ; /* was last drawable 1 or 8 planes? */ + pointer devPriv ; /* Private area for device specific stuff */ + } ppcPrivGC ; +typedef ppcPrivGC *ppcPrivGCPtr ; + +/* ppcCReduce.c */ +void xf4bppGetReducedColorRrop( + GCPtr, + int, + ppcReducedRrop * +); + +/* vgaGC.c */ +void xf4bppChangeGCtype( + GCPtr, + ppcPrivGCPtr +); diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcGetSp.c b/xorg-server/hw/xfree86/xf4bpp/ppcGetSp.c new file mode 100644 index 000000000..d88abe02b --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/ppcGetSp.c @@ -0,0 +1,141 @@ +/* + * Copyright IBM Corporation 1987,1988,1989 + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * +*/ + +/*********************************************************** + +Copyright (c) 1987 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 +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the 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. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include <string.h> +#include "xf4bpp.h" +#include "OScompiler.h" +#include "mfbmap.h" +#include "mfb.h" +#include "servermd.h" +#include "ibmTrace.h" + +/* GetSpans -- for each span, gets bits from drawable starting at ppt[i] + * and continuing for pwidth[i] bits + * Each scanline returned will be server scanline padded, i.e., it will come + * out to an integral number of words. + */ +void +xf4bppGetSpans( pDrawable, wMax, ppt, pwidth, nspans, pdstStart ) + DrawablePtr pDrawable ; /* drawable from which to get bits */ + int wMax ; /* largest value of all *pwidths */ + DDXPointPtr ppt ; /* points to start copying from */ + int *pwidth ; /* list of number of bits to copy */ + int nspans ; /* number of scanlines to copy */ + char *pdstStart ; +{ + register int j ; + register unsigned char *pdst ; /* where to put the bits */ + register unsigned char *psrc ; /* where to get the bits */ + register int pixmapStride ; + + + TRACE( ( "xf4bppGetSpans(pDrawable=0x%x,wMax=%d,ppt=0x%x,pwidth=0x%x,nspans=%d)\n", + pDrawable, wMax, ppt, pwidth, nspans ) ) ; + + if ( ( pDrawable->depth == 1 ) && ( pDrawable->type == DRAWABLE_PIXMAP ) ) + { + mfbGetSpans( pDrawable, wMax, ppt, pwidth, nspans, pdstStart ) ; + return; + } + + pixmapStride = PixmapBytePad( wMax, pDrawable->depth ) ; + pdst = (unsigned char *) /* GJA */ pdstStart ; + + if ( pDrawable->type == DRAWABLE_WINDOW ) { + for ( ; nspans-- ; ppt++, pwidth++ ) { + xf4bppReadColorImage( (WindowPtr)pDrawable, + ppt->x, ppt->y, j = *pwidth, 1, pdst, pixmapStride ) ; + pdst += j ; /* width is in 32 bit words */ + j = ( -j ) & 3 ; + while ( j-- ) /* Pad out to 32-bit boundary */ + *pdst++ = 0 ; + } + } + else { /* OK, if we are here, we had better be a DRAWABLE PIXMAP */ + register int widthSrc = /* width of pixmap in bytes */ + (int) ( (PixmapPtr) pDrawable )->devKind ; + + psrc = (unsigned char *) ( (PixmapPtr) pDrawable )->devPrivate.ptr ; + for ( ; nspans-- ; ppt++, pwidth++ ) { + MOVE( psrc + ( ppt->y * widthSrc ) + ppt->x, + pdst, j = *pwidth ) ; + pdst += j ; + j = ( -j ) & 3 ; + while ( j-- ) /* Pad out to 32-bit boundary */ + *pdst++ = 0 ; + } + } + return ; +} diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcIO.c b/xorg-server/hw/xfree86/xf4bpp/ppcIO.c new file mode 100644 index 000000000..83952d12d --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/ppcIO.c @@ -0,0 +1,233 @@ +/* + +Copyright (c) 1990 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 furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the 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. + + +Copyright IBM Corporation 1987,1988,1989 +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of IBM not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +*/ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include <stdlib.h> + +#include "xf4bpp.h" +#include "mfbmap.h" +#include "mfb.h" +#include "mi.h" +#include "micmap.h" +#include "scrnintstr.h" +#include "vgaVideo.h" + +#if 0 +/* XXX This remains to remind of the PC98 difference */ +static VisualRec vgaVisuals[] = { +/* StaticColor needs to be first so is can be used as the default */ +/* vid class bpRGB cmpE nplan rMask gMask bMask oRed oGreen oBlue */ +#ifdef PC98 +{ 0, StaticColor, 4, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 }, +{ 0, StaticGray, 4, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 }, +{ 0, GrayScale, 4, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 }, +{ 0, PseudoColor, 4, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 }, +#else +{ 0, StaticColor, 6, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 }, +{ 0, StaticGray, 6, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 }, +{ 0, GrayScale, 6, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 }, +{ 0, PseudoColor, 6, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 }, +#endif +} ; +#endif + +void +xf4bppNeverCalled() +{ + FatalError("xf4bppNeverCalled was nevertheless called\n"); +} + +/*ARGSUSED*/ +static Bool +vgaScreenClose +( + int idx, + ScreenPtr pScreen +) +{ + pScreen->defColormap = 0 ; + return TRUE; +} + + +static GCPtr sampleGCperDepth[MAXFORMATS+1] = { 0 }; +static PixmapPtr samplePixmapPerDepth[1] = { 0 }; + +/* GJA -- Took this from miscrinit.c. + * We want that devKind contains the distance in bytes between two scanlines. + * The computation that mi does is not appropriate for planar VGA. + * Therefore we provide here our own routine. + */ + +/* GJA -- WARNING: this is an internal structure declaration, taken from + * miscrinit.c + */ +typedef struct +{ + pointer pbits; /* pointer to framebuffer */ + int width; /* delta to add to a framebuffer addr to move one row down */ +} miScreenInitParmsRec, *miScreenInitParmsPtr; + +/* With the introduction of pixmap privates, the "screen pixmap" can no + * longer be created in miScreenInit, since all the modules that could + * possibly ask for pixmap private space have not been initialized at + * that time. pScreen->CreateScreenResources is called after all + * possible private-requesting modules have been inited; we create the + * screen pixmap here. + */ +static Bool +v16CreateScreenResources +( + ScreenPtr pScreen +) +{ + miScreenInitParmsPtr pScrInitParms; + pointer value; + + pScrInitParms = (miScreenInitParmsPtr)pScreen->devPrivate; + + /* if width is non-zero, pScreen->devPrivate will be a pixmap + * else it will just take the value pbits + */ + if (pScrInitParms->width) + { + PixmapPtr pPixmap; + + /* create a pixmap with no data, then redirect it to point to + * the screen + */ + pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, pScreen->rootDepth, 0); + if (!pPixmap) + return FALSE; + + if (!(*pScreen->ModifyPixmapHeader)(pPixmap, pScreen->width, + pScreen->height, pScreen->rootDepth, 8 /* bits per pixel */, +/* GJA: was PixmapBytePad(pScrInitParms->width, pScreen->rootDepth), */ +#define BITS_PER_BYTE_SHIFT 3 + pScrInitParms->width >> BITS_PER_BYTE_SHIFT, + pScrInitParms->pbits)) + return FALSE; + value = (pointer)pPixmap; + } + else + { + value = pScrInitParms->pbits; + } + xfree(pScreen->devPrivate); /* freeing miScreenInitParmsRec */ + pScreen->devPrivate = value; /* pPixmap or pbits */ + return TRUE; +} + + +Bool +xf4bppScreenInit( pScreen, pbits, virtx, virty, dpix, dpiy, width ) + ScreenPtr pScreen; + pointer pbits; + int virtx, virty; + int dpix, dpiy; + int width; +{ + Bool ret; + VisualPtr visuals; + DepthPtr depths; + int nvisuals; + int ndepths; + int rootdepth; + VisualID defaultVisual; + + rootdepth = 0; + ret = miInitVisuals(&visuals, &depths, &nvisuals, &ndepths, &rootdepth, + &defaultVisual, (unsigned long)1 << 8, 6, -1); + if (!ret) + return FALSE; + + pScreen-> id = 0; + pScreen->defColormap = FakeClientID(0); + pScreen-> whitePixel = VGA_WHITE_PIXEL; + pScreen-> blackPixel = VGA_BLACK_PIXEL; + pScreen-> rgf = 0; + *(pScreen-> GCperDepth) = *(sampleGCperDepth); + *(pScreen-> PixmapPerDepth) = *(samplePixmapPerDepth); + pScreen-> CloseScreen = vgaScreenClose; + pScreen-> QueryBestSize = xf4bppQueryBestSize; + pScreen-> GetImage = xf4bppGetImage; + pScreen-> GetSpans = xf4bppGetSpans; + pScreen-> CreateWindow = xf4bppCreateWindowForXYhardware; + pScreen-> DestroyWindow = xf4bppDestroyWindow; + pScreen-> PositionWindow = xf4bppPositionWindow; + pScreen-> CopyWindow = xf4bppCopyWindow; + pScreen-> CreatePixmap = xf4bppCreatePixmap; + pScreen-> CreateGC = xf4bppCreateGC; + pScreen-> CreateColormap = xf4bppInitializeColormap; + pScreen-> DestroyColormap = (DestroyColormapProcPtr)NoopDDA; + pScreen-> InstallColormap = miInstallColormap; + pScreen-> UninstallColormap = miUninstallColormap; + pScreen-> ListInstalledColormaps = miListInstalledColormaps; + pScreen-> StoreColors = (StoreColorsProcPtr)NoopDDA; + pScreen-> ResolveColor = xf4bppResolveColor; + mfbFillInScreen(pScreen); + + if (!mfbAllocatePrivates(pScreen, NULL)) + return FALSE; + + if (!miScreenInit(pScreen, pbits, virtx, virty, dpix, dpiy, width, + rootdepth, ndepths, depths, defaultVisual /* See above */, + nvisuals, visuals)) + return FALSE; + + /* GJA -- Now we override the supplied default: */ + pScreen -> CreateScreenResources = v16CreateScreenResources; + + mfbRegisterCopyPlaneProc(pScreen,miCopyPlane); /* GJA -- R4->R5 */ + return TRUE; +} diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcImg.c b/xorg-server/hw/xfree86/xf4bpp/ppcImg.c new file mode 100644 index 000000000..33c6b89c5 --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/ppcImg.c @@ -0,0 +1,122 @@ +/* + * Copyright IBM Corporation 1987,1988,1989 + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * +*/ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include <stdlib.h> + +#include "xf4bpp.h" +#include "OScompiler.h" +#include "mi.h" +#include "scrnintstr.h" +#include "servermd.h" + +/* Was MIGETIMAGE -- public entry for the GetImage Request + * We're getting the image into a memory buffer. While we have to use GetSpans + * to read a line from the device ( since we don't know what that looks like ) , + * we can just write into the destination buffer + * + * two different strategies are used, depending on whether we're getting the + * image in Z format or XY format + * Z format: + * Line at a time, GetSpans a line and bcopy it to the destination + * buffer, except that if the planemask is not all ones, we create a + * temporary pixmap and do a SetSpans into it ( to get bits turned off ) + * and then another GetSpans to get stuff back ( because pixmaps are + * opaque, and we are passed in the memory to write into ) . This is + * completely ugly and slow but works, but the interfaces just aren't + * designed for this case. Life is hard. + * XY format: + * get the single plane specified in planemask + */ +void +xf4bppGetImage( pDraw, sx, sy, w, h, format, planeMask, pdstLine ) + DrawablePtr pDraw ; + int sx, sy, w, h ; + unsigned int format ; + unsigned long planeMask ; + char * pdstLine ; +{ +#if 1 + int depth, i, linelength, width ; + DDXPointRec pt ; + char *pbits ; + XID gcv[2] ; + PixmapPtr pPixmap = (PixmapPtr) NULL ; + GCPtr pGC ; + char *pDst = pdstLine ; + + depth = pDraw->depth ; + if ( format == ZPixmap ) { + linelength = PixmapBytePad( w, depth ) ; +/* if ( pDraw->type == DRAWABLE_WINDOW ) { */ + sx += pDraw->x ; + sy += pDraw->y ; +/* } */ + if ( ( ( ( 1 << pDraw->depth ) - 1 ) & planeMask ) + != (unsigned)( 1 << pDraw->depth ) - 1 ) { + pGC = GetScratchGC( depth, pDraw->pScreen ) ; + pPixmap = (PixmapPtr) + (* pDraw->pScreen->CreatePixmap)( pDraw->pScreen, w, h, depth, + CREATE_PIXMAP_USAGE_SCRATCH) ; + gcv[0] = GXcopy ; + gcv[1] = planeMask ; + DoChangeGC( pGC, GCPlaneMask | GCFunction, gcv, 0 ) ; + ValidateGC( (DrawablePtr)pPixmap, pGC ) ; + + pbits = (char *)xalloc(w); + + for ( i = 0 ; i < h ; i++ ) { + pt.x = sx ; + pt.y = sy + i ; + width = w ; + (* pDraw->pScreen->GetSpans)( pDraw, w, &pt, &width, 1, pbits ) ; + pt.x = 0 ; + pt.y = i ; + width = w ; + if ( planeMask & ((1 << depth) - 1) ) /* GJA -- mfb bug */ + (* pGC->ops->SetSpans)( (DrawablePtr)pPixmap, pGC, pbits, &pt, &width, 1, TRUE ) ; + (* pDraw->pScreen->GetSpans)( (DrawablePtr)pPixmap, w, &pt, &width, 1, pDst ) ; + pDst += linelength ; + } + + xfree(pbits) ; + (* pGC->pScreen->DestroyPixmap)( pPixmap ) ; + FreeScratchGC( pGC ) ; + return ; + } + + for ( i = 0 ; i < h ; i++ ) { + pt.x = sx ; + pt.y = sy + i ; + width = w ; + (* pDraw->pScreen->GetSpans)( pDraw, w, &pt, &width, 1, pDst ) ; + pDst += linelength ; + } + } + else +#endif + miGetImage( pDraw, sx, sy, w, h, format, planeMask, pdstLine ) ; +} diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcPixFS.c b/xorg-server/hw/xfree86/xf4bpp/ppcPixFS.c new file mode 100644 index 000000000..9fd29efce --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/ppcPixFS.c @@ -0,0 +1,502 @@ +/* + * Copyright IBM Corporation 1987,1988,1989 + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * +*/ + +/****************************************************************** +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include "xf4bpp.h" +#include "mfbmap.h" +#include "mfb.h" +#include "maskbits.h" +#include "mi.h" +#include "mispans.h" +#include "ppcGCstr.h" +#include "ppcSpMcro.h" +#include "vgaVideo.h" +#include "ibmTrace.h" + +#define LeftMostBitInScreenLongWord SCRLEFT( 0xFFFFFFFF, 31 ) + +/* GJA -- copied this from VGA */ +#define SCRLEFT8(lw, n) ( (unsigned char) (((unsigned char) lw) << (n)) ) +#define SCRRIGHT8(lw, n) ( (unsigned char) (((unsigned char)lw) >> (n)) ) +/* +********** ********** ********** ********** ********** ********** ********** + these routines all clip. they assume that anything that has called +them has already translated the points (i.e. pGC->miTranslate is +non-zero, which is howit gets set in mfbCreateGC().) + + the number of new scnalines created by clipping == +MaxRectsPerBand * nSpans. +********** ********** ********** ********** ********** ********** ********** +*/ +/* A mod definition that goes smoothly into the negative. + */ +static int +modulo +( + int n1, + int n2 +) +{ + int tmp; + if ( n1 < 0 ) { + tmp = (-n1) % n2; + if ( tmp == 0 ) { + return 0; + } else { + return n2 - tmp; + } + } else { + return n1 % n2; + } +} + +void +xf4bppSolidPixmapFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) + DrawablePtr pDrawable ; + GCPtr pGC ; + int nInit ; /* number of spans to fill */ + DDXPointPtr pptInit ; /* pointer to list of start points */ + int *pwidthInit ; /* pointer to list of n widths */ + int fSorted ; +{ + register unsigned long int pm, npm ; + register unsigned long int fg ; + register int alu ; + /* next three parameters are post-clip */ + int n ; /* number of spans to fill */ + register DDXPointPtr ppt ; /* pointer to list of start points */ + register int *pwidth ; /* pointer to list of n widths */ + register unsigned char *addrl ; /* pointer to current longword in bitmap */ + int i ; + int *pwidthFree ; /* copies of the pointers to free */ + DDXPointPtr pptFree ; + + TRACE(("xf4bppSolidPixmapFS(pDrawable=0x%x, pGC=0x%x, nInit=%d, pptInit=0x%x, pwidthInit=0x%x, fSorted=%d)\n", pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)) ; + + if ( pDrawable->type != DRAWABLE_PIXMAP ) { + ErrorF("xf4bppSolidPixmapFS: drawable is not a pixmap\n") ; + return ; + } + + if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()))->colorRrop.alu ) == GXnoop ) + return ; + + n = nInit * miFindMaxBand(pGC->pCompositeClip) ; + if ( !( pwidthFree = (int *) xalloc( n * sizeof( int ) ) ) ) + return ; + pwidth = pwidthFree ; + + if ( !( pptFree = (DDXPointRec *) + xalloc( n * sizeof( DDXPointRec ) ) ) ) { + xfree( pwidth ) ; + return ; + } + ppt = pptFree ; + + n = miClipSpans( pGC->pCompositeClip, pptInit, pwidthInit, nInit, + ppt, pwidth, fSorted ) ; + + pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ; + fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ; + npm = ( ~ pm ) & ( ( 1 << pDrawable->depth ) - 1 ) ; + + for ( ; n-- ; ppt++, pwidth++ ) { + addrl = ( (unsigned char *) ( ( (PixmapPtr) pDrawable )->devPrivate.ptr ) ) + + ( ppt->y * ( (int) ( ( (PixmapPtr) pDrawable )->devKind ) ) ) + + ppt->x ; + for ( i = *pwidth ; i-- ; addrl++ ) + { + unsigned _p; + DoRop( _p, alu, fg, *addrl ); + *addrl = ( *addrl & npm ) | ( pm & _p ) ; + } +#ifdef notdef /* PURDUE */ + *addrl = ( *addrl & npm ) | ( pm & DoRop( alu, fg, *addrl ) ) ; +#endif /* PURDUE */ + } + xfree( pptFree ) ; + xfree( pwidthFree ) ; + return ; +} + +/* GJA -- copied from vgaStipple.c */ +static unsigned char +vgagetbits +( + register const int x, + register const unsigned int patternWidth, + register const unsigned char * const lineptr +) +{ +register unsigned char bits ; +register const unsigned char *cptr ; +register int shift ; +register int wrap ; + +cptr = lineptr + ( x >> 3 ) ; +bits = *cptr ; +if ((shift = x & 7)) + bits = SCRLEFT8( bits, shift ) | SCRRIGHT8( cptr[1], ( 8 - shift ) ) ; +if ( ( wrap = x + 8 - patternWidth ) > 0 ) { + bits &= SCRLEFT8( 0xFF, wrap ) ; + bits |= SCRRIGHT8( *lineptr, ( 8 - wrap ) ) ; +} + +/* GJA -- Handle extraction of 8 bits from < 8 bits wide stipple. + * I duplicated case 4,5,6,7 to give the compiler a chance to optimize. + */ +switch (patternWidth) { +case 1: /* Not really useful. */ + bits &= ~SCRRIGHT8(0xFF,1); + bits |= SCRRIGHT8(bits,1); + bits |= SCRRIGHT8(bits,2); + bits |= SCRRIGHT8(bits,4); + break; +case 2: + bits &= ~SCRRIGHT8(0xFF,2); + bits |= SCRRIGHT8(bits,2); bits |= SCRRIGHT8(bits,4); break; +case 3: + bits &= ~SCRRIGHT8(0xFF,3); + bits |= (SCRRIGHT8(bits,3) | SCRRIGHT8(bits,6)); break; +case 4: + bits = (bits & ~SCRRIGHT8(0xFF,4)) | SCRRIGHT8(bits,4); break; +case 5: + bits = (bits & ~SCRRIGHT8(0xFF,5)) | SCRRIGHT8(bits,5); break; +case 6: + bits = (bits & ~SCRRIGHT8(0xFF,6)) | SCRRIGHT8(bits,6); break; +case 7: + bits = (bits & ~SCRRIGHT8(0xFF,7)) | SCRRIGHT8(bits,7); break; +default: + ; + /* Do nothing, of course */ +} + +return bits ; +} + +void +xf4bppStipplePixmapFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) +register DrawablePtr pDrawable ; +GC *pGC ; +int nInit ; /* number of spans to fill */ +DDXPointPtr pptInit ; /* pointer to list of start points */ +int *pwidthInit ; /* pointer to list of n widths */ +int fSorted ; +{ + register unsigned char *pdst ; /* pointer to current word in bitmap */ + register unsigned long int pm, npm ; + register unsigned long int fg ; + register int alu ; + /* next three parameters are post-clip */ + int n ; /* number of spans to fill */ + register DDXPointPtr ppt ; /* pointer to list of start points */ + register int *pwidth ; /* pointer to list of n widths */ + PixmapPtr pTile ; /* pointer to tile we want to fill with */ + int width, x, xSrc, ySrc ; + int tlwidth, tileWidth ; + unsigned char *psrcT ; + int *pwidthFree ; /* copies of the pointers to free */ + DDXPointPtr pptFree ; + int xoff, count, stip, i ; + + TRACE(("xf4bppStipplePixmapFS(pDrawable=0x%x, pGC=0x%x, nInit=%d, pptInit=0x%x, pwidthInit=0x%x, fSorted=%d)\n", + pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)) ; + + if ( pDrawable->type != DRAWABLE_PIXMAP ) { + ErrorF( "xf4bppStippleWindowFS: drawable is not a pixmap\n") ; + return ; + } + if ( pGC->stipple->drawable.depth != 1 ) { + ErrorF( "ppcStippleFS: bad depth\ntype = %d, depth = %d\n", + pDrawable->type, pGC->stipple->drawable.depth ) ; + return ; + } + + if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop ) + return ; + + SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit, + pptFree, pwidth, ppt, fSorted ) ; + + pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ; + fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ; + + pTile = pGC->stipple ; + tlwidth = pTile->devKind ; + + tileWidth = pTile->drawable.width ; + + npm = ( ~ pm ) & ( ( 1 << pDrawable->depth ) - 1 ) ; + + /* this replaces rotating the stipple. Instead, we just adjust the offset + * at which we start grabbing bits from the stipple */ + xSrc = pGC->patOrg.x + pDrawable->x; + ySrc = pGC->patOrg.y + pDrawable->y; + + while ( n-- ) { + pdst = ( (unsigned char *) ( (PixmapPtr) pDrawable )->devPrivate.ptr ) + + ( ppt->y * ( (int) ( ( (PixmapPtr) pDrawable )->devKind ) ) ) + + ppt->x ; + psrcT = (unsigned char *)pTile->devPrivate.ptr + + ( modulo( ppt->y - ySrc, pTile->drawable.height ) * tlwidth ) ; + x = ppt->x ; + + xoff = modulo( x - xSrc, tileWidth) ; + for ( width = *pwidth ; width ; width -= count, xoff+=count ) { + + if ( xoff >= tileWidth ) xoff -= tileWidth; + + if ( width < 8 ) + count = width; + else + count = 8; + + stip = vgagetbits( xoff, tileWidth, psrcT ) ; + + for ( i = count ; i-- ; ) { + if ( stip & 128 ) + { + unsigned _p; + DoRop( _p, alu, fg, *pdst ) ; + *pdst = ( *pdst & npm ) | ( pm & _p ) ; + } +#ifdef notdef /* PURDUE */ + *pdst = ( *pdst & npm ) | ( pm & DoRop( alu, fg, *pdst ) ) ; +#endif /* PURDUE */ + pdst++ ; + stip = SCRLEFT( stip, 1 ) ; + } + } + ppt++ ; + pwidth++ ; + } + xfree( pptFree ) ; + xfree( pwidthFree ) ; + return ; +} + +void +xf4bppOpStipplePixmapFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) +DrawablePtr pDrawable ; +GC *pGC ; +int nInit ; /* number of spans to fill */ +DDXPointPtr pptInit ; /* pointer to list of start points */ +int *pwidthInit ; /* pointer to list of n widths */ +int fSorted ; +{ + register unsigned char *pdst ; /* pointer to current word in bitmap */ + register unsigned long int pm, npm ; + register unsigned long int fg, bg ; + register int alu ; + /* next three parameters are post-clip */ + int n ; /* number of spans to fill */ + register DDXPointPtr ppt ; /* pointer to list of start points */ + register int *pwidth ; /* pointer to list of n widths */ + PixmapPtr pTile ; /* pointer to tile we want to fill with */ + int width ; + int xSrc, ySrc ; + int tlwidth, tileWidth ; + unsigned char *psrcT ; + int *pwidthFree ; /* copies of the pointers to free */ + DDXPointPtr pptFree ; + int xoff, count, stip, i ; + + TRACE( ( "xf4bppOpStipplePixmapFS(pDrawable=0x%x,pGC=0x%x,nInit=%d,pptInit=0x%x,pwidthInit=0x%x,fSorted=%d)\n", + pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ) ; + + if ( pGC->stipple->drawable.depth != 1 ) { + ErrorF( "xf4bppOpStipplePixmapFS: bad depth\ntype = %d, depth = %d\n", + pDrawable->type, pGC->stipple->drawable.depth ) ; + return ; + } + + if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop ) + return ; + + SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit, + pptFree, pwidth, ppt, fSorted ) ; + + fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ; + bg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.bgPixel ; + pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ; + npm = ( ~ pm ) & ( ( 1 << pDrawable->depth ) - 1 ) ; + + pTile = pGC->stipple ; + tlwidth = pTile->devKind ; + tileWidth = pTile->drawable.width ; + + xSrc = pGC->patOrg.x + pDrawable->x; + ySrc = pGC->patOrg.y + pDrawable->y; + + /* this replaces rotating the stipple. Instead, we just adjust the offset + * at which we start grabbing bits from the stipple */ + for ( ; n-- ; ppt++, pwidth++ ) { + pdst = ( (unsigned char *) ( (PixmapPtr) pDrawable )->devPrivate.ptr ) + + ( ppt->y * ( (int) ( (PixmapPtr) pDrawable )->devKind ) ) + + ppt->x ; + psrcT = (unsigned char *)pTile->devPrivate.ptr + + ( modulo( ppt->y - ySrc, pTile->drawable.height ) * tlwidth ) ; + + xoff = modulo( ppt->x - xSrc, tileWidth) ; + + for ( width = *pwidth ; width ; width -= count, xoff+=count ) { + + if ( xoff >= tileWidth ) xoff -= tileWidth; + + if ( width < 8 ) + count = width; + else + count = 8; + + stip = vgagetbits( xoff, tileWidth, psrcT ) ; + for ( i = count ; i-- ; pdst++, stip = SCRLEFT( stip, 1 ) ) + if ( stip & 128 ) + { + unsigned _p; + DoRop( _p, alu, fg, *pdst ) ; + *pdst = ( *pdst & npm ) | ( pm & _p ) ; + } +#ifdef notdef /* PURDUE */ + *pdst = ( *pdst & npm ) | ( pm & DoRop( alu, fg, *pdst ) ) ; +#endif /* PURDUE */ + else + { + unsigned _p; + DoRop( _p, alu, bg, *pdst ) ; + *pdst = ( *pdst & npm ) | ( pm & _p ) ; + } +#ifdef notdef /* PURDUE */ + *pdst = ( *pdst & npm ) | ( pm & DoRop( alu, bg, *pdst ) ) ; +#endif /* PURDUE */ + } + } + xfree( pptFree ) ; + xfree( pwidthFree ) ; + return ; +} + +void +xf4bppTilePixmapFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) +register DrawablePtr pDrawable ; +GC *pGC ; +int nInit ; /* number of spans to fill */ +DDXPointPtr pptInit ; /* pointer to list of start points */ +int *pwidthInit ; /* pointer to list of n widths */ +int fSorted ; +{ + register DDXPointPtr ppt ; /* pointer to list of start points */ + register int *pwidth ; /* pointer to list of n widths */ + register unsigned char *pdst ; /* pointer to current word in bitmap */ + register unsigned char *psrc ; /* pointer to current word in tile */ + register PixmapPtr pTile ; /* pointer to tile we want to fill with */ + int i ; + int alu ; + unsigned char pm, npm ; + /* next three parameters are post-clip */ + int n ; /* number of spans to fill */ + int tileWidth ; + int xSrc, ySrc; + unsigned char *psrcT ; + int *pwidthFree ; /* copies of the pointers to free */ + DDXPointPtr pptFree ; + + TRACE( ( "ppcTileFS(pDrawable=0x%x,pGC=0x%x,nInit=%d,pptInit=0x%x,pwidthInit=0x%x,fSorted=%d)\n", + pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ) ; + + if ( ( pDrawable->depth == 1 ) && ( pDrawable->type == DRAWABLE_PIXMAP ) ) { + mfbTileFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ; + return ; + } + if ( !xf4bppDepthOK( pDrawable, pGC->tile.pixmap->drawable.depth ) ) { + ErrorF( "ppcTileFS: bad depth\ntype = %d, depth = %d\n", + pDrawable->type, pDrawable->depth) ; + return ; + } + + if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop ) + return ; + + SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit, + pptFree, pwidth, ppt, fSorted ) ; + + /* the following code is for 8 bits per pixel addressable memory only */ + pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ; + npm = ( ~ pm ) & ( ( 1 << pDrawable->depth ) - 1 ) ; + pTile = pGC->tile.pixmap ; + tileWidth = pTile->drawable.width ; + + xSrc = pGC->patOrg.x + pDrawable->x; + ySrc = pGC->patOrg.y + pDrawable->y; + /* this replaces rotating the tile. Instead we just adjust the offset + * at which we start grabbing bits from the tile */ + for ( ; n-- ; ppt++, pwidth++ ) { + pdst = ( (unsigned char *) ( (PixmapPtr) pDrawable )->devPrivate.ptr ) + + ( ppt->y * ( (int) ( (PixmapPtr) pDrawable )->devKind ) ) + + ppt->x ; + psrcT = (unsigned char *) pTile->devPrivate.ptr + + ( modulo( ppt->y - ySrc, pTile->drawable.height) * pTile->devKind ) ; + + psrc = psrcT + modulo( ppt->x - xSrc, tileWidth ) ; + for ( i = *pwidth ; i-- ; pdst++, psrc++ ) { + if ( psrc >= ( psrcT + tileWidth ) ) + psrc = psrcT ; + { + unsigned _p; + DoRop( _p, alu, *psrc, *pdst ) ; + *pdst = ( *pdst & npm ) | ( pm & _p ) ; + } +#ifdef notdef /* PURDUE */ + *pdst = ( *pdst & npm ) | ( pm & DoRop( alu, *psrc, *pdst ) ) ; +#endif /* PURDUE */ + } + } + xfree( pptFree ) ; + xfree( pwidthFree ) ; + return ; +} diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcPixmap.c b/xorg-server/hw/xfree86/xf4bpp/ppcPixmap.c new file mode 100644 index 000000000..d04aacf82 --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/ppcPixmap.c @@ -0,0 +1,151 @@ +/* + * Copyright IBM Corporation 1987,1988,1989 + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * +*/ + +/*********************************************************** + +Copyright (c) 1987 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 +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the 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. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include <string.h> + +#include "xf4bpp.h" +#include "servermd.h" +#include "OScompiler.h" +#include "ibmTrace.h" +#include "scrnintstr.h" + +PixmapPtr +xf4bppCreatePixmap( pScreen, width, height, depth, usage_hint ) + ScreenPtr pScreen ; + int width ; + int height ; + int depth ; + unsigned usage_hint ; +{ + register PixmapPtr pPixmap = (PixmapPtr)NULL; + size_t size ; + + TRACE(("xf4bppCreatePixmap(pScreen=0x%x, width=%d, height=%d, depth=%d, usage_hint=%d)\n", pScreen, width, height, depth, usage_hint)) ; + + if ( depth > 8 ) + return (PixmapPtr) NULL ; + + size = PixmapBytePad(width, depth); + + if (size / 4 > 32767 || height > 32767) + return (PixmapPtr) NULL ; + + pPixmap = AllocatePixmap (pScreen, (height * size)); + + if ( !pPixmap ) + return (PixmapPtr) NULL ; + pPixmap->drawable.type = DRAWABLE_PIXMAP ; + pPixmap->drawable.class = 0 ; + pPixmap->drawable.pScreen = pScreen ; + pPixmap->drawable.depth = depth ; + pPixmap->drawable.id = 0 ; + pPixmap->drawable.bitsPerPixel = ( depth == 1 ) ? 1 : 8 ; + pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER ; + pPixmap->drawable.x = 0 ; + pPixmap->drawable.y = 0 ; + pPixmap->drawable.width = width ; + pPixmap->drawable.height = height ; + pPixmap->devKind = size; + pPixmap->refcnt = 1 ; + size = height * pPixmap->devKind ; + pPixmap->devPrivate.ptr = (pointer) (((CARD8*)pPixmap) + + pScreen->totalPixmapSize); + bzero( (char *) pPixmap->devPrivate.ptr, size ) ; + pPixmap->usage_hint = usage_hint; + return pPixmap ; +} + +PixmapPtr +xf4bppCopyPixmap(pSrc) + register PixmapPtr pSrc; +{ + register PixmapPtr pDst; + int size; + + TRACE(("xf4bppCopyPixmap(pSrc=0x%x)\n", pSrc)) ; + size = pSrc->drawable.height * pSrc->devKind; + pDst = xalloc(sizeof(PixmapRec) + size); + if (!pDst) + return NullPixmap; + pDst->devPrivates = NULL; + pDst->drawable = pSrc->drawable; + pDst->drawable.id = 0; + pDst->drawable.serialNumber = NEXT_SERIAL_NUMBER; + pDst->devKind = pSrc->devKind; + pDst->refcnt = 1; + pDst->devPrivate.ptr = (pointer)(pDst + 1); + MOVE( (char *)pSrc->devPrivate.ptr, (char *)pDst->devPrivate.ptr, size ) ; + return pDst; +} diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcPolyPnt.c b/xorg-server/hw/xfree86/xf4bpp/ppcPolyPnt.c new file mode 100644 index 000000000..c61fd6d26 --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/ppcPolyPnt.c @@ -0,0 +1,143 @@ +/* + +Copyright (c) 1987 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 furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the 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. + + +Copyright IBM Corporation 1987,1988,1989 +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of IBM not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +*/ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include "xf4bpp.h" +#include "mfbmap.h" +#include "mfb.h" +#include "mi.h" +#include "scrnintstr.h" +#include "ppcGCstr.h" +#include "ibmTrace.h" + +void +xf4bppPolyPoint( pDrawable, pGC, mode, npt, pptInit ) +DrawablePtr pDrawable ; +GCPtr pGC ; +int mode ; /* Origin or Previous */ +int npt ; +xPoint *pptInit ; +{ +register xPoint *ppt ; +ppcPrivGC *devPriv ; +int alu ; +int nptTmp ; + +TRACE( ("xf4bppPolyPoint(0x%x,0x%x,%d,%d,0x%x)\n", + pDrawable, pGC, mode, npt, pptInit ) ) ; + +if ( pDrawable->type == DRAWABLE_PIXMAP ) { + if ( pGC->alu != GXnoop ) + miPolyPoint( pDrawable, pGC, mode, npt, pptInit ) ; + return ; +} + +devPriv = (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()); +if ( ( alu = devPriv->colorRrop.alu ) == GXnoop ) + return ; + +/* make pointlist origin relative */ +if ( mode == CoordModePrevious ) + for ( ppt = pptInit, nptTmp = npt ; --nptTmp ; ) { + ppt++ ; + ppt->x += (ppt-1)->x ; + ppt->y += (ppt-1)->y ; + } + +if ( pGC->miTranslate ) { + register int xorg = pDrawable->x ; + register int yorg = pDrawable->y ; + for ( ppt = pptInit, nptTmp = npt ; nptTmp-- ; ppt++ ) { + ppt->x += xorg ; + ppt->y += yorg ; + } +} + +{ + register RegionPtr pRegion = pGC->pCompositeClip ; + register unsigned long int fg = devPriv->colorRrop.fgPixel ; + register unsigned long int pm = devPriv->colorRrop.planemask ; + BoxRec box ; /* Scratch Space */ + + if ( ! REGION_NUM_RECTS(pRegion)) + return ; + + for ( ppt = pptInit ; npt-- ; ppt++ ) + if (POINT_IN_REGION(pDrawable->pScreen, pRegion, + ppt->x, ppt->y, &box)) + xf4bppFillSolid( (WindowPtr)pDrawable, + fg, alu, pm, ppt->x, ppt->y, 1, 1 ) ; +} + +return ; +} diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcQuery.c b/xorg-server/hw/xfree86/xf4bpp/ppcQuery.c new file mode 100644 index 000000000..d42360da5 --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/ppcQuery.c @@ -0,0 +1,46 @@ +/* + * Copyright IBM Corporation 1987,1988,1989 + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * +*/ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include "xf4bpp.h" + +void +xf4bppQueryBestSize +( + register int class, + register unsigned short *pwidth, + register unsigned short *pheight, + ScreenPtr pScreen +) +{ +if ( class == CursorShape ) + *pwidth = *pheight = 32 ; /* ppc's cursor max out at 32 by 32 */ +else /* either TileShape or StippleShape */ + /* Round Up To Nearest Multiple Of 8 -- We don't care what height they use */ + *pwidth = ( *pwidth + 0x7 ) & ~ 0x7 ; + +return ; +} diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcRslvC.c b/xorg-server/hw/xfree86/xf4bpp/ppcRslvC.c new file mode 100644 index 000000000..0337feb62 --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/ppcRslvC.c @@ -0,0 +1,177 @@ +/************************************************************ +Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this +software and its documentation for any purpose and without +fee is hereby granted, provided that the above copyright no- +tice appear in all copies and that both that copyright no- +tice and this permission notice appear in supporting docu- +mentation, and that the names of Sun or X Consortium +not be used in advertising or publicity pertaining to +distribution of the software without specific prior +written permission. Sun and X Consortium make no +representations about the suitability of this software for +any purpose. It is provided "as is" without any express or +implied warranty. + +SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- +NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- +ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR +PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH +THE USE OR PERFORMANCE OF THIS SOFTWARE. + +********************************************************/ + +/* + * Copyright IBM Corporation 1987,1988,1989 + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * +*/ + +/* Generic Color Resolution Scheme + * P. Shupak 12/31/87 + */ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include "xf4bpp.h" +#include "scrnintstr.h" + +/* + * New colormap routines that can support multiple Visual types. + */ + +static unsigned short defstaticpalette[16][3] = { + /* R G B */ + { 0x0000, 0x0000, 0x0000 }, /* black */ + { 0xFFFF, 0xFFFF, 0xFFFF }, /* white */ + { 0xAAAA, 0xAAAA, 0xAAAA }, /* grey */ + { 0x0000, 0x0000, 0xAAAA }, /* dark blue */ + { 0x0000, 0x0000, 0xFFFF }, /* medium blue */ + { 0x0000, 0xAAAA, 0xFFFF }, /* light blue */ + { 0x0000, 0xFFFF, 0xFFFF }, /* cyan */ + { 0x0000, 0xAAAA, 0x0000 }, /* dark green */ + { 0x0000, 0xFFFF, 0x0000 }, /* green */ + { 0xAAAA, 0xFFFF, 0x5555 }, /* pale green */ + { 0xAAAA, 0x5555, 0x0000 }, /* brown */ + { 0xFFFF, 0xAAAA, 0x0000 }, /* light brown */ + { 0xFFFF, 0xFFFF, 0x0000 }, /* yellow */ + { 0xAAAA, 0x0000, 0xAAAA }, /* purple */ + { 0xFFFF, 0x0000, 0xFFFF }, /* magenta */ + { 0xFFFF, 0x0000, 0x0000 }, /* red */ + }; + +Bool +xf4bppInitializeColormap(pmap) + register ColormapPtr pmap; +{ + register unsigned i; + register VisualPtr pVisual; + unsigned lim, maxent, shift; + + pVisual = pmap->pVisual; + lim = (1 << pVisual->bitsPerRGBValue) - 1; + shift = 16 - pVisual->bitsPerRGBValue; + maxent = pVisual->ColormapEntries - 1; + + switch( pVisual->class ) + { + case StaticGray: + for ( i = 0 ; i < maxent ; i++ ) { + pmap->red[i].co.local.red = + pmap->red[i].co.local.green = + pmap->red[i].co.local.blue = + ((((i * 65535) / maxent) >> shift) * 65535) / lim; + } + break; + case StaticColor: + for ( i = 0 ; i < 16 ; i++ ) { + pmap->red[i].co.local.red = (defstaticpalette[i][0]); + pmap->red[i].co.local.green = (defstaticpalette[i][1]); + pmap->red[i].co.local.blue = (defstaticpalette[i][2]); + } + break; + case GrayScale: + case PseudoColor: + for(i=0;i<=maxent;i++) { + int a,b,c; + a = i << 10; + b = i << 12; + c = i << 14; + pmap->red[i].co.local.red = a; + pmap->red[i].co.local.green = b; + pmap->red[i].co.local.blue = c; + } + break; + case TrueColor: + case DirectColor: + default: + ErrorF( "Unsupported Visual class %d\b", pVisual->class ); + return FALSE; + } + return TRUE; +} + +void +xf4bppResolveColor( pred, pgreen, pblue, pVisual ) +register unsigned short* pred ; +register unsigned short* pgreen ; +register unsigned short* pblue ; +register VisualPtr pVisual ; +{ + unsigned lim, maxent, shift; + + lim = (1 << pVisual->bitsPerRGBValue) - 1; + shift = 16 - pVisual->bitsPerRGBValue; + maxent = pVisual->ColormapEntries - 1; + + switch( pVisual->class ) + { + case StaticGray: + *pred = (30L * *pred + 59L * *pgreen + 11L * *pblue) / 100; + *pred = (((*pred * (maxent + 1)) >> 16) * 65535) / maxent; + *pblue = *pgreen = *pred = ((*pred >> shift) * 65535) / lim; + break; + case StaticColor: + break; + case GrayScale: + *pred = (30L * *pred + 59L * *pgreen + 11L * *pblue) / 100; + *pblue = *pgreen = *pred = ((*pred >> shift) * 65535) / lim; + break; + case PseudoColor: + /* rescale to rgb bits */ + *pred = ((*pred >> shift) * 65535) / lim; + *pgreen = ((*pgreen >> shift) * 65535) / lim; + *pblue = ((*pblue >> shift) * 65535) / lim; + break; + case TrueColor: + case DirectColor: + default: + ErrorF( "Unsupported Visual class %d\b", pVisual->class ); + } +} + diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcSetSp.c b/xorg-server/hw/xfree86/xf4bpp/ppcSetSp.c new file mode 100644 index 000000000..7659384e7 --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/ppcSetSp.c @@ -0,0 +1,319 @@ +/* + * Copyright IBM Corporation 1987,1988,1989 + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * +*/ + +/*********************************************************** + +Copyright (c) 1987 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 +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the 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. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include <stdlib.h> + +#include "xf4bpp.h" +#include "OScompiler.h" +#include "mfbmap.h" +#include "mfb.h" +#include "servermd.h" + +/* SetScanline -- copies the bits from psrc to the drawable starting at + * (xStart, y) and continuing to (xEnd, y). xOrigin tells us where psrc + * starts on the scanline. (I.e., if this scanline passes through multiple + * boxes, we may not want to start grabbing bits at psrc but at some offset + * further on.) + */ +static void +ppcSetScanline +( + register int pixCount, /* width of scanline in bits */ + register char *psrc, + register unsigned char *pdst, /* where to put the bits */ + register int pm, /* plane mask */ + const int alu /* raster op */ +) +{ +register int npm = ~pm ; /* inverted plane mask */ +register char tmpx ; + +pm &= 0x0F; npm &= 0x0F; /* GJA */ + +switch ( alu ) { + case GXclear: /* 0x0 Zero 0 */ + while ( pixCount-- ) + *pdst++ &= npm ; + break ; + case GXand: /* 0x1 src AND dst */ + while ( pixCount-- ) + *pdst++ &= *psrc++ | npm ; + break ; + case GXandReverse: /* 0x2 src AND NOT dst */ + for ( ; pixCount-- ; pdst++, psrc++ ) { + tmpx = *pdst; + *pdst = ( tmpx & npm ) | ( pm & *psrc & ~tmpx ) ; + } + break ; + case GXcopy: /* 0x3 src */ + for ( ; pixCount-- ; pdst++, psrc++ ) + *pdst = ( *pdst & npm ) | ( pm & *psrc ) ; + break ; + case GXandInverted: /* 0x4 NOT src AND dst */ + while ( pixCount-- ) + *pdst++ &= npm | ~*psrc++ ; + break ; + case GXnoop: /* 0x5 dst */ + break ; + case GXxor: /* 0x6 src XOR dst */ + while ( pixCount-- ) + *pdst++ ^= pm & *psrc++ ; + break ; + case GXor: /* 0x7 src OR dst */ + while ( pixCount-- ) + *pdst++ |= *psrc++ & pm ; + break ; + case GXnor: /* 0x8 NOT src AND NOT dst */ + for ( ; pixCount-- ; pdst++, psrc++ ) { + tmpx = *pdst; + *pdst = ( tmpx & npm ) | ( pm & ~( tmpx | *psrc ) ) ; + } + break ; + case GXequiv: /* 0x9 NOT src XOR dst */ + while ( pixCount-- ) + *pdst++ ^= pm & ~ *psrc++ ; + break ; + case GXorReverse: /* 0xb src OR NOT dst */ + for ( ; pixCount-- ; pdst++, psrc++ ) { + tmpx = *pdst; + *pdst = ( tmpx & npm ) | ( pm & ( *psrc | ~tmpx ) ) ; + } + break ; + case GXinvert: /* 0xa NOT dst */ + while ( pixCount-- ) + *pdst++ ^= pm ; + break ; + case GXcopyInverted: /* 0xc NOT src */ + for ( ; pixCount-- ; pdst++, psrc++ ) + *pdst = ( *pdst & npm ) | ( pm & ~ *psrc ) ; + break ; + case GXorInverted: /* 0xd NOT src OR dst */ + while ( pixCount-- ) + *pdst++ |= pm & ~ *psrc++ ; + break ; + case GXnand: /* 0xe NOT src OR NOT dst */ + for ( ; pixCount-- ; pdst++, psrc++ ) { + tmpx = *pdst; + *pdst = ( tmpx & npm ) | ( pm & ~( tmpx & *psrc ) ) ; + } + break ; + case GXset: /* 0xf 1 */ + while ( pixCount-- ) + *pdst++ |= pm ; + break ; + default: + ErrorF( "ppcSetScanLine: bad alu value == 0x%02X\n", alu ) ; + break ; +} + +return ; +} + +/* SetSpans -- for each span copy pwidth[i] bits from psrc to pDrawable at + * ppt[i] using the raster op from the GC. If fSorted is TRUE, the scanlines + * are in increasing Y order. + * Source bit lines are server scanline padded so that they always begin + * on a word boundary. + */ +void +xf4bppSetSpans( pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted ) + register DrawablePtr pDrawable ; + GCPtr pGC ; + char *psrc ; + register DDXPointPtr ppt ; + int *pwidth ; + int nspans ; + int fSorted ; +{ + unsigned char *pdstBase = NULL; /* start of dst bitmap */ + int widthDst = 0; /* width of bitmap in words */ + register BoxPtr pbox, pboxLast, pboxTest ; + register DDXPointPtr pptLast ; + RegionPtr prgnDst ; + register int width ; + int xStart, xEnd ; + int yMax ; + int alu ; + int pm ; + + /* allow for 1-deep windows on nfb machines (eg apa8, aed) */ + if ( ( pDrawable->depth == 1 ) && ( pDrawable->type == DRAWABLE_PIXMAP ) ) { + mfbSetSpans( pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted ) ; + return ; + } + + if ( !( pm = pGC->planemask & ~( (~0) << pDrawable->depth ) ) + || ( ( alu = pGC->alu ) == GXnoop ) ) + return ; + + prgnDst = pGC->pCompositeClip ; + + if ( ! REGION_NUM_RECTS(prgnDst)) + return ; + + pboxLast = ( pbox = REGION_RECTS(prgnDst) ) + REGION_NUM_RECTS(prgnDst); + pptLast = ppt + nspans ; + + if ( pDrawable->type == DRAWABLE_WINDOW ) { + yMax = (int) pDrawable->height + pDrawable->y ; + } + else { + pdstBase = (unsigned char *) ( (PixmapPtr) pDrawable )->devPrivate.ptr ; + widthDst = (int) ( (PixmapPtr) pDrawable )->devKind ; + yMax = pDrawable->height ; + } + + if ( fSorted ) { + /* scan lines sorted in ascending order. Because they are sorted, we + * don't have to check each scanline against each clip box. We can be + * sure that this scanline only has to be clipped to boxes at or after the + * beginning of this y-band + */ + for ( pboxTest = pbox ; + ( ppt < pptLast ) && ( ppt->y < yMax ) ; + ppt++, pwidth++, + psrc += PixmapBytePad( width, pDrawable->depth ) ) { + width = *pwidth ; + for ( pbox = pboxTest ; + pbox < pboxLast ; + pbox++ ) { + if ( pbox->y2 <= ppt->y ) { + /* clip box is before scanline */ + pboxTest = pbox + 1 ; + } + else if ( ( pbox->y1 > ppt->y ) + || ( pbox->x1 > ppt->x + width ) ) + break ; /* scanline before clip box or left of clip box */ + else if ( pbox->x2 > ppt->x ) { + /* some of the scanline is in the current clip box */ + xStart = MAX( pbox->x1, ppt->x ) ; + xEnd = MIN( ppt->x + width, pbox->x2 ) ; + if ( pDrawable->type == DRAWABLE_PIXMAP ) + ppcSetScanline( xEnd - xStart, + psrc + ( xStart - ppt->x ), + pdstBase + xStart + + ( ppt->y * widthDst ), + pm, alu ) ; + else + xf4bppDrawColorImage( (WindowPtr)pDrawable, + xStart, ppt->y, xEnd - xStart, 1, + (unsigned char *)psrc + ( xStart - ppt->x ), + xEnd - xStart, alu, pm ) ; + if ( ppt->x + width <= pbox->x2 ) + break ; /* End of the line, as it were */ + } + } + /* We've tried this line against every box ; it must be outside them + * all. move on to the next point */ + } + } + else { + /* scan lines not sorted. We must clip each line against all the boxes */ + for ( ; + ppt < pptLast ; + ppt++, pwidth++, + psrc += PixmapBytePad( width, pDrawable->depth ) ) { + width = *pwidth ; + if ( ppt->y >= 0 && ppt->y < yMax ) { + for ( pbox = REGION_RECTS(prgnDst) ; pbox < pboxLast ; pbox++ ) { + if ( pbox->y1 > ppt->y ) + break ; /* rest of clip region is above this scanline */ + else if ( ( pbox->y2 > ppt->y ) + && ( pbox->x1 <= ppt->x + width ) + && ( pbox->x2 > ppt->x ) ) { + xStart = MAX( pbox->x1, ppt->x ) ; + xEnd = MIN( pbox->x2, ppt->x + width ) ; + if ( pDrawable->type == DRAWABLE_PIXMAP ) + ppcSetScanline( xEnd - xStart, + psrc + ( xStart - ppt->x ), + /* ^ GJA */ + ( ( pdstBase + + ( ppt->y * widthDst ) ) + + xStart ), + pm, alu ) ; + else /* pDrawable->type == DRAWABLE_WINDOW */ + xf4bppDrawColorImage( (WindowPtr)pDrawable, + xStart, ppt->y, xEnd - xStart, 1, + (unsigned char *)psrc + ( xStart - ppt->x ), + /* GJA ^ */ + xEnd - xStart, alu, pm ) ; + } + + } + } + } + } + return ; +} diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcSpMcro.h b/xorg-server/hw/xfree86/xf4bpp/ppcSpMcro.h new file mode 100644 index 000000000..655a883e5 --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/ppcSpMcro.h @@ -0,0 +1,43 @@ +/* + * Copyright IBM Corporation 1987,1988,1989 + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * +*/ + +/* This screwy macro is used in all the spans routines and you find + it all over the place, so it is a macro just to tidy things up. +*/ + +#define SETSPANPTRS(IN,N,IPW,PW,IPPT,PPT,FPW,FPPT,FSORT) \ + { \ + N = IN * miFindMaxBand(pGC->pCompositeClip); \ + if(!(PW = (int *)xalloc(N * sizeof(int)))) \ + return; \ + if(!(PPT = (DDXPointRec *)xalloc(N * sizeof(DDXPointRec)))) \ + { \ + free(PW); \ + return; \ + } \ + FPW = PW; \ + FPPT = PPT; \ + N = miClipSpans(pGC->pCompositeClip, IPPT, IPW, IN, \ + PPT, PW, FSORT); \ + } + diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcWinFS.c b/xorg-server/hw/xfree86/xf4bpp/ppcWinFS.c new file mode 100644 index 000000000..1522afd9e --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/ppcWinFS.c @@ -0,0 +1,280 @@ +/* + * Copyright IBM Corporation 1987,1988,1989 + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * +*/ + +/****************************************************************** +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include "xf4bpp.h" +#include "mfbmap.h" +#include "mfb.h" +#include "mi.h" +#include "mispans.h" +#include "ppcGCstr.h" +#include "ppcSpMcro.h" +#include "ibmTrace.h" + +#define LeftMostBitInScreenLongWord SCRLEFT( 0xFFFFFFFF, 31 ) +/* +********** ********** ********** ********** ********** ********** ********** + these routines all clip. they assume that anything that has called +them has already translated the points (i.e. pGC->miTranslate is +non-zero, which is howit gets set in mfbCreateGC().) + + the number of new scanlines created by clipping == +MaxRectsPerBand * nSpans. +********** ********** ********** ********** ********** ********** ********** +*/ + +void +xf4bppSolidWindowFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) + DrawablePtr pDrawable ; + GCPtr pGC ; + int nInit ; /* number of spans to fill */ + DDXPointPtr pptInit ; /* pointer to list of start points */ + int *pwidthInit ; /* pointer to list of n widths */ + int fSorted ; +{ + register unsigned long int pm ; + register unsigned long int fg ; + register int alu ; + /* next three parameters are post-clip */ + int n ; /* number of spans to fill */ + register DDXPointPtr ppt ; /* pointer to list of start points */ + register int *pwidth ; /* pointer to list of n widths */ + int *pwidthFree ; /* copies of the pointers to free */ + DDXPointPtr pptFree ; + + TRACE( ( "xf4bppSolidWindowFS(pDrawable=0x%x,pGC=0x%x,nInit=%d,pptInit=0x%x,pwidthInit=0x%x,fSorted=%d)\n", + pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ) ; + + if ( pDrawable->type != DRAWABLE_WINDOW ) { + ErrorF( "xf4bppSolidWindowFS: drawable is not a window\n") ; + return ; + } + + if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop ) + return ; + + n = nInit * miFindMaxBand( pGC->pCompositeClip ) ; + if ( !( pwidthFree = (int *) xalloc( n * sizeof( int ) ) ) ) + return ; + pwidth = pwidthFree ; + + if ( !( pptFree = (DDXPointRec *) + xalloc( n * sizeof( DDXPointRec ) ) ) ) { + xfree( pwidth ) ; + return ; + } + ppt = pptFree ; + + n = miClipSpans( pGC->pCompositeClip, pptInit, pwidthInit, nInit, + ppt, pwidth, fSorted ) ; + + pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ; + fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ; + + for ( ; n-- ; ppt++, pwidth++ ) + if ( *pwidth ) + xf4bppFillSolid( (WindowPtr)pDrawable, + fg, alu, pm, ppt->x, ppt->y, *pwidth, 1 ) ; + + xfree( pptFree ) ; + xfree( pwidthFree ) ; + return ; +} + +void +xf4bppStippleWindowFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) +DrawablePtr pDrawable ; +register GC *pGC ; +int nInit ; /* number of spans to fill */ +DDXPointPtr pptInit ; /* pointer to list of start points */ +int *pwidthInit ; /* pointer to list of n widths */ +int fSorted ; +{ + register unsigned long int pm ; + register unsigned long int fg ; + register int alu ; + /* next three parameters are post-clip */ + int n ; /* number of spans to fill */ + register DDXPointPtr ppt ; /* pointer to list of start points */ + register int *pwidth ; /* pointer to list of n widths */ + PixmapPtr pTile ; /* pointer to tile we want to fill with */ + int xSrc ; + int ySrc ; + int *pwidthFree ; /* copies of the pointers to free */ + DDXPointPtr pptFree ; + + TRACE( ( "xf4bppStippleWindowFS(pDrawable=0x%x,pGC=0x%x,nInit=%d,pptInit=0x%x,pwidthInit=0x%x,fSorted=%d)\n", + pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ) ; + + if ( pDrawable->type != DRAWABLE_WINDOW ) { + ErrorF( "xf4bppStippleWindowFS: drawable is not a window\n" ) ; + return ; + } + + if ( pGC->stipple->drawable.depth != 1 ) { + ErrorF("ppcStippleFS: bad depth\ntype = %d, depth = %d\n", + pDrawable->type, pGC->stipple->drawable.depth ) ; + return ; + } + + if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop ) + return ; + + SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit, + pptFree, pwidth, ppt, fSorted ) ; + + pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ; + fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ; + + xSrc = pGC->patOrg.x + pDrawable->x ; + ySrc = pGC->patOrg.y + pDrawable->y ; + pTile = pGC->stipple ; + + for ( ; n-- ; ppt++, pwidth++ ) + xf4bppFillStipple( (WindowPtr)pDrawable, pTile, fg, alu, pm, + ppt->x, ppt->y, *pwidth, 1, xSrc, ySrc ) ; + + xfree( pptFree ) ; + xfree( pwidthFree ) ; + + return ; +} + +void +xf4bppOpStippleWindowFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) +DrawablePtr pDrawable ; +register GC *pGC ; +int nInit ; /* number of spans to fill */ +DDXPointPtr pptInit ; /* pointer to list of start points */ +int *pwidthInit ; /* pointer to list of n widths */ +int fSorted ; +{ + register DDXPointPtr ppt ; /* pointer to list of start points */ + register int *pwidth ; /* pointer to list of n widths */ + int n ; /* number of spans to fill */ + int xSrc ; + int ySrc ; + unsigned long int pm ; + unsigned long int fg, bg ; + int alu ; + int *pwidthFree ; /* copies of the pointers to free */ + DDXPointPtr pptFree ; + + TRACE( ( "xf4bppOpStippleWindowFS(pDrawable=0x%x,pGC=0x%x,nInit=%d,pptInit=0x%x,pwidthInit=0x%x,fSorted=%d)\n", + pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ) ; + + if ( pGC->stipple->drawable.depth != 1 ) { + ErrorF( "xf4bppOpStippleWindowFS: bad depth\ntype = %d, depth = %d\n", + pDrawable->type, pGC->stipple->drawable.depth ) ; + return ; + } + + if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop ) + return ; + + SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit, + pptFree, pwidth, ppt, fSorted ) ; + + pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ; + fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ; + bg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.bgPixel ; + + xSrc = pGC->patOrg.x + pDrawable->x ; + ySrc = pGC->patOrg.y + pDrawable->y ; + + for ( ; n-- ; ppt++, pwidth++ ) + xf4bppOpaqueStipple( (WindowPtr)pDrawable, pGC->stipple, fg, bg, alu, pm, + ppt->x, ppt->y, *pwidth, 1, xSrc, ySrc ) ; + + xfree( pptFree ) ; + xfree( pwidthFree ) ; + return ; +} + +void +xf4bppTileWindowFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) +DrawablePtr pDrawable ; +register GC *pGC ; +int nInit ; /* number of spans to fill */ +DDXPointPtr pptInit ; /* pointer to list of start points */ +int *pwidthInit ; /* pointer to list of n widths */ +int fSorted ; +{ + /* next three parameters are post-clip */ + register DDXPointPtr ppt ; /* pointer to list of start points */ + register int *pwidth ; /* pointer to list of n widths */ + int n ; /* number of spans to fill */ + unsigned char pm ; + int alu ; + int xSrc ; + int ySrc ; + int *pwidthFree ; /* copies of the pointers to free */ + DDXPointPtr pptFree ; + + TRACE( ( "xf4bppTileWindowFS(pDrawable=0x%x,pGC=0x%x,nInit=%d,pptInit=0x%x,pwidthInit=0x%x,fSorted=%d)\n", + pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ) ; + + if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop ) + return ; + + SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit, + pptFree, pwidth, ppt, fSorted ) ; + + xSrc = pGC->patOrg.x + pDrawable->x ; + ySrc = pGC->patOrg.y + pDrawable->y ; + pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ; + + for ( ; n-- ; ppt++, pwidth++ ) + xf4bppTileRect( (WindowPtr)pDrawable, pGC->tile.pixmap, alu, pm, + ppt->x, ppt->y, *pwidth, 1, xSrc, ySrc ) ; + + xfree( pptFree ) ; + xfree( pwidthFree ) ; + return ; +} diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcWindow.c b/xorg-server/hw/xfree86/xf4bpp/ppcWindow.c new file mode 100644 index 000000000..6165e04b6 --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/ppcWindow.c @@ -0,0 +1,220 @@ +/* + +Copyright (c) 1987 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 furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the 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. + + +Copyright IBM Corporation 1987,1988,1989 +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of IBM not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +*/ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include <stdlib.h> + +#include "xf4bpp.h" +#include "mfbmap.h" +#include "mfb.h" +#include "scrnintstr.h" +#include "ibmTrace.h" + +/* + xf4bppCopyWindow copies only the parts of the destination that are +visible in the source. +*/ + +void +xf4bppCopyWindow(pWin, ptOldOrg, prgnSrc) + register WindowPtr pWin ; + DDXPointRec ptOldOrg ; + RegionPtr prgnSrc ; +{ + RegionPtr prgnDst ; + register BoxPtr pbox ; + register int dx, dy ; + register int nbox ; + register int pm ; + + BoxPtr pboxTmp, pboxNext, pboxBase, pboxNew ; + /* temporaries for shuffling rectangles */ + + TRACE(("xf4bppCopyWindow(pWin= 0x%x, ptOldOrg= 0x%x, prgnSrc= 0x%x)\n", pWin, ptOldOrg, prgnSrc)) ; + + + dx = ptOldOrg.x - pWin->drawable.x ; + dy = ptOldOrg.y - pWin->drawable.y ; + REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy); + + prgnDst = REGION_CREATE(pWin->drawable.pScreen, NULL, 1); + REGION_INTERSECT(pWin->drawable.pScreen, prgnDst, + &pWin->borderClip, prgnSrc); + + if ( !( nbox = REGION_NUM_RECTS(prgnDst) ) ) + return; + + pbox = REGION_RECTS(prgnDst); + + pboxNew = 0 ; + if ( nbox > 1 ) { + if ( dy < 0 ) { + if ( dx > 0 ) { + /* walk source bottom to top */ + /* keep ordering in each band, reverse order of bands */ + if ( !( pboxNew = + (BoxPtr) xalloc( sizeof( BoxRec ) * nbox ) ) ) + return ; + pboxBase = pboxNext = pbox+nbox - 1 ; + while ( pboxBase >= pbox ) { + while ( ( pboxNext >= pbox ) + && ( pboxBase->y1 == pboxNext->y1 ) ) + pboxNext-- ; + pboxTmp = pboxNext + 1 ; + while ( pboxTmp <= pboxBase ) + *pboxNew++ = *pboxTmp++ ; + pboxBase = pboxNext ; + } + pboxNew -= nbox ; + pbox = pboxNew ; + } + else { /* dx <= 0 */ + /* we can just reverse the entire list in place */ + /* Do three-position swaps */ + BoxRec tmpBox ; + + pboxBase = pbox ; + pboxNext = pbox + nbox - 1 ; + while ( pboxBase < pboxNext ) { + /* ****** Warning Structure Assignment !! ****** */ + tmpBox = *pboxBase ; + *pboxBase = *pboxNext ; + *pboxNext = tmpBox ; + pboxBase++ ; + pboxNext-- ; + } + } + } + else if ( dx < 0 ) { + /* walk source right to left */ + /* reverse order of rects in each band */ + if ( !( pboxNew = (BoxPtr)xalloc(sizeof(BoxRec) * nbox) ) ) + return ; + pboxBase = pboxNext = pbox ; + while (pboxBase < pbox+nbox) + { + while ((pboxNext < pbox+nbox) && + (pboxNext->y1 == pboxBase->y1)) + pboxNext++ ; + pboxTmp = pboxNext ; + while (pboxTmp != pboxBase) + *pboxNew++ = *--pboxTmp ; + pboxBase = pboxNext ; + } + pboxNew -= nbox ; + pbox = pboxNew ; + } + } /* END if nbox > 1 */ + + /* + * call blit several times, the parms are: + * blit( alu,rplanes, wplanes, srcx, srcy, destx, desty, width, height ) ; + */ + + pm = ( 1 << pWin->drawable.depth ) - 1 ; + for ( ; nbox-- ; pbox++ ) + xf4bppBitBlt( pWin, GXcopy, pm, + pbox->x1 + dx, pbox->y1 + dy, + pbox->x1, pbox->y1, + pbox->x2 - pbox->x1, pbox->y2 - pbox->y1) ; + + /* free up stuff */ + if ( pboxNew ) + xfree( pboxNew ) ; + + REGION_DESTROY(pWin->drawable.pScreen, prgnDst); +} + +Bool xf4bppPositionWindow(pWin, x, y) +register WindowPtr pWin ; +register int x, y ; +{ + return TRUE ; +} + +Bool +xf4bppDestroyWindow(pWin) +register WindowPtr pWin ; +{ +return pWin ? TRUE : FALSE ; +} + +/* As The Name Says -- Used For ega, vga and apa8c */ +Bool +xf4bppCreateWindowForXYhardware(pWin) +register WindowPtr pWin ; +{ + TRACE(("xf4bppCreateWindowForXYhardware (pWin= 0x%x)\n", pWin)); + + return TRUE; +} diff --git a/xorg-server/hw/xfree86/xf4bpp/vgaBitBlt.c b/xorg-server/hw/xfree86/xf4bpp/vgaBitBlt.c new file mode 100644 index 000000000..2e89f43b7 --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/vgaBitBlt.c @@ -0,0 +1,749 @@ +/* GJA -- span move routines */ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include "xf4bpp.h" +#include "OScompiler.h" +#include "vgaReg.h" +#include "vgaVideo.h" + +#include "xf86str.h" /* for pScrn->vtSema */ +extern ScrnInfoPtr *xf86Screens; + +#ifndef PC98_EGC /* not PC98_EGC */ +/* NOTE: It seems that there is no way to program the VGA to copy just + * a part of a byte in the smarter modes. Therefore we copy the boundaries + * plane by plane. + */ +#define WORDSZ 8 + /* The fast blit code requires WORDSZ = 8 for its read-modify write cycle. + * Therefore, we do not fully implement the other options. + */ +#define HIGHPLANEMASK 0x08 +#define HIGHPLANEINDEX 3 + +/* Of course, we want the following anyway: + * (Yes, they're identical now.) + */ +#define SMEM(x,y) ( VIDBASE(pWin) + (y) * BYTES_PER_LINE(pWin) + (x) ) +#define DMEM(x,y) ( VIDBASE(pWin) + (y) * BYTES_PER_LINE(pWin) + (x) ) + +#define WORD8 unsigned char +#define LW8 BYTES_PER_LINE(pWin) /* Line width */ +#define WSHIFT8 0x3 +#define WMASK8 0x07 +/* NOTE: lmask[8] matters. It must be different from lmask[0] */ +static unsigned char lmasktab[] = { + 0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE, 0xFF +} ; +static unsigned char rmasktab[] = { + 0xFF, 0x7F, 0x3F, 0x1F, 0x0F, 0x07, 0x03, 0x01, 0x00 +} ; + +#define LMASK8(n) lmasktab[n] +#define RMASK8(n) rmasktab[n] +#define SWAPB8(x) (x) + +#if (WORDSZ == 8) + +#define WORD WORD8 +#define LW LW8 +#define WSHIFT WSHIFT8 +#define WMASK WMASK8 + +#define LMASK(n) LMASK8(n) +#define RMASK(n) RMASK8(n) +#define SWAPB(x) SWAPB8(x) + +#endif /* WORDSZ == 8 */ + +#define DO_ALU(dst,src,mask,alu) {\ + int _ndst, _odst; _odst = dst; \ + switch ( alu ) { \ + case GXclear: \ + _ndst = 0; break; \ + case GXand: \ + _ndst = src & _odst; break; \ + case GXandReverse: \ + _ndst = src & ~ _odst; break; \ + case GXcopy: \ + _ndst = src; break; \ + case GXandInverted: \ + _ndst = ~ src & _odst; break; \ + default: \ + case GXnoop: \ + _ndst = _odst; break; \ + case GXxor: \ + _ndst = src ^ _odst; break; \ + case GXor: \ + _ndst = src | _odst; break; \ + case GXnor: \ + _ndst = ~ src & ~ _odst; break; \ + case GXequiv: \ + _ndst = ~ src ^ _odst; break; \ + case GXinvert: \ + _ndst = ~ _odst; break; \ + case GXorReverse: \ + _ndst = src | ~ _odst; break; \ + case GXcopyInverted: \ + _ndst = ~ src; break; \ + case GXorInverted: \ + _ndst = ~ src | _odst; break; \ + case GXnand: \ + _ndst = ~ src | ~ _odst; break; \ + case GXset: \ + _ndst = ~0; break; \ + } \ + dst = (_odst & ~(mask)) | (_ndst & (mask)); \ + } + +static void aligned_blit( + WindowPtr, int, int, int, int, int, int, int, int +); + +static void aligned_blit_center( + WindowPtr, int, int, int, int, int, int +); + +static void shift( + WindowPtr, int, int, int, int, int, int, int +); + +static void shift_thin_rect( + WindowPtr, int, int, int, int, int, int, int +); + +static void shift_center( + WindowPtr, int, int, int, int, int, int, int +); + +void xf4bppBitBlt(pWin,alu,writeplanes,x0,y0,x1,y1,w,h) +WindowPtr pWin; /* GJA */ +int alu; +int writeplanes; /* planes */ +int x0, y0, x1, y1, w, h; +{ + IOADDRESS REGBASE; + int plane, bit; + + if ( !w || !h ) return; + + if ( ! xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) { + xf4bppOffBitBlt(pWin,alu,writeplanes,x0,y0,x1,y1,w,h); + return; + } + + REGBASE = + xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase + 0x300; + + /* 0x7, not WMASK: it is hardware dependant */ + if ( ((x0 - x1) & 0x7) || (alu != GXcopy) ) { + /* Use slow copy */ + SetVideoGraphics(Enb_Set_ResetIndex, 0); /* All from CPU */ + SetVideoGraphics(Bit_MaskIndex, 0xFF); /* All bits */ + SetVideoGraphics(Graphics_ModeIndex, 0); /* Write mode 0 */ + SetVideoGraphics(Data_RotateIndex, 0); /* Don't rotate, replace */ + + for ( plane = HIGHPLANEMASK, bit = HIGHPLANEINDEX ; + plane ; plane >>= 1, bit-- ) + { + + if ( writeplanes & plane) { + SetVideoGraphics(Read_Map_SelectIndex, bit); + SetVideoSequencer(Mask_MapIndex, plane); + + shift(pWin,x0,x1,y0,y1,w,h,alu); + } + } + } else { + aligned_blit(pWin,x0,x1,y0,y1,w,h,alu,writeplanes); + } +} + +/* Copy a span a number of places to the right. + */ +static void +shift(pWin,x0,x1,y0,y1,w,h,alu) +WindowPtr pWin; /* GJA */ +int x0; /* left edge of source */ +int x1; /* left edge of target */ +int y0; +int y1; +int w; /* length of source, and of target */ +int h; +int alu; +{ + if ( ((x1 & WMASK) + w) <= WORDSZ ) { + shift_thin_rect(pWin,x0,x1,y0,y1,w,h,alu); + } else if ( x1 > x0 ) { /* Shift right: start right */ + int l1 = x1 & WMASK, r1 = (x1 + w) & WMASK; + + if ( r1 ) /* right edge */ + shift_thin_rect(pWin,x0+w-r1,x1+w-r1,y0,y1,r1,h,alu); + shift_center(pWin,x0,x1,y0,y1,w,h,alu); + if ( l1 ) /* left edge */ + shift_thin_rect(pWin,x0,x1,y0,y1,(WORDSZ-l1),h,alu); + } else { + int l1 = x1 & WMASK, r1 = (x1 + w) & WMASK; + + if ( l1 ) /* left edge */ + shift_thin_rect(pWin,x0,x1,y0,y1,(WORDSZ-l1),h,alu); + shift_center(pWin,x0,x1,y0,y1,w,h,alu); + if ( r1 ) /* right edge */ + shift_thin_rect(pWin,x0+w-r1,x1+w-r1,y0,y1,r1,h,alu); + } +} + +/* The whole rectangle is so thin that it fits in one byte written */ +static void +shift_thin_rect(pWin,x0,x1,y0,y1,w,h,alu) +WindowPtr pWin; /* GJA */ +int x0; /* left edge of source */ +int x1; /* left edge of target */ +int y0; +int y1; +int w; /* length of source, and of target */ +int h; +int alu; +{ + int l0 = x0 & WMASK; /* Left edge of source, as bit */ + int l1 = x1 & WMASK; /* Left edge of target, as bit */ + int L0 = x0 >> WSHIFT; /* Left edge of source, as byte */ + int L1 = x1 >> WSHIFT; /* Left edge of target, as byte */ + int pad; + int htmp; + int mask; + int tmp; + int bs; + + volatile unsigned char *sp, *dp; + + mask = RMASK(l1) & LMASK(l1+w); + bs = (x1 - x0) & WMASK; + + if ( y1 > y0 ) { /* Move down, start at the bottom */ + pad = - BYTES_PER_LINE(pWin); + sp = SMEM(L0,y0+h-1); + dp = DMEM(L1,y1+h-1); + } else { /* Move up, start at the top */ + pad = BYTES_PER_LINE(pWin); + sp = SMEM(L0,y0); + dp = DMEM(L1,y1); + } + + if ( l0+w > WORDSZ ) { + /* Need two bytes */ + for ( htmp = h ; htmp ; htmp-- ) { + tmp = (sp[0] << (WORDSZ - bs)); + sp++; + tmp |= (sp[0] >> bs); + sp--; + DO_ALU(dp[0],tmp,mask,alu); + dp += pad; + sp += pad; + } + } else if ( l0 <= l1 ) { + /* Need one byte, shifted right */ + for ( htmp = h ; htmp ; htmp-- ) { + tmp = (sp[0] >> bs); + DO_ALU(dp[0],tmp,mask,alu); + dp += pad; + sp += pad; + } + } else { + /* Need one byte, shifted left */ + for ( htmp = h ; htmp ; htmp-- ) { + tmp = (sp[0] << (WORDSZ - bs)); + DO_ALU(dp[0],tmp,mask,alu); + dp += pad; + sp += pad; + } + } +} + +static void +shift_center(pWin,x0,x1,y0,y1,w,h,alu) +WindowPtr pWin; /* GJA */ +int x0; /* left edge of source */ +int x1; /* left edge of target */ +int y0; +int y1; +int w; /* length of source, and of target */ +int h; +int alu; +{ + int l1 = x1 & WMASK; /* Left edge of target, as bit */ + int r1 = (x1 + w) & WMASK; /* Right edge of target, as bit */ + int pad; + int htmp, wtmp; /* Temporaries for indices over height and width */ + volatile unsigned char tmp; /* Temporary result of the shifts */ + int bs; + int rem; /* Remaining bits; temporary in loop */ + int bytecnt; + + volatile unsigned char *sp, *dp; + + bs = (x1 - x0) & WMASK; + + if ( l1 ) { + bytecnt = (w - (WORDSZ - l1) - r1) >> WSHIFT; + sp = SMEM( ((x0 + (WORDSZ - l1)) >> WSHIFT), y0); + dp = DMEM( ((x1 + (WORDSZ - l1)) >> WSHIFT), y1); + } else { + bytecnt = (w - r1) >> WSHIFT; + sp = SMEM( (x0 >> WSHIFT), y0); + dp = DMEM( (x1 >> WSHIFT), y1); + } + + if ( y1 > y0 ) { /* Move down, start at the bottom */ + if ( x1 > x0 ) { /* Move right, start right */ + pad = - BYTES_PER_LINE(pWin) + bytecnt; + sp += BYTES_PER_LINE(pWin) * (h - 1) + bytecnt - 1; + dp += BYTES_PER_LINE(pWin) * (h - 1) + bytecnt - 1; + } else { /* Move left, start left */ + pad = - BYTES_PER_LINE(pWin) - bytecnt; + sp += BYTES_PER_LINE(pWin) * (h - 1); + dp += BYTES_PER_LINE(pWin) * (h - 1); + } + } else { /* Move up, start at the top */ + if ( x1 > x0 ) { /* Move right, start right */ + pad = BYTES_PER_LINE(pWin) + bytecnt; + sp += bytecnt - 1; + dp += bytecnt - 1; + } else { /* Move left, start left */ + pad = BYTES_PER_LINE(pWin) - bytecnt; + sp += 0; + dp += 0; + } + } + + if ( x1 > x0 ) { /* Move right, start right */ + if ( bs == 0 ) { /* No shift. Need one byte only */ + for ( htmp = h ; htmp ; htmp-- ) { + for ( wtmp = bytecnt ; wtmp ; wtmp-- ) { + tmp = sp[0]; + DO_ALU(dp[0],tmp,~0,alu); + dp--; + sp--; + } + dp += pad; + sp += pad; + } + } else { + for ( htmp = h ; htmp ; htmp-- ) { + if ( bytecnt ) { + sp++; + rem = sp[0]; + sp--; + for ( wtmp = bytecnt ; wtmp ; wtmp-- ) { + tmp = (rem >> bs); + rem = sp[0]; + tmp |= (rem << (WORDSZ - bs)) ; + DO_ALU(dp[0],tmp,~0,alu); + dp--; + sp--; + } + } + dp += pad; + sp += pad; + } + } + } else { /* x1 <= x0 */ /* Move left, start left */ + if ( bs == 0 ) { /* No shift. Need one byte only */ + for ( htmp = h ; htmp ; htmp-- ) { + for ( wtmp = bytecnt ; wtmp ; wtmp-- ) { + tmp = sp[0]; + DO_ALU(dp[0],tmp,~0,alu); + dp++; + sp++; + } + dp += pad; + sp += pad; + } + } else { + for ( htmp = h ; htmp ; htmp-- ) { + if ( bytecnt ) { + rem = sp[0]; + for ( wtmp = bytecnt ; wtmp ; wtmp-- ) { + tmp = (rem << (WORDSZ - bs)); + sp++; + rem = sp[0]; + sp--; + tmp |= (rem >> bs); + DO_ALU(dp[0],tmp,~0,alu); + dp++; + sp++; + } + } + dp += pad; + sp += pad; + } + } + } +} + +/* Copy a rectangle. + */ +static void +aligned_blit(pWin,x0,x1,y0,y1,w,h,alu,planes) +WindowPtr pWin; /* GJA */ +int x0; /* left edge of source */ +int x1; /* left edge of target */ +int y0; +int y1; +int w; /* length of source, and of target */ +int h; +int alu; +int planes; +{ + IOADDRESS REGBASE = + xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase + 0x300; + int plane, bit; + + if ( ((x1 & WMASK) + w) <= WORDSZ ) { + SetVideoGraphics(Enb_Set_ResetIndex, 0); /* All from CPU */ + SetVideoGraphics(Bit_MaskIndex, 0xFF); /* All bits */ + SetVideoGraphics(Graphics_ModeIndex, 0); /* Write mode 0 */ + SetVideoGraphics(Data_RotateIndex, 0); /* Don't rotate, replace */ + + for ( plane = HIGHPLANEMASK, bit = HIGHPLANEINDEX; + plane ; plane >>= 1, bit-- ) + { + if ( planes & plane) { + SetVideoGraphics(Read_Map_SelectIndex, bit); + SetVideoSequencer(Mask_MapIndex, plane); + + shift_thin_rect(pWin,x0,x1,y0,y1,w,h,alu); + } + } + } else if ( x1 > x0 ) { /* Shift right: start right */ + int l1 = x1 & WMASK, r1 = (x1 + w) & WMASK; + + if ( r1 ) { /* right edge */ + SetVideoGraphics(Enb_Set_ResetIndex, 0); /* All from CPU */ + SetVideoGraphics(Bit_MaskIndex, 0xFF); /* All bits */ + SetVideoGraphics(Graphics_ModeIndex, 0); /* Write mode 0 */ + SetVideoGraphics(Data_RotateIndex, 0); /* Don't rotate, replace */ + + for ( plane = HIGHPLANEMASK, bit = HIGHPLANEINDEX; + plane ; plane >>= 1, bit-- ) + { + if ( planes & plane) { + SetVideoGraphics(Read_Map_SelectIndex, bit); + SetVideoSequencer(Mask_MapIndex, plane); + + shift_thin_rect(pWin,x0+w-r1,x1+w-r1,y0,y1,r1,h,alu); + } + } + } + + /* Center */ + SetVideoGraphics(Graphics_ModeIndex, 1); /* Write mode 1 */ + SetVideoSequencer(Mask_MapIndex, planes); + + aligned_blit_center(pWin,x0,x1,y0,y1,w,h); + + if ( l1 ) { /* left edge */ + SetVideoGraphics(Enb_Set_ResetIndex, 0); /* All from CPU */ + SetVideoGraphics(Bit_MaskIndex, 0xFF); /* All bits */ + SetVideoGraphics(Graphics_ModeIndex, 0); /* Write mode 0 */ + SetVideoGraphics(Data_RotateIndex, 0); /* Don't rotate, replace */ + + for ( plane = HIGHPLANEMASK, bit = HIGHPLANEINDEX; + plane ; plane >>= 1, bit-- ) + { + if ( planes & plane) { + SetVideoGraphics(Read_Map_SelectIndex, bit); + SetVideoSequencer(Mask_MapIndex, plane); + + shift_thin_rect(pWin,x0,x1,y0,y1,(WORDSZ-l1),h,alu); + } + } + } + } else { + int l1 = x1 & WMASK, r1 = (x1 + w) & WMASK; + + if ( l1 ) { /* left edge */ + SetVideoGraphics(Enb_Set_ResetIndex, 0); /* All from CPU */ + SetVideoGraphics(Bit_MaskIndex, 0xFF); /* All bits */ + SetVideoGraphics(Graphics_ModeIndex, 0); /* Write mode 0 */ + SetVideoGraphics(Data_RotateIndex, 0); /* Don't rotate, replace */ + + for ( plane = HIGHPLANEMASK, bit = HIGHPLANEINDEX; + plane ; plane >>= 1, bit-- ) + { + if ( planes & plane) { + SetVideoGraphics(Read_Map_SelectIndex, bit); + SetVideoSequencer(Mask_MapIndex, plane); + + shift_thin_rect(pWin,x0,x1,y0,y1,(WORDSZ-l1),h,alu); + } + } + } + + /* Center */ + SetVideoGraphics(Graphics_ModeIndex, 1); /* Write mode 1 */ + SetVideoSequencer(Mask_MapIndex, planes); + + aligned_blit_center(pWin,x0,x1,y0,y1,w,h); + + if ( r1 ) { /* right edge */ + SetVideoGraphics(Enb_Set_ResetIndex, 0); /* All from CPU */ + SetVideoGraphics(Bit_MaskIndex, 0xFF); /* All bits */ + SetVideoGraphics(Graphics_ModeIndex, 0); /* Write mode 0 */ + SetVideoGraphics(Data_RotateIndex, 0); /* Don't rotate, replace */ + + for ( plane = HIGHPLANEMASK, bit = HIGHPLANEINDEX ; + plane ; plane >>= 1, bit-- ) + { + if ( planes & plane) { + SetVideoGraphics(Read_Map_SelectIndex, bit); + SetVideoSequencer(Mask_MapIndex, plane); + + shift_thin_rect(pWin,x0+w-r1,x1+w-r1,y0,y1,r1,h,alu); + } + } + } + } +} + +static void +aligned_blit_center(pWin,x0,x1,y0,y1,w,h) +WindowPtr pWin; /* GJA */ +int x0; /* left edge of source */ +int x1; /* left edge of target */ +int y0; +int y1; +int w; /* length of source, and of target */ +int h; +{ + int l1 = x1 & WMASK; /* Left edge of target, as bit */ + int r1 = (x1 + w) & WMASK; /* Right edge of target, as bit */ + int pad; + int htmp, wtmp; /* Temporaries for indices over height and width */ + volatile unsigned char tmp; /* Temporary result of the shifts */ + int bytecnt; + + volatile unsigned char *sp, *dp; + + if ( l1 ) { + bytecnt = (w - (WORDSZ - l1) - r1) >> WSHIFT; + sp = SMEM( ((x0 + (WORDSZ - l1)) >> WSHIFT), y0); + dp = DMEM( ((x1 + (WORDSZ - l1)) >> WSHIFT), y1); + } else { + bytecnt = (w - r1) >> WSHIFT; + sp = SMEM( (x0 >> WSHIFT), y0); + dp = DMEM( (x1 >> WSHIFT), y1); + } + + if ( y1 > y0 ) { /* Move down, start at the bottom */ + if ( x1 > x0 ) { /* Move right, start right */ + pad = - BYTES_PER_LINE(pWin) + bytecnt; + sp += BYTES_PER_LINE(pWin) * (h - 1) + bytecnt - 1; + dp += BYTES_PER_LINE(pWin) * (h - 1) + bytecnt - 1; + } else { /* Move left, start left */ + pad = - BYTES_PER_LINE(pWin) - bytecnt; + sp += BYTES_PER_LINE(pWin) * (h - 1); + dp += BYTES_PER_LINE(pWin) * (h - 1); + } + } else { /* Move up, start at the top */ + if ( x1 > x0 ) { /* Move right, start right */ + pad = BYTES_PER_LINE(pWin) + bytecnt; + sp += bytecnt - 1; + dp += bytecnt - 1; + } else { /* Move left, start left */ + pad = BYTES_PER_LINE(pWin) - bytecnt; + sp += 0; + dp += 0; + } + } + + if ( x1 > x0 ) { /* Move right, start right */ + for ( htmp = h ; htmp ; htmp-- ) { + for ( wtmp = bytecnt ; wtmp ; wtmp-- ) { + tmp = sp[0]; + dp[0] = tmp; + dp--; + sp--; + } + dp += pad; + sp += pad; + } + } else { /* x1 <= x0 */ /* Move left, start left */ + for ( htmp = h ; htmp ; htmp-- ) { + for ( wtmp = bytecnt ; wtmp ; wtmp-- ) { + tmp = sp[0]; + dp[0] = tmp; + dp++; + sp++; + } + dp += pad; + sp += pad; + } + } +} +#else /* PC98_EGC */ + +static void +egc_fast_blt (pWin, alu, writeplanes, x0, y0, x1, y1, w, h) +WindowPtr pWin; +const int alu, writeplanes ; +register int x0, x1 ; +int y0, y1 ; +register int w, h ; +{ +register volatile unsigned char *src ; +register volatile unsigned char *dst ; +unsigned short *src_x ; +unsigned short *dst_x ; +int x_direction, y_interval ; +int src_off, dst_off ; +register int k, i ; +unsigned short ROP_value; + +src = (unsigned char *)SCREENADDRESS( pWin, 0, y0); +dst = (unsigned char *)SCREENADDRESS( pWin, 0, y1); + +/* Set Map Mask */ +outw(EGC_PLANE, ~(writeplanes & VGA_ALLPLANES)); +switch(alu) { +case GXnor: /* ~(S|D) */ + ROP_value = 0x2903; + break; +case GXandInverted: /* ~S&D */ + ROP_value = 0x290c; + break; +case GXand: /* S&D */ + ROP_value = 0x29c0; + break; +case GXequiv: /* ~S ^ D */ + ROP_value = 0x29c3; + break; +case GXxor: /* S^D */ + ROP_value = 0x293c; + break; +case GXandReverse: /* S&~D */ + ROP_value = 0x2930; + break; +case GXorReverse: /* S|~D */ + ROP_value = 0x29f3; + break; +case GXnand: /* ~(S&D) */ + ROP_value = 0x293f; + break; +case GXorInverted: /* ~S|D */ + ROP_value = 0x29cf; + break; +case GXor: /* S|D */ + ROP_value = 0x29fa; + break; +case GXcopyInverted: /* ~S */ + ROP_value = 0x290f; + break; +case GXcopy: /* S */ +default: + ROP_value = 0x29f0; +} +outw(EGC_MODE, ROP_value); +if ( y1 > y0 ) { + y_interval = - BYTES_PER_LINE(pWin) * 8 ; + src += BYTES_PER_LINE(pWin) * ( h - 1 ) ; + dst += BYTES_PER_LINE(pWin) * ( h - 1 ) ; +} +else { + y_interval = BYTES_PER_LINE(pWin) * 8 ; +} + +src = (unsigned char *)((int)src << 3) ; +dst = (unsigned char *)((int)dst << 3) ; + +if ( y1 > y0) { + x_direction = 0x1000 ; + src += x0 + w - 1 ; + dst += x1 + w - 1 ; +} else if ( y1 < y0 ) { + x_direction = 0 ; + src += x0 ; + dst += x1 ; +} else { + if ( x1 < x0 ) { + x_direction = 0 ; + src += x0 ; + dst += x1 ; + } else { + x_direction = 0x1000 ; + src += x0 + w - 1 ; + dst += x1 + w - 1 ; + } +} + outw ( EGC_LENGTH , w - 1 ) ; + +for ( ; h-- ; ) { + if ( x_direction ) { + src_off = 15 - (int)src & 0xf ; + dst_off = 15 - (int)dst & 0xf ; + } else { + src_off = (int)src & 0xf ; + dst_off = (int)dst & 0xf ; + } +#if defined(__NetBSD__) || defined(__OpenBSD__) + src_x = (unsigned short *)(((unsigned int)src >> 4 ) << 1) ; + dst_x = (unsigned short *)(((unsigned int)dst >> 4 ) << 1) ; +#else + src_x = (unsigned short *)(((int)src >> 4 ) << 1) ; + dst_x = (unsigned short *)(((int)dst >> 4 ) << 1) ; +#endif + k = ( src_off + w + 15 ) >> 4 ; + if ( src_off < dst_off ) { + if ( ((src_off + w - 1 ) >> 4) < ((dst_off + w - 1) >> 4)) k++ ; + } + if ( src_off > dst_off ) { + if ( ((src_off + w - 1) >> 4 ) == ((dst_off + w - 1) >> 4) ) k++ ; + if ( x_direction ) dst_x ++ ; + else dst_x -- ; + } + outw ( EGC_ADD , x_direction | src_off | dst_off << 4 ); + if ( x_direction ) { + wcopyl ( src_x, dst_x, k, VIDBASE(pWin) ) ; + } else { + wcopyr ( src_x, dst_x, k, VIDBASE(pWin) ) ; + } +src += y_interval ; +dst += y_interval ; +} +outw ( EGC_ADD, 0 ) ; +outw ( EGC_LENGTH , 0xf ); +return; +} + +void +xf4bppBitBlt( pWin,alu, writeplanes, x0, y0, x1, y1, w, h ) +WindowPtr pWin; /* GJA */ +int alu; +int writeplanes; /* planes */ +int x0, y0, x1, y1, w, h; +{ + if ( ! xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) { + xf4bppOffBitBlt( pWin, alu, writeplanes, + x0, y0, x1, y1, w, h ); + return; + } + +switch ( alu ) { + case GXclear: /* 0x0 Zero 0 */ + case GXinvert: /* 0xa NOT dst */ + case GXset: /* 0xf 1 */ + xf4bppFillSolid( pWin, VGA_ALLPLANES, alu, writeplanes, x1, y1, w, h ) ; + /* x1, y1, GJA */ + case GXnoop: /* 0x5 dst */ + return ; + default: + break ; +} + +egc_fast_blt ( pWin, alu, writeplanes, x0, y0, x1, y1, w, h); +return; +} +#endif diff --git a/xorg-server/hw/xfree86/xf4bpp/vgaGC.c b/xorg-server/hw/xfree86/xf4bpp/vgaGC.c new file mode 100644 index 000000000..6495e5638 --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/vgaGC.c @@ -0,0 +1,213 @@ +/* + +Copyright (c) 1987 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 furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the 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. + + +Copyright IBM Corporation 1987,1988,1989 +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of IBM not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +*/ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include "xf4bpp.h" +#include "mfbmap.h" +#include "mfb.h" +#include "mi.h" +#include "ppcGCstr.h" + +void +xf4bppChangeGCtype( pGC, devPriv ) +register GC *pGC ; +register ppcPrivGCPtr devPriv ; +{ + if ( devPriv->lastDrawableType == DRAWABLE_PIXMAP ) { + pGC->ops->CopyArea = miCopyArea ; + pGC->ops->PolyFillRect = miPolyFillRect ; + pGC->ops->PushPixels = miPushPixels ; + pGC->ops->PolyArc = miPolyArc ; + pGC->ops->PolyFillArc = miPolyFillArc ; + pGC->ops->PolySegment = miPolySegment ; + } + else { + pGC->ops->CopyArea = xf4bppCopyArea ; + pGC->ops->PolyFillRect = xf4bppPolyFillRect ; + pGC->ops->PushPixels = miPushPixels ; /* GJA */ + pGC->ops->PolyArc = xf4bppZeroPolyArc ; + pGC->ops->PolyFillArc = xf4bppPolyFillArc ; + pGC->ops->PolySegment = xf4bppSegmentSS ; + } + return; +} + +Mask +xf4bppChangeWindowGC( pGC, changes ) +register GC *pGC ; +register Mask changes ; +{ +register ppcPrivGCPtr devPriv = (ppcPrivGCPtr)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()); +register unsigned long int idx ; /* used for stepping through bitfields */ + +#define LOWBIT( x ) ( x & - x ) /* Two's complement */ + while ((idx = LOWBIT(changes))) { + switch ( idx ) { + + case GCLineStyle: + case GCLineWidth: + pGC->ops->PolyArc = ( ( pGC->lineStyle == LineSolid ) + ? ( ( pGC->lineWidth == 0 ) ? xf4bppZeroPolyArc + : miPolyArc ) + : miPolyArc ) ; + pGC->ops->PolySegment = ( ( pGC->lineStyle == LineSolid ) + ? ( ( pGC->lineWidth == 0 ) + ? ( ( pGC->fillStyle == FillSolid ) ? + xf4bppSegmentSS : miPolySegment ) + : miPolySegment ) + : ( ( pGC->lineWidth == 0 ) + ? ( ( pGC->fillStyle == FillSolid ) ? + xf4bppSegmentSD : miPolySegment ) + : miPolySegment ) ) ; + pGC->ops->Polylines = ( ( pGC->lineStyle == LineSolid ) + ? ( ( pGC->lineWidth == 0 ) + ? ( (pGC->fillStyle == FillSolid ) ? + xf4bppLineSS : miZeroLine ) + : miWideLine ) + : ( ( pGC->lineWidth == 0 ) + ? ( (pGC->fillStyle == FillSolid ) ? + xf4bppLineSD : miWideDash ) + : miWideDash ) ) ; + /* + * If these are just square boxes with no funny business + * going on we can call the fast routine that draws + * rectangles without floating point. + */ +/* too buggy */ +#if 0 + if ( ( pGC->lineStyle == LineSolid ) + && ( pGC->joinStyle == JoinMiter ) + && ( pGC->lineWidth != 0 ) ) + pGC->ops->PolyRectangle = xf4bppPolyRectangle; + else +#endif + pGC->ops->PolyRectangle = miPolyRectangle; + + changes &= ~( GCLineStyle | GCLineWidth ) ; + break ; + case GCJoinStyle: + /* + * If these are just square boxes with no funny business + * going on we can call the fast routine that draws + * rectangles without floating point. + */ +/* too buggy */ +#if 0 + if ( ( pGC->lineStyle == LineSolid ) + && ( pGC->joinStyle == JoinMiter ) + && ( pGC->lineWidth != 0 ) ) + pGC->ops->PolyRectangle = xf4bppPolyRectangle; + else +#endif + pGC->ops->PolyRectangle = miPolyRectangle; + changes &= ~ idx ; /* i.e. changes &= ~ GCJoinStyle */ + break ; + + case GCBackground: + if ( pGC->fillStyle != FillOpaqueStippled ) { + changes &= ~ idx ; /* i.e. changes &= ~GCBackground */ + break ; + } /* else Fall Through */ + case GCForeground: + if ( pGC->fillStyle == FillTiled ) { + changes &= ~ idx ; /* i.e. changes &= ~GCForeground */ + break ; + } /* else Fall Through */ + case GCFunction: + case GCPlaneMask: + case GCFillStyle: + { /* new_fill */ + int fillStyle = devPriv->colorRrop.fillStyle ; + /* install a suitable fillspans */ + if ( fillStyle == FillSolid ) + pGC->ops->FillSpans = xf4bppSolidWindowFS ; + else if ( fillStyle == FillStippled ) + pGC->ops->FillSpans = xf4bppStippleWindowFS ; + else if ( fillStyle == FillOpaqueStippled ) + pGC->ops->FillSpans = xf4bppOpStippleWindowFS ; + else /* fillStyle == FillTiled */ + pGC->ops->FillSpans = xf4bppTileWindowFS ; + } /* end of new_fill */ + changes &= ~( GCBackground | GCForeground + | GCFunction + | GCPlaneMask | GCFillStyle ) ; + break ; + + default: + ErrorF("xf4bppChangeWindowGC: Unexpected GC Change\n") ; + changes &= ~ idx ; /* Remove it anyway */ + break ; + } + } + return changes; +} diff --git a/xorg-server/hw/xfree86/xf4bpp/vgaImages.c b/xorg-server/hw/xfree86/xf4bpp/vgaImages.c new file mode 100644 index 000000000..bea2d0a17 --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/vgaImages.c @@ -0,0 +1,460 @@ +/* + * Copyright IBM Corporation 1987,1988,1989 + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * +*/ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include "xf4bpp.h" +#include "OScompiler.h" +#include "vgaReg.h" +#include "vgaVideo.h" + +#include "xf86str.h" /* for pScrn->vtSema */ +extern ScrnInfoPtr *xf86Screens; + +#undef TRUE +#undef FALSE +#define TRUE 1 +#define FALSE 0 + +void +xf4bppDrawColorImage( pWin, x, y, w, h, data, RowIncrement, alu, planes ) +WindowPtr pWin; /* GJA */ +int x, y ; +register int w, h ; +unsigned char *data ; +register int RowIncrement ; +const int alu ; +const unsigned long int planes ; +{ +IOADDRESS REGBASE; +register unsigned long int tmp ; +register const unsigned char *src ; +register volatile unsigned char *dst ; +register int Pixel_Count ; +register unsigned int currMask ; +register unsigned int InitialMask ; +register volatile unsigned char *StartByte ; +unsigned int invert_source_data = FALSE ; +#ifdef PC98_EGC /* new EGC test */ +register unsigned char tmp1; +#endif + +{ /* Start GJA */ + if ( !xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) { + xf4bppOffDrawColorImage( pWin, x, y, w, h, data, RowIncrement, alu, planes ); + return; + } +} /* End GJA */ + +{ + unsigned int invert_existing_data = FALSE ; + unsigned int data_rotate_value = VGA_COPY_MODE ; +#ifdef PC98_EGC + unsigned short ROP_value; +#endif + + REGBASE = 0x300 + + xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase; + + switch ( alu ) { + case GXclear: /* 0x0 Zero 0 */ + case GXinvert: /* 0xa NOT dst */ + case GXset: /* 0xf 1 */ + xf4bppFillSolid( pWin, VGA_ALLPLANES, alu, planes, x, y, w, h ) ; + case GXnoop: /* 0x5 dst */ + return ; + case GXnor: /* 0x8 NOT src AND NOT dst */ + invert_existing_data = TRUE ; + case GXandInverted: /* 0x4 NOT src AND dst */ + invert_source_data = TRUE ; + case GXand: /* 0x1 src AND dst */ + data_rotate_value = VGA_AND_MODE ; + break ; + case GXequiv: /* 0x9 NOT src XOR dst */ + invert_source_data = TRUE ; + case GXxor: /* 0x6 src XOR dst */ + data_rotate_value = VGA_XOR_MODE ; + break ; + case GXandReverse: /* 0x2 src AND NOT dst */ + invert_existing_data = TRUE ; + data_rotate_value = VGA_AND_MODE ; + break ; + case GXnand: /* 0xe NOT src OR NOT dst */ + invert_source_data = TRUE ; + case GXorReverse: /* 0xb src OR NOT dst */ + invert_existing_data = TRUE ; + /* GJA -- moved this here */ + data_rotate_value = VGA_OR_MODE ; + break ; + case GXorInverted: /* 0xd NOT src OR dst */ + invert_source_data = TRUE ; + case GXor: /* 0x7 src OR dst */ + data_rotate_value = VGA_OR_MODE ; + break ; + case GXcopyInverted: /* 0xc NOT src */ + invert_source_data = TRUE ; + case GXcopy: /* 0x3 src */ + default: + break ; + } + +#ifdef PC98_EGC + /* Setup EGC Registers */ + switch(data_rotate_value) { +/* EGC MODE.. Cmp Read: Flase, WriteSource=ROP, ReadSource=CPU */ + case VGA_AND_MODE: + if (invert_existing_data) + ROP_value = EGC_AND_INV_MODE; + else + ROP_value = EGC_AND_MODE; + break; + case VGA_OR_MODE: + if (invert_existing_data) + ROP_value = EGC_OR_INV_MODE; + else + ROP_value = EGC_OR_MODE; + break; + case VGA_XOR_MODE: + if (invert_existing_data) + ROP_value = EGC_XOR_INV_MODE; + else + ROP_value = EGC_XOR_MODE; + break; + case VGA_COPY_MODE: + default: + ROP_value = EGC_COPY_MODE; + break; + } + outw(EGC_PLANE, ~(planes & VGA_ALLPLANES)); + outw(EGC_MODE, ROP_value); + outw(EGC_FGC, 0x0000); + tmp1 = 0; +#else + if ( invert_existing_data ) + xf4bppFillSolid( pWin, VGA_ALLPLANES, GXinvert, planes, x, y, w, h ) ; + /* Setup VGA Registers */ + SetVideoSequencer( Mask_MapIndex, planes & VGA_ALLPLANES ) ; + /* Set Raster Op */ + SetVideoGraphics( Data_RotateIndex, data_rotate_value ) ; + SetVideoGraphics( Graphics_ModeIndex, VGA_WRITE_MODE_2 ) ; +#endif +} + +StartByte = SCREENADDRESS(pWin, x, y); +InitialMask = SCRRIGHT8( LeftmostBit, BIT_OFFSET( x ) ) ; +if ( invert_source_data ) +#ifdef PC98_EGC +#if 0 /* New EGC version */ + egc_image_invert ( StartByte, data, InitialMask, w, h, + RowIncrement ) ; +#else /* new EGC c version */ + for ( ; + h-- ; + data += RowIncrement, StartByte += BYTES_PER_LINE(pWin) ) { + dst = StartByte; + for ( src = data, + Pixel_Count = w, currMask = InitialMask ; + Pixel_Count-- ; + src++ ) { + if (tmp1 != (~*src & VGA_ALLPLANES)) { + tmp1 = ~*src & VGA_ALLPLANES; + /* set FGC */ + outw(EGC_FGC, ~*src & VGA_ALLPLANES); + } + *((VgaMemoryPtr) dst) = currMask; + if ( currMask & RightmostBit ) { + currMask = LeftmostBit ; + dst++; + } + else + currMask = SCRRIGHT8( currMask, 1 ) ; + } + } +#endif /* new EGC */ +#else /* original */ + for ( ; + h-- ; + data += RowIncrement, StartByte += BYTES_PER_LINE(pWin) ) { + dst = StartByte; + for ( src = data, + Pixel_Count = w, currMask = InitialMask ; + Pixel_Count-- ; + src++ ) { + /* Set The Bit Mask Reg */ + SetVideoGraphics( Bit_MaskIndex, currMask ) ; + /* Read To Load vga Data Latches */ + tmp = *( (VgaMemoryPtr) dst ) ; + (void) tmp; + *( (VgaMemoryPtr) dst ) = ~ *src ; + if ( currMask & RightmostBit ) { + currMask = LeftmostBit ; + dst++; + } + else + currMask = SCRRIGHT8( currMask, 1 ) ; + } + } +#endif +else /* invert_source_data == FALSE */ +#ifdef PC98_EGC +#if 0 /* new EGC version */ + egc_image ( StartByte, data, InitialMask, w, h, + RowIncrement ); +#else /* new EGC c version */ + for ( ; + h-- ; + data += RowIncrement, StartByte += BYTES_PER_LINE(pWin) ) { + dst = StartByte; + for ( src = data, + Pixel_Count = w, currMask = InitialMask ; + Pixel_Count-- ; + src++ ) { + if (tmp1 != *src & VGA_ALLPLANES) { + tmp1 = *src & VGA_ALLPLANES; + outw(EGC_FGC, tmp1); /* set FGC */ + } + *((VgaMemoryPtr) dst) = currMask; /* write with mask */ + if ( currMask & RightmostBit ) { + currMask = LeftmostBit ; + dst++; + } + else + currMask = SCRRIGHT8( currMask, 1 ) ; + } + } +#endif /* new EGC version */ +#else /* original */ + for ( ; + h-- ; + data += RowIncrement, StartByte += BYTES_PER_LINE(pWin) ) { + dst = StartByte; + for ( src = data, + Pixel_Count = w, currMask = InitialMask ; + Pixel_Count-- ; + src++ ) { + /* Set The Bit Mask Reg */ + SetVideoGraphics( Bit_MaskIndex, currMask ) ; /* GJA */ + /* Read To Load vga Data Latches */ + tmp = *( (VgaMemoryPtr) dst ) ; + (void) tmp; + *( (VgaMemoryPtr) dst ) = *src ; + if ( currMask & RightmostBit ) { + currMask = LeftmostBit ; + dst++; + } + else + currMask = SCRRIGHT8( currMask, 1 ) ; + } + } +#endif /* original */ + +return ; +} + +#ifndef PC98_EGC +static unsigned long int +read8Z +( + IOADDRESS REGBASE, + register volatile unsigned char *screen_ptr +) +{ +register unsigned long int i ; +register unsigned long int j ; + +/* Read One Byte At A Time to get + * i == [ Plane 3 ] [ Plane 2 ] [ Plane 1 ] [ Plane 0 ] + * into a single register + */ +SetVideoGraphicsData( 3 ) ; +i = *( (VgaMemoryPtr) screen_ptr ) << 8 ; +SetVideoGraphicsData( 2 ) ; +i |= *( (VgaMemoryPtr) screen_ptr ) ; +i <<= 8 ; +SetVideoGraphicsData( 1 ) ; +i |= *( (VgaMemoryPtr) screen_ptr ) ; +i <<= 8 ; +SetVideoGraphicsData( 0 ) ; +i |= *( (VgaMemoryPtr) screen_ptr ) ; + +/* Push Bits To Get + * j == [Pixel 7][Pixel 6][Pixel 5][Pixel 4][Pixel 3][Pixel 2][Pixel 1][Pixel 0] + * into one register + */ + +j = ( i & 0x1 ) << 4 ; +j |= ( i >>= 1 ) & 0x1 ; +j <<= 4 ; +j |= ( i >>= 1 ) & 0x1 ; +j <<= 4 ; +j |= ( i >>= 1 ) & 0x1 ; +j <<= 4 ; +j |= ( i >>= 1 ) & 0x1 ; +j <<= 4 ; +j |= ( i >>= 1 ) & 0x1 ; +j <<= 4 ; +j |= ( i >>= 1 ) & 0x1 ; +j <<= 4 ; +j |= ( i >>= 1 ) & 0x1 ; + +j |= ( i & 0x2 ) << 28 ; +j |= ( ( i >>= 1 ) & 0x2 ) << 24 ; +j |= ( ( i >>= 1 ) & 0x2 ) << 20 ; +j |= ( ( i >>= 1 ) & 0x2 ) << 16 ; +j |= ( ( i >>= 1 ) & 0x2 ) << 12 ; +j |= ( ( i >>= 1 ) & 0x2 ) << 8 ; +j |= ( ( i >>= 1 ) & 0x2 ) << 4 ; +j |= ( i >>= 1 ) & 0x2 ; + +j |= ( i & 0x4 ) << 28 ; +j |= ( ( i >>= 1 ) & 0x4 ) << 24 ; +j |= ( ( i >>= 1 ) & 0x4 ) << 20 ; +j |= ( ( i >>= 1 ) & 0x4 ) << 16 ; +j |= ( ( i >>= 1 ) & 0x4 ) << 12 ; +j |= ( ( i >>= 1 ) & 0x4 ) << 8 ; +j |= ( ( i >>= 1 ) & 0x4 ) << 4 ; +j |= ( i >>= 1 ) & 0x4 ; + +j |= ( i & 0x8 ) << 28 ; +j |= ( ( i >>= 1 ) & 0x8 ) << 24 ; +j |= ( ( i >>= 1 ) & 0x8 ) << 20 ; +j |= ( ( i >>= 1 ) & 0x8 ) << 16 ; +j |= ( ( i >>= 1 ) & 0x8 ) << 12 ; +j |= ( ( i >>= 1 ) & 0x8 ) << 8 ; +j |= ( ( i >>= 1 ) & 0x8 ) << 4 ; +j |= ( i >>= 1 ) & 0x8 ; + +return j ; +} +#endif /* not PC98_EGC */ + +void +xf4bppReadColorImage( pWin, x, y, lx, ly, data, RowIncrement ) +WindowPtr pWin; /* GJA */ +int x, y ; +int lx, ly ; +register unsigned char *data ; +int RowIncrement ; +{ +IOADDRESS REGBASE; +register unsigned long int tmp ; +register volatile unsigned char *src ; +volatile unsigned char *masterSrc ; +int savCenterWidth ; +int dx ; +int skip ; +int center_width ; +int ignore ; +int pad ; +unsigned char tmpc; + +{ /* Start GJA */ + if ( !xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) { + xf4bppOffReadColorImage( pWin, x, y, lx, ly, data, RowIncrement ); + return; + } +} /* End GJA */ + +if ( ( lx <= 0 ) || ( ly <= 0 ) ) + return ; + + REGBASE = 0x300 + + xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase; + +/* Setup VGA Registers */ +#ifndef PC98_EGC +SetVideoGraphicsIndex( Graphics_ModeIndex ) ; +tmpc = inb( GraphicsDataRegister ); +SetVideoGraphicsData( tmpc & ~0x8 ) ; /* Clear the bit */ +SetVideoGraphicsIndex( Read_Map_SelectIndex ) ; +#else +outw(EGC_MODE, 0x0800); +#endif + +skip = BIT_OFFSET( x ) ; +pad = RowIncrement - lx ; +ignore = BIT_OFFSET( x + lx ) ; +masterSrc = SCREENADDRESS( pWin, x, y ) ; +center_width = ROW_OFFSET( x + lx ) - ROW_OFFSET( ( x + 0x7 ) & ~0x7 ) ; + +#define SINGLE_STEP *data++ = tmp & VGA_ALLPLANES ; tmp >>= 4 + + +if ( center_width < 0 ) { + src = masterSrc; + for ( ; ly-- ; ) { + tmp = read8Z( REGBASE, src ) >> ( skip << 2 ) ; + for ( dx = lx + 1 ; --dx ; ) { + SINGLE_STEP ; + } + data += pad ; + src += BYTES_PER_LINE(pWin); + } +} else + for ( savCenterWidth = center_width ; + ly-- ; + center_width = savCenterWidth, + masterSrc += BYTES_PER_LINE(pWin) ) { + src = masterSrc ; + tmp = read8Z( REGBASE, src ) ; src++; + if ((dx = skip)) + tmp >>= ( dx << 2 ) ; + else + if ( lx < 8 ) { /* kludge -- GJA */ + --center_width ; /* kludge -- GJA */ + dx = 8 - lx ; /* kludge -- GJA */ + } else /* kludge -- GJA */ + --center_width ; + BranchPoint: + switch ( dx ) { + LoopTop: + case 0x0: SINGLE_STEP ; + case 0x1: SINGLE_STEP ; + case 0x2: SINGLE_STEP ; + case 0x3: SINGLE_STEP ; + case 0x4: SINGLE_STEP ; + case 0x5: SINGLE_STEP ; + case 0x6: SINGLE_STEP ; + case 0x7: *data++ = tmp & VGA_ALLPLANES ; + + /* Fall Through To End Of Inner Loop */ + if ( center_width > 0 ) { + tmp = read8Z( REGBASE, src ) ; src++; + center_width-- ; + goto LoopTop ; + } + else if ( ( center_width == 0 ) + && ( dx = ( - ignore ) & 07 ) ) { + tmp = read8Z( REGBASE, src ) ; src++; + center_width-- ; + goto BranchPoint ; /* Do Mod 8 edge */ + } + else /* End of this line */ + data += pad ; + } + } + +return ; +} diff --git a/xorg-server/hw/xfree86/xf4bpp/vgaReg.h b/xorg-server/hw/xfree86/xf4bpp/vgaReg.h new file mode 100644 index 000000000..32ec0daed --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/vgaReg.h @@ -0,0 +1,137 @@ +/* + * Copyright IBM Corporation 1987,1988,1989 + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * +*/ + +#define SET_BYTE_REGISTER( ioport, value ) outb( ioport, value ) +#define SET_INDEX_REGISTER( ioport, value ) SET_BYTE_REGISTER( ioport, value ) +#define SET_DATA_REGISTER( ioport, value ) SET_BYTE_REGISTER( ioport, value ) +/* GJA -- deleted RTIO and ATRIO case here, so that a PCIO #define became + * superfluous. + */ +#define SET_INDEXED_REGISTER(RegGroup, Index, Value) \ + (SET_BYTE_REGISTER(RegGroup, Index), \ + SET_BYTE_REGISTER((RegGroup) + 1, Value)) + +/* There is a jumper on the ega to change this to 0x200 instead !! */ +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#if 0 /* This is now a stack variable, as needed */ +#define REGBASE 0x300 +#endif + +#define AttributeIndexRegister REGBASE + 0xC0 +#define AttributeDataWriteRegister REGBASE + 0xC0 +#define AttributeDataReadRegister REGBASE + 0xC1 +#define AttributeRegister AttributeIndexRegister +#define AttributeModeIndex 0x30 +#define OverScanColorIndex 0x31 +#define ColorPlaneEnableIndex 0x32 +#define HorizPelPanIndex 0x33 +#define ColorSelectIndex 0x34 +#ifndef PC98_EGC +#define SetVideoAttributeIndex( index ) \ + SET_INDEX_REGISTER( AttributeIndexRegister, index ) +#define SetVideoAttribute( index, value ) \ + SetVideoAttributeIndex( index ) ; \ + SET_BYTE_REGISTER( AttributeDataWriteRegister, value ) +#endif + + /* Graphics Registers 03CE & 03CF */ +#define GraphicsIndexRegister REGBASE + 0xCE +#define GraphicsDataRegister REGBASE + 0xCF +#define GraphicsRegister GraphicsIndexRegister +#define Set_ResetIndex 0x00 +#define Enb_Set_ResetIndex 0x01 +#define Color_CompareIndex 0x02 +#define Data_RotateIndex 0x03 +#define Read_Map_SelectIndex 0x04 +#define Graphics_ModeIndex 0x05 +#define MiscellaneousIndex 0x06 +#define Color_Dont_CareIndex 0x07 +#define Bit_MaskIndex 0x08 +#ifndef PC98_EGC +#define SetVideoGraphicsIndex( index ) \ + SET_INDEX_REGISTER( GraphicsIndexRegister, index ) +#define SetVideoGraphicsData( value ) \ + SET_INDEX_REGISTER( GraphicsDataRegister, value ) +#define SetVideoGraphics( index, value ) \ + SET_INDEXED_REGISTER( GraphicsRegister, index, value ) +#endif + +/* Sequencer Registers 03C4 & 03C5 */ +#define SequencerIndexRegister REGBASE + 0xC4 +#define SequencerDataRegister REGBASE + 0xC5 +#define SequencerRegister SequencerIndexRegister +#define Seq_ResetIndex 00 +#define Clock_ModeIndex 01 +#define Mask_MapIndex 02 +#define Char_Map_SelectIndex 03 +#define Memory_ModeIndex 04 +#ifndef PC98_EGC +#define SetVideoSequencerIndex( index ) \ + SET_INDEX_REGISTER( SequencerIndexRegister, index ) +#define SetVideoSequencer( index, value ) \ + SET_INDEXED_REGISTER( SequencerRegister, index, value ) +#endif + +/* BIT CONSTANTS FOR THE VGA/EGA HARDWARE */ +/* for the Graphics' Data_Rotate Register */ +#define VGA_ROTATE_FUNC_SHIFT 3 +#define VGA_COPY_MODE ( 0 << VGA_ROTATE_FUNC_SHIFT ) /* 0x00 */ +#define VGA_AND_MODE ( 1 << VGA_ROTATE_FUNC_SHIFT ) /* 0x08 */ +#define VGA_OR_MODE ( 2 << VGA_ROTATE_FUNC_SHIFT ) /* 0x10 */ +#define VGA_XOR_MODE ( 3 << VGA_ROTATE_FUNC_SHIFT ) /* 0x18 */ +/* for the Graphics' Graphics_Mode Register */ +#define VGA_READ_MODE_SHIFT 3 +#define VGA_WRITE_MODE_0 0 +#define VGA_WRITE_MODE_1 1 +#define VGA_WRITE_MODE_2 2 +#define VGA_WRITE_MODE_3 3 +#define VGA_READ_MODE_0 ( 0 << VGA_READ_MODE_SHIFT ) +#define VGA_READ_MODE_1 ( 1 << VGA_READ_MODE_SHIFT ) + +#ifdef PC98_EGC +/* I/O port address define for extended EGC */ +#define EGC_PLANE 0x4a0 /* EGC active plane select */ +#define EGC_READ 0x4a2 /* EGC FGC,EGC,Read Plane */ +#define EGC_MODE 0x4a4 /* EGC Mode register & ROP */ +#define EGC_FGC 0x4a6 /* EGC Forground color */ +#define EGC_MASK 0x4a8 /* EGC Mask register */ +#define EGC_BGC 0x4aa /* EGC Background color */ +#define EGC_ADD 0x4ac /* EGC Dest/Source address */ +#define EGC_LENGTH 0x4ae /* EGC Bit length */ + +#define PALETTE_ADD 0xa8 /* Palette address */ +#define PALETTE_GRE 0xaa /* Palette Green */ +#define PALETTE_RED 0xac /* Palette Red */ +#define PALETTE_BLU 0xae /* Palette Blue */ + +#define EGC_AND_MODE 0x2c8c /* (S&P&D)|(~S&D) */ +#define EGC_AND_INV_MODE 0x2c2c /* (S&P&~D)|(~S&D) */ +#define EGC_OR_MODE 0x2cec /* S&(P|D)|(~S&D) */ +#define EGC_OR_INV_MODE 0x2cbc /* S&(P|~D)|(~S&D) */ +#define EGC_XOR_MODE 0x2c6c /* (S&(P&~D|~P&D))|(~S&D) */ +#define EGC_XOR_INV_MODE 0x2c9c /* (S&(P&D)|(~P&~D))|(~S&D) */ +#define EGC_COPY_MODE 0x2cac /* (S&P)|(~S&D) */ +#endif diff --git a/xorg-server/hw/xfree86/xf4bpp/vgaSolid.c b/xorg-server/hw/xfree86/xf4bpp/vgaSolid.c new file mode 100644 index 000000000..0ef18cfeb --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/vgaSolid.c @@ -0,0 +1,574 @@ +/* + * Copyright IBM Corporation 1987,1988,1989 + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * +*/ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include "xf4bpp.h" +#include "OScompiler.h" +#include "vgaReg.h" +#include "vgaVideo.h" + +#include "xf86str.h" /* for pScrn->vtSema */ +extern ScrnInfoPtr *xf86Screens; + +#undef TRUE +#undef FALSE +#define TRUE 1 +#define FALSE 0 + +#ifndef PC98_EGC +#ifdef USE_ASM +extern void fastFill(); +extern void fastFillRMW(); +#else + +static void fastFill +( + register volatile unsigned char *destination, + register const unsigned int bytes_per_line, + register const unsigned int bytewidth, /* MUST BE > 0 !! */ + register unsigned int height /* MUST BE > 0 !! */ +) +{ +int stop_count = bytewidth ; +register int row_jump = bytes_per_line - bytewidth ; +#if !defined(OLDHC) && defined(BSDrt) && !defined(__i386__) +register const unsigned int notZero = ((unsigned char)(~0x0)); +#else +#define notZero ((unsigned char)(~0)) +#endif + +#define SINGLE_STORE \ + ( *( (VgaMemoryPtr) destination ) = notZero ); \ + destination++; stop_count--; + +/* TOP OF FIRST LOOP */ +BranchPoint: + +switch ( bytewidth & 0xF ) { /* Jump into loop at mod 16 remainder */ + LoopTop : + case 0x0 : SINGLE_STORE ; + case 0xF : SINGLE_STORE ; + case 0xE : SINGLE_STORE ; + case 0xD : SINGLE_STORE ; + case 0xC : SINGLE_STORE ; + case 0xB : SINGLE_STORE ; + case 0xA : SINGLE_STORE ; + case 0x9 : SINGLE_STORE ; + case 0x8 : SINGLE_STORE ; + case 0x7 : SINGLE_STORE ; + case 0x6 : SINGLE_STORE ; + case 0x5 : SINGLE_STORE ; + case 0x4 : SINGLE_STORE ; + case 0x3 : SINGLE_STORE ; + case 0x2 : SINGLE_STORE ; + case 0x1 : SINGLE_STORE ; +/* FIRST LOOP */ + if ( stop_count ) + goto LoopTop ; +/* SECOND LOOP */ + if ( --height ) { + destination += row_jump ; + stop_count = bytewidth ; + goto BranchPoint ; + } + else + return ; +#undef SINGLE_STORE +} +/*NOTREACHED*/ +} + +/* For Read-Modify-Write Case */ +static void fastFillRMW +( + register volatile unsigned char *destination, + register const unsigned int bytes_per_line, + register const unsigned int bytewidth, /* MUST BE > 0 !! */ + register unsigned int height /* MUST BE > 0 !! */ +) +{ +int stop_count = bytewidth ; +register int row_jump = bytes_per_line - bytewidth ; +#if !defined(OLDHC) && defined(BSDrt) && !defined(__i386__) +register const unsigned int notZero = ((unsigned char)(~0x0)); +#endif +register int tmp ; + +#define SINGLE_STORE \ + tmp = *( (VgaMemoryPtr) destination ) ; (void)tmp; \ + ( *( (VgaMemoryPtr) destination ) = notZero ) ; \ + destination++; stop_count-- ; + +/* TOP OF FIRST LOOP */ +BranchPoint: + +switch ( bytewidth & 0xF ) { /* Jump into loop at mod 16 remainder */ + LoopTop : + case 0x0 : SINGLE_STORE ; + case 0xF : SINGLE_STORE ; + case 0xE : SINGLE_STORE ; + case 0xD : SINGLE_STORE ; + case 0xC : SINGLE_STORE ; + case 0xB : SINGLE_STORE ; + case 0xA : SINGLE_STORE ; + case 0x9 : SINGLE_STORE ; + case 0x8 : SINGLE_STORE ; + case 0x7 : SINGLE_STORE ; + case 0x6 : SINGLE_STORE ; + case 0x5 : SINGLE_STORE ; + case 0x4 : SINGLE_STORE ; + case 0x3 : SINGLE_STORE ; + case 0x2 : SINGLE_STORE ; + case 0x1 : SINGLE_STORE ; +/* FIRST LOOP */ + if ( stop_count ) + goto LoopTop ; +/* SECOND LOOP */ + if ( --height ) { + destination += row_jump ; + stop_count = bytewidth ; + goto BranchPoint ; + } + else + return ; +} +#undef SINGLE_STORE +/*NOTREACHED*/ +} +#endif + + +void xf4bppFillSolid( pWin, color, alu, planes, x0, y0, lx, ly ) +WindowPtr pWin; /* GJA */ +unsigned long int color ; +const int alu ; +unsigned long int planes ; +register int x0 ; +register const int y0 ; +register int lx ; +register const int ly ; /* MUST BE > 0 !! */ +{ +IOADDRESS REGBASE; +register volatile unsigned char *dst ; +register int tmp ; +register int tmp2 ; +register int tmp3 ; +unsigned int data_rotate_value = VGA_COPY_MODE ; +unsigned int read_write_modify = FALSE ; +unsigned int invert_existing_data = FALSE ; + +{ /* Start GJA */ + if ( !xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) { + xf4bppOffFillSolid( pWin, color, alu, planes, x0, y0, lx, ly ); + return; + } +} /* End GJA */ + +if ( ( lx == 0 ) || ( ly == 0 ) ) + return; + +switch ( alu ) { + case GXclear: /* 0x0 Zero 0 */ + color = 0 ; + break ; + case GXnor: /* 0x8 NOT src AND NOT dst */ + invert_existing_data = TRUE ; + case GXandInverted: /* 0x4 NOT src AND dst */ + color = ~color ; + case GXand: /* 0x1 src AND dst */ + data_rotate_value = VGA_AND_MODE ; + read_write_modify = TRUE ; + case GXcopy: /* 0x3 src */ + break ; + case GXnoop: /* 0x5 dst */ + return ; + case GXequiv: /* 0x9 NOT src XOR dst */ + color = ~color ; + case GXxor: /* 0x6 src XOR dst */ + data_rotate_value = VGA_XOR_MODE ; + read_write_modify = TRUE ; + planes &= color ; + break ; + case GXandReverse: /* 0x2 src AND NOT dst */ + invert_existing_data = TRUE ; + data_rotate_value = VGA_AND_MODE ; + read_write_modify = TRUE ; + break ; + case GXorReverse: /* 0xb src OR NOT dst */ + invert_existing_data = TRUE ; + data_rotate_value = VGA_OR_MODE ; + read_write_modify = TRUE ; + break ; + case GXnand: /* 0xe NOT src OR NOT dst */ + invert_existing_data = TRUE ; + case GXorInverted: /* 0xd NOT src OR dst */ + color = ~color ; + case GXor: /* 0x7 src OR dst */ + data_rotate_value = VGA_OR_MODE ; + read_write_modify = TRUE ; + break ; + case GXcopyInverted: /* 0xc NOT src */ + color = ~color ; + break ; + case GXinvert: /* 0xa NOT dst */ + data_rotate_value = VGA_XOR_MODE ; + read_write_modify = TRUE ; + case GXset: /* 0xf 1 */ + color = VGA_ALLPLANES ; + default: + break ; +} + +if ( !( planes &= VGA_ALLPLANES ) ) + return ; + +REGBASE = + xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase + 0x300; + +/* + * Set The Plane-Enable + */ +SetVideoSequencer( Mask_MapIndex, planes ) ; +SetVideoGraphics( Enb_Set_ResetIndex, planes ) ; +/* + * Put Display Into SET/RESET Write Mode + */ +SetVideoGraphics( Graphics_ModeIndex, VGA_WRITE_MODE_3 ) ; +/* + * Set The Color in The Set/Reset Register + */ +SetVideoGraphics( Set_ResetIndex, color & VGA_ALLPLANES ) ; +/* + * Set The Function-Select In The Data Rotate Register + */ +SetVideoGraphics( Data_RotateIndex, data_rotate_value ) ; + +/* Do Left Edge */ +if ((tmp = x0 & 07)) { + tmp2 = SCRRIGHT8( ( (unsigned) 0xFF ), tmp ) ; + /* Catch The Cases Where The Entire Region Is Within One Byte */ + if ( ( lx -= 8 - tmp ) < 0 ) { + tmp2 &= SCRLEFT8( 0xFF, -lx ) ; + lx = 0 ; + } + /* Set The Bit Mask Reg */ + SetVideoGraphics(Bit_MaskIndex, tmp2 ) ; + if ( invert_existing_data == TRUE ) { + SetVideoGraphics( Set_ResetIndex, VGA_ALLPLANES ) ; + SetVideoGraphics( Data_RotateIndex, VGA_XOR_MODE ) ; + dst = SCREENADDRESS( pWin, x0, y0 ); + for ( tmp = ly; + tmp-- ; ) { + tmp3 = *( (VgaMemoryPtr) dst ) ; + (void)tmp3; + *( (VgaMemoryPtr) dst ) = tmp2 ; + dst += BYTES_PER_LINE(pWin); + } + SetVideoGraphics( Set_ResetIndex, color & VGA_ALLPLANES ) ; + SetVideoGraphics( Data_RotateIndex, data_rotate_value ) ; + /* Un-Set XOR */ + } + dst = SCREENADDRESS( pWin, x0, y0 ); + for ( tmp = ly; + tmp-- ; ) { + tmp3 = *( (VgaMemoryPtr) dst ) ; + (void)tmp3; + *( (VgaMemoryPtr) dst ) = tmp2 ; + dst += BYTES_PER_LINE(pWin); + } + if ( !lx ) { /* All Handled In This Byte */ + return ; + } + x0 = ( x0 + 8 ) & ~07 ; +} + +/* Fill The Center Of The Box */ +if ( ROW_OFFSET( lx ) ) { + SetVideoGraphics(Bit_MaskIndex, 0xFF ) ; + if ( invert_existing_data == TRUE ) { + SetVideoGraphics( Set_ResetIndex, VGA_ALLPLANES ) ; + SetVideoGraphics( Data_RotateIndex, VGA_XOR_MODE ) ; + fastFillRMW( SCREENADDRESS( pWin, x0, y0 ), + BYTES_PER_LINE(pWin), + ROW_OFFSET( lx ), ly ) ; + SetVideoGraphics( Set_ResetIndex, color & VGA_ALLPLANES ) ; + SetVideoGraphics( Data_RotateIndex, data_rotate_value ) ; + /* Un-Set XOR */ + /* Point At The Bit Mask Reg */ + } + (* ( ( read_write_modify == FALSE ) ? fastFill : fastFillRMW ) ) + ( SCREENADDRESS( pWin, x0, y0 ), BYTES_PER_LINE(pWin), + ROW_OFFSET( lx ), ly ) ; +} + +/* Do Right Edge */ +if ((tmp = BIT_OFFSET(lx))) { /* x0 Now Is Byte Aligned */ + /* Set The Bit Mask */ + SetVideoGraphics( Bit_MaskIndex, + (tmp2 = SCRLEFT8( 0xFF, ( 8 - tmp ) ) ) ) ; + if ( invert_existing_data == TRUE ) { + SetVideoGraphics( Set_ResetIndex, VGA_ALLPLANES ) ; + SetVideoGraphics( Data_RotateIndex, VGA_XOR_MODE ) ; + dst = SCREENADDRESS( pWin, ( x0 + lx ), y0 ); + for ( tmp = ly; + tmp-- ; ) { + tmp3 = *( (VgaMemoryPtr) dst ) ; + (void)tmp3; + *( (VgaMemoryPtr) dst ) = tmp2 ; + dst += BYTES_PER_LINE(pWin); + } + SetVideoGraphics( Set_ResetIndex, color & VGA_ALLPLANES ) ; + SetVideoGraphics( Data_RotateIndex, data_rotate_value ) ; + /* Un-Set XOR */ + } + dst = SCREENADDRESS( pWin, ( x0 + lx ), y0 ); + for ( tmp = ly; + tmp-- ; ) { + tmp3 = *( (VgaMemoryPtr) dst ) ; + (void)tmp3; + *( (VgaMemoryPtr) dst ) = tmp2 ; + dst += BYTES_PER_LINE(pWin) ; + } +} +/* Disable Set/Reset Register */ +SetVideoGraphics( Enb_Set_ResetIndex, 0 ) ; + + +return ; +} + +#else /* for PC98 EGC */ +static void WordfastFill( destination, bytes_per_line, wordwidth, height ) +register volatile unsigned char *destination ; +register const unsigned int bytes_per_line ; +register const unsigned int wordwidth ; /* MUST BE > 0 !! */ +register unsigned int height ; /* MUST BE > 0 !! */ +{ +int stop_count = wordwidth ; +register int row_jump = bytes_per_line - wordwidth*2 ; +#if !defined(OLDHC) && defined(BSDrt) && !defined(__i386__) && 0 +register const int notZero = ~0x0 ; +#else +#define notZero ( ~0 ) +#endif + +#define SINGLE_STORE \ + ( *( (unsigned short *) destination++ ) = notZero ); \ + destination++; stop_count--; + +/* TOP OF FIRST LOOP */ +BranchPoint: + +switch ( wordwidth & 0xF ) { /* Jump into loop at mod 16 remainder */ + LoopTop : + case 0x0 : SINGLE_STORE ; + case 0xF : SINGLE_STORE ; + case 0xE : SINGLE_STORE ; + case 0xD : SINGLE_STORE ; + case 0xC : SINGLE_STORE ; + case 0xB : SINGLE_STORE ; + case 0xA : SINGLE_STORE ; + case 0x9 : SINGLE_STORE ; + case 0x8 : SINGLE_STORE ; + case 0x7 : SINGLE_STORE ; + case 0x6 : SINGLE_STORE ; + case 0x5 : SINGLE_STORE ; + case 0x4 : SINGLE_STORE ; + case 0x3 : SINGLE_STORE ; + case 0x2 : SINGLE_STORE ; + case 0x1 : SINGLE_STORE ; +/* FIRST LOOP */ + if ( stop_count ) + goto LoopTop ; +/* SECOND LOOP */ + if ( --height ) { + destination += row_jump ; + stop_count = wordwidth ; + goto BranchPoint ; + } + else + return ; +#undef SINGLE_STORE +} +/*NOTREACHED*/ +} + +void xf4bppFillSolid( pWin, color, alu, planes, x0, y0, lx, ly ) +WindowPtr pWin; /* GJA */ +unsigned long int color ; +const int alu ; +unsigned long int planes ; +register int x0 ; +register const int y0 ; +register int lx ; +register const int ly ; /* MUST BE > 0 !! */ +{ +register volatile unsigned char *dst ; +register tmp ; +register tmp2 ; +register unsigned short tmp3 ; +unsigned short ROP_value; +unsigned int data_rotate_value = VGA_COPY_MODE ; +unsigned int read_write_modify = FALSE ; +unsigned int invert_existing_data = FALSE ; + +{ /* Start GJA */ + if ( !xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) { + xf4bppOffFillSolid( pWin, color, alu, planes, x0, y0, lx, ly ); + return; + } +} /* End GJA */ + +if ( ( lx == 0 ) || ( ly == 0 ) ) + return; + +switch ( alu ) { + case GXclear: /* 0x0 Zero 0 */ + color = 0 ; + break ; + case GXnor: /* 0x8 NOT src AND NOT dst */ + invert_existing_data = TRUE ; + case GXandInverted: /* 0x4 NOT src AND dst */ + color = ~color ; + case GXand: /* 0x1 src AND dst */ + data_rotate_value = VGA_AND_MODE ; + read_write_modify = TRUE ; + case GXcopy: /* 0x3 src */ + break ; + case GXnoop: /* 0x5 dst */ + return ; + case GXequiv: /* 0x9 NOT src XOR dst */ + color = ~color ; + case GXxor: /* 0x6 src XOR dst */ + data_rotate_value = VGA_XOR_MODE ; + read_write_modify = TRUE ; + planes &= color ; + break ; + case GXandReverse: /* 0x2 src AND NOT dst */ + invert_existing_data = TRUE ; + data_rotate_value = VGA_AND_MODE ; + read_write_modify = TRUE ; + break ; + case GXorReverse: /* 0xb src OR NOT dst */ + invert_existing_data = TRUE ; + data_rotate_value = VGA_OR_MODE ; + read_write_modify = TRUE ; + break ; + case GXnand: /* 0xe NOT src OR NOT dst */ + invert_existing_data = TRUE ; + case GXorInverted: /* 0xd NOT src OR dst */ + color = ~color ; + case GXor: /* 0x7 src OR dst */ + data_rotate_value = VGA_OR_MODE ; + read_write_modify = TRUE ; + break ; + case GXcopyInverted: /* 0xc NOT src */ + color = ~color ; + break ; + case GXinvert: /* 0xa NOT dst */ + data_rotate_value = VGA_XOR_MODE ; + read_write_modify = TRUE ; + case GXset: /* 0xf 1 */ + color = VGA_ALLPLANES ; + default: + break ; +} + +if ( !( planes &= VGA_ALLPLANES ) ) + return ; + +/* Set Access Planes */ +outw(EGC_PLANE, ~planes); +switch(data_rotate_value) { +/* EGC MODE.. Cmp Read: Flase, WriteSource=ROP, ReadSource=CPU */ + case VGA_AND_MODE: + if (invert_existing_data) + ROP_value = EGC_AND_INV_MODE; + else + ROP_value = EGC_AND_MODE; + break; + case VGA_OR_MODE: + if (invert_existing_data) + ROP_value = EGC_OR_INV_MODE; + else + ROP_value = EGC_OR_MODE; + break; + case VGA_XOR_MODE: + if (invert_existing_data) + ROP_value = EGC_XOR_INV_MODE; + else + ROP_value = EGC_XOR_MODE; + break; + case VGA_COPY_MODE: + default: + ROP_value = EGC_COPY_MODE; + break; +} +outw(EGC_MODE, ROP_value); +outw(EGC_FGC, color & VGA_ALLPLANES); +/* Do Left Edge */ +if ( tmp = x0 & 0x0f ) { + dst = (unsigned char *)((int)(SCREENADDRESS(pWin,x0,y0)) & ~0x01); + tmp3 = (unsigned)0xffff >>tmp; + /* Catch The Cases Where The Entire Region Is Within One Word */ + if ( ( lx -= 16 - tmp ) < 0 ) { + tmp3 &= (unsigned)0xffff << -lx; + lx = 0 ; + } + tmp3 = (unsigned short)(tmp3 >> 8 | tmp3 << 8); + for ( tmp = ly; + tmp-- ; ) { + *((unsigned short *) dst ) = tmp3 ; + dst += BYTES_PER_LINE(pWin); + } + if ( !lx ) { /* All Handled In This Word */ + return ; + } + x0 = ( x0 + 0x0f ) & ~0x0f ; +} + +/* Fill The Center Of The Box */ +if (lx >> 4) { + WordfastFill( SCREENADDRESS( pWin, x0, y0 ), BYTES_PER_LINE(pWin), + (lx >> 4), ly ) ; +} + +/* Do Right Edge */ +if ( tmp = lx & 0x0f ) { /* x0 Now Is Word Aligned */ + /* Set The Bit Mask */ + tmp3 = (unsigned)0xffff << ( 16 - tmp ); + dst = (unsigned char*)((int)SCREENADDRESS(pWin,(x0+lx),y0) & ~0x01); + tmp3 = (unsigned short)(tmp3 >> 8 | tmp3 << 8); + for ( tmp = ly; + tmp-- ; ) { + *( (unsigned short *) dst ) = tmp3 ; + dst += BYTES_PER_LINE(pWin); + } +} + +return ; +} +#endif diff --git a/xorg-server/hw/xfree86/xf4bpp/vgaStipple.c b/xorg-server/hw/xfree86/xf4bpp/vgaStipple.c new file mode 100644 index 000000000..5ad53028c --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/vgaStipple.c @@ -0,0 +1,720 @@ +/* + * Copyright IBM Corporation 1987,1988,1989 + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * +*/ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include "xf4bpp.h" +#include "OScompiler.h" +#include "vgaReg.h" +#include "vgaVideo.h" + +#include "xf86str.h" /* for pScrn->vtSema */ +extern ScrnInfoPtr *xf86Screens; + +#ifndef PC98_EGC +static unsigned char +getbits +( + register const int x, + register const unsigned int patternWidth, + register const unsigned char * const lineptr +) +{ +register unsigned char bits ; +register const unsigned char *cptr ; +register int shift ; +register int wrap ; + +cptr = lineptr + ( x >> 3 ) ; +bits = *cptr ; +if ((shift = x & 7)) + bits = SCRLEFT8( bits, shift ) | SCRRIGHT8( cptr[1], ( 8 - shift ) ) ; +if ( ( wrap = x + 8 - patternWidth ) > 0 ) { + bits &= SCRLEFT8( 0xFF, wrap ) ; + bits |= SCRRIGHT8( *lineptr, ( 8 - wrap ) ) ; +} + +/* GJA -- Handle extraction of 8 bits from < 8 bits wide stipple. + * I duplicated case 4,5,6,7 to give the compiler a chance to optimize. + */ +switch (patternWidth) { +case 1: /* Not really useful. */ + bits &= ~SCRRIGHT8(0xFF,1); + bits |= SCRRIGHT8(bits,1); + bits |= SCRRIGHT8(bits,2); + bits |= SCRRIGHT8(bits,4); + break; +case 2: + bits &= ~SCRRIGHT8(0xFF,2); + bits |= SCRRIGHT8(bits,2); bits |= SCRRIGHT8(bits,4); break; +case 3: + bits &= ~SCRRIGHT8(0xFF,3); + bits |= (SCRRIGHT8(bits,3) | SCRRIGHT8(bits,6)); break; +case 4: + bits = (bits & ~SCRRIGHT8(0xFF,4)) | SCRRIGHT8(bits,4); break; +case 5: + bits = (bits & ~SCRRIGHT8(0xFF,5)) | SCRRIGHT8(bits,5); break; +case 6: + bits = (bits & ~SCRRIGHT8(0xFF,6)) | SCRRIGHT8(bits,6); break; +case 7: + bits = (bits & ~SCRRIGHT8(0xFF,7)) | SCRRIGHT8(bits,7); break; +default: + ; + /* Do nothing, of course */ +} +return bits ; +} +#endif + +/* GJA -- + * Basically, in the code below, we will draw a stipple in the usual + * three parts: left edge, center and right edge. + * For efficiency reasons, the center will be drawn byte aligned, so that + * we will have to shuffle the bits in the left and right edges. + * The hard cases will be stipples with width < 8: In order to get 8 + * bits from those, we will need a loop. One single 'if' will never do. + * This is taken care of above. + */ +static void +DoMonoSingle +( + WindowPtr pWin, /* GJA */ + int w, + int x, + int y, + register const unsigned char *mastersrc, + int h, + register unsigned int width, + register unsigned int paddedByteWidth, + unsigned int height, + int xshift, + int yshift +) +{ +IOADDRESS REGBASE = + xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase + 0x300; +register volatile unsigned char *xDst ; +register VideoAdapterObject tmp2 ; +register int NeedValX ; +register int counter ; +register int tmp1 ; +unsigned int rowCounter ; +int byte_cnt ; +#ifdef PC98_EGC +unsigned char bitmask; +#endif + +/* Do Left Edge */ +if ((tmp1 = x & 07)) { + tmp2 = SCRRIGHT8( ( (unsigned) 0xFF ), tmp1 ) ; + /* Catch The Cases Where The Entire Region Is Within One Byte */ + if ( ( w -= 8 - tmp1 ) < 0 ) { + tmp2 &= SCRLEFT8( (unsigned) 0xFF, -w ) ; + w = 0 ; + } +#ifndef PC98_EGC + SetVideoGraphics( Bit_MaskIndex, tmp2 ) ; /* Set The Bit Mask */ +#else + bitmask = tmp2; /* Set The Bit Mask */ +#endif + /* + * For Each Line In The Source Pixmap + */ + xDst = SCREENADDRESS( pWin, x, y ); + for ( tmp1 = yshift, rowCounter = h; + rowCounter ; + rowCounter-- , tmp1++ ) { + + if ( tmp1 >= (int)height ) + tmp1 -= height ; +#ifndef PC98_EGC + /* Read To Save */ + tmp2 = *( (VgaMemoryPtr) xDst) ; +#endif + /* Write Pattern */ + *( (VgaMemoryPtr) xDst ) = +#ifndef PC98_EGC + getbits( xshift /* GJA */, width, + mastersrc + + ( tmp1 * paddedByteWidth ) ) >> (x & 07) ; +#else +#if 0 + (getbits( xshift /* GJA */, width, + mastersrc + + ( tmp1 * paddedByteWidth ) ) >> (x & 07) + & bitmask); +#else + (getbits_x( xshift /* GJA */, width, + mastersrc + + ( tmp1 * paddedByteWidth ), (x & 07)) + & bitmask); +#endif +#endif + xDst += BYTES_PER_LINE(pWin); + } + NeedValX = (xshift + 8 - (x & 07)) % width; + x = ( x + 7 ) & ~07 ; +} +else { + NeedValX = xshift ; +} + +if ((byte_cnt = ROW_OFFSET(w))) { /* Fill The Center Of The Box */ + int SavNeedX = NeedValX ; + +#ifndef PC98_EGC + SetVideoGraphics( Bit_MaskIndex, 0xFF ) ; /* Set The Bit Mask */ +#endif + /* + * For Each Line In The Source Pixmap + */ + xDst = SCREENADDRESS( pWin, x, y ); + for ( tmp1 = yshift, rowCounter = h; + rowCounter ; + rowCounter-- , tmp1++ ) { + register const unsigned char *l_ptr ; + if ( tmp1 >= (int)height ) + tmp1 -= height ; + l_ptr = mastersrc + ( tmp1 * paddedByteWidth ) ; + /* + * For Each Byte Across The Pattern In X + */ + for ( counter = byte_cnt, NeedValX = SavNeedX ; + counter-- ; ) { +#ifndef PC98_EGC + /* Read To Save */ + tmp2 = *( (VgaMemoryPtr) xDst) ; +#endif + /* Write Pattern */ + *( (VgaMemoryPtr) xDst ) = +#ifndef PC98_EGC + getbits( NeedValX, width, l_ptr ) ; +#else +#if 0 + getbits( NeedValX, width, l_ptr ) ; +#else + getbits_x ( NeedValX, width, l_ptr, 0 ) ; +#endif +#endif + /* GJA -- The '%' is there since width could be < 8 */ + NeedValX = (NeedValX + 8) % width; + xDst++; + } + xDst += BYTES_PER_LINE(pWin) - byte_cnt; + } +} + +/* Do Right Edge */ +if ((tmp1 = BIT_OFFSET(w))) { /* x Now Is Byte Aligned */ + /* Set The Bit Mask */ +#ifndef PC98_EGC + SetVideoGraphics( Bit_MaskIndex, SCRLEFT8( 0xFF, ( 8 - tmp1 ) ) ) ; +#else + bitmask = SCRLEFT8( 0xFF, ( 8 - tmp1 )); +#endif + /* + * For Each Line In The Source Pixmap + */ + xDst = SCREENADDRESS( pWin, ( x + w ), y ); + for ( tmp1 = yshift, rowCounter = h; + rowCounter ; + rowCounter-- , tmp1++ ) { + if ( tmp1 >= (int)height ) + tmp1 -= height ; +#ifndef PC98_EGC + /* Read To Save */ + tmp2 = *( (VgaMemoryPtr) xDst) ; +#endif + /* Write Pattern */ + *( (VgaMemoryPtr) xDst ) = +#ifndef PC98_EGC + getbits( NeedValX, width, + mastersrc + + ( tmp1 * paddedByteWidth ) ) ; +#else +#if 0 + (getbits( NeedValX, width, + mastersrc + + ( tmp1 * paddedByteWidth ) ) & bitmask); +#else + (getbits_x( NeedValX, width, + mastersrc + + ( tmp1 * paddedByteWidth ), 0 ) & bitmask); +#endif +#endif + xDst += BYTES_PER_LINE(pWin) ; + } +} + +return ; +} + +static void +DoMonoMany +( + WindowPtr pWin, /* GJA */ + int w, + int x, + int y, + register const unsigned char *mastersrc, + int h, + register unsigned int width, + register unsigned int paddedByteWidth, + unsigned int height, + int xshift, + int yshift +) +{ +IOADDRESS REGBASE = + xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase + 0x300; +register volatile unsigned char *xDst ; +register VideoAdapterObject tmp2 ; +register int NeedValX ; +register int byte_cnt ; +register int tmp1 ; +unsigned DestinationRow ; +unsigned int SourceRow ; +volatile unsigned char *dst ; +int scr_incr = ( height * BYTES_PER_LINE(pWin) ) ; +#ifdef PC98_EGC +unsigned char bitmask; +#endif + +/* Do Left Edge */ +if ((tmp1 = x & 07)) { + tmp2 = SCRRIGHT8( ( (unsigned) 0xFF ), tmp1 ) ; + /* Catch The Cases Where The Entire Region Is Within One Byte */ + if ( ( w -= 8 - tmp1 ) < 0 ) { + tmp2 &= SCRLEFT8( (unsigned) 0xFF, -w ) ; + w = 0 ; + } +#ifndef PC98_EGC + SetVideoGraphics( Bit_MaskIndex, tmp2 ) ; /* Set The Bit Mask */ +#else + bitmask = tmp2; /* Set The Bit Mask */ +#endif + /* + * For Each Line In The Source Pixmap + */ + for ( tmp1 = yshift, SourceRow = 0, dst = SCREENADDRESS( pWin, x, y ) ; + SourceRow < height ; + tmp1++, SourceRow++, dst += BYTES_PER_LINE(pWin) ) { + register unsigned bitPattern ; + + if ( tmp1 >= (int)height ) + tmp1 -= height ; + /* + * For Each Time Pattern Repeats In The Y Dimension + */ + xDst = dst; + for ( DestinationRow = SourceRow, +#ifndef PC98_EGC + bitPattern = getbits( xshift, width, + mastersrc + + ( tmp1 * paddedByteWidth ) ) ; +#else +#if 0 + bitPattern = getbits( xshift, width, + mastersrc + + ( tmp1 * paddedByteWidth ) ) ; +#else + bitPattern = getbits_x( xshift, width, + mastersrc + + ( tmp1 * paddedByteWidth ), 0 ) ; +#endif +#endif + (int)DestinationRow < h ; + DestinationRow += height ) { +#ifndef PC98_EGC + /* Read To Save */ + tmp2 = *( (VgaMemoryPtr) xDst ) ; +#endif + /* Write Pattern */ +#ifndef PC98_EGC + *( (VgaMemoryPtr) xDst ) = bitPattern >> (x & 07); +#else + *( (VgaMemoryPtr) xDst ) = (bitPattern >> (x & 07)) & bitmask; +#endif + xDst += scr_incr; + } + } + NeedValX = (xshift + 8 - (x & 07)) % width; + x = ( x + 7 ) & ~07 ; +} +else { + NeedValX = xshift ; +} + +if ((byte_cnt = ROW_OFFSET(w))) { /* Fill The Center Of The Box */ + int SavNeedX = NeedValX ; + +#ifndef PC98_EGC + SetVideoGraphics( Bit_MaskIndex, 0xFF ) ; /* Set The Bit Mask */ +#endif + /* + * For Each Line In The Source Pixmap + */ + for ( tmp1 = yshift, SourceRow = 0, dst = SCREENADDRESS( pWin, x, y ) ; + SourceRow < height ; + tmp1++, SourceRow++, dst += BYTES_PER_LINE(pWin) - byte_cnt ) { + register const unsigned char *l_ptr ; + if ( tmp1 >= (int)height ) + tmp1 -= height ; + l_ptr = mastersrc + ( tmp1 * paddedByteWidth ) ; + /* + * For Each Byte Across The Pattern In X + */ + for ( tmp2 = byte_cnt, NeedValX = SavNeedX ; + tmp2-- ; + dst++ ) { + register unsigned bitPattern ; +#ifndef PC98_EGC + register VideoAdapterObject tmp3 ; +#endif + /* + * For Each Time Pattern Repeats In Y + */ + xDst = dst; + for ( DestinationRow = SourceRow, +#ifndef PC98_EGC + bitPattern = getbits( NeedValX, width, l_ptr ) ; +#else +#if 0 + bitPattern = getbits( NeedValX, width, l_ptr ) ; +#else + bitPattern = getbits_x( NeedValX, width, l_ptr, 0 ) ; +#endif +#endif + (int)DestinationRow < h ; + DestinationRow += height ) { +#ifndef PC98_EGC + /* Read To Save */ + tmp3 = *( (VgaMemoryPtr) xDst) ; + (void)tmp3; +#endif + /* Write Pattern */ + *( (VgaMemoryPtr) xDst ) = bitPattern ; + xDst += scr_incr; + } + NeedValX = (NeedValX + 8) % width; + } + } +} + +/* Do Right Edge */ +if ((tmp1 = BIT_OFFSET(w))) { /* x Now Is Byte Aligned */ + /* Set The Bit Mask */ +#ifndef PC98_EGC + SetVideoGraphics( Bit_MaskIndex, SCRLEFT8( 0xFF, ( 8 - tmp1 ) ) ) ; +#else + bitmask = SCRLEFT8( 0xFF, ( 8 - tmp1 ) ); +#endif + /* + * For Each Line In The Source Pixmap + */ + for ( tmp1 = yshift, SourceRow = 0, + dst = SCREENADDRESS( pWin, ( x + w ), y ) ; + SourceRow < height ; + tmp1++, SourceRow++, dst += BYTES_PER_LINE(pWin) ) { + register unsigned bitPattern ; + if ( tmp1 >= (int)height ) + tmp1 -= height ; + /* + * For Each Time Pattern Repeats In The Y Dimension + */ + xDst = dst; + for ( DestinationRow = SourceRow, +#ifndef PC98_EGC + bitPattern = getbits( NeedValX, width, + mastersrc + + ( tmp1 * paddedByteWidth ) ) ; +#else +#if 0 + bitPattern = getbits( NeedValX, width, + mastersrc + + ( tmp1 * paddedByteWidth ) ) ; +#else + bitPattern = getbits_x( NeedValX, width, + mastersrc + + ( tmp1 * paddedByteWidth ), 0 ) ; +#endif +#endif + (int)DestinationRow < h ; + DestinationRow += height ) { +#ifndef PC98_EGC + /* Read To Save */ + tmp2 = *( (VgaMemoryPtr) xDst) ; +#endif + /* Write Pattern */ +#ifndef PC98_EGC + *( (VgaMemoryPtr) xDst ) = bitPattern ; +#else + *( (VgaMemoryPtr) xDst ) = bitPattern & bitmask; +#endif + xDst += scr_incr; + } + } +} + +return ; +} + +#define DO_RECURSE 0x10000 + +static void +vgaSetMonoRegisters +( + DrawablePtr pDrawable, + register unsigned long int plane_mask, + register unsigned long int desiredState +) +{ +IOADDRESS REGBASE = + xf86Screens[pDrawable->pScreen->myNum]->domainIOBase + 0x300; +#ifndef PC98_EGC +/* Setup VGA Registers */ +/* + * Set The Plane-Enable + */ +SetVideoSequencer( Mask_MapIndex, plane_mask ) ; +SetVideoGraphics( Enb_Set_ResetIndex, plane_mask ) ; +/* + * Put Display Into SET-AND (i.e. Write Mode 3 ) + */ +SetVideoGraphics( Graphics_ModeIndex, VGA_WRITE_MODE_3 ) ; +/* + * Set The Color in The Set/Reset Register + */ +SetVideoGraphics( Set_ResetIndex, desiredState & VGA_ALLPLANES ) ; +/* + * Set The Vga's Alu Function + */ +SetVideoGraphics( Data_RotateIndex, desiredState >> 8 ) ; +#else /* PC98_EGC */ +unsigned short ROP_value; +/* Setup VGA Registers */ +/* + * Set The Plane-Enable + */ +outw(EGC_PLANE, ~plane_mask); +switch((desiredState >> 8)&0x18) { +/* EGC MODE.. Cmp Read: Flase, WriteSource=ROP, ReadSource=CPU */ + case VGA_AND_MODE: + if (desiredState & DO_RECURSE) + ROP_value = EGC_AND_INV_MODE; + else + ROP_value = EGC_AND_MODE; + break; + case VGA_OR_MODE: + if (desiredState & DO_RECURSE) + ROP_value = EGC_OR_INV_MODE; + else + ROP_value = EGC_OR_MODE; + break; + case VGA_XOR_MODE: + if (desiredState & DO_RECURSE) + ROP_value = EGC_XOR_INV_MODE; + else + ROP_value = EGC_XOR_MODE; + break; + case VGA_COPY_MODE: + default: + ROP_value = EGC_COPY_MODE; + break; +} +outw(EGC_MODE, ROP_value); +outw(EGC_FGC, desiredState & VGA_ALLPLANES); +#endif + +return ; +} + +static unsigned long +vgaCalcMonoMode +( + int rasterOp, + register unsigned long int color +) +{ +register unsigned int data_rotate_value = VGA_COPY_MODE << 8 ; +register unsigned int invert_existing_data = 0 ; + +/* Test The Raster-Op */ +switch ( rasterOp ) { + case GXclear: /* 0x0 Zero 0 */ + color = 0 ; + break ; + case GXinvert: /* 0xa NOT dst */ + data_rotate_value = VGA_XOR_MODE << 8 ; + case GXset: /* 0xf 1 */ + color = VGA_ALLPLANES ; + break ; + case GXnor: /* 0x8 NOT src AND NOT dst */ + invert_existing_data = DO_RECURSE ; + case GXandInverted: /* 0x4 NOT src AND dst */ + color = ~color ; + case GXand: /* 0x1 src AND dst */ + data_rotate_value = VGA_AND_MODE << 8 ; + case GXcopy: /* 0x3 src */ + break ; + case GXequiv: /* 0x9 NOT src XOR dst */ + color = ~color ; + case GXxor: /* 0x6 src XOR dst */ + data_rotate_value = VGA_XOR_MODE << 8 ; + break ; + case GXandReverse: /* 0x2 src AND NOT dst */ + invert_existing_data = DO_RECURSE ; + data_rotate_value = VGA_AND_MODE << 8 ; + break ; + case GXorReverse: /* 0xb src OR NOT dst */ + invert_existing_data = DO_RECURSE ; + data_rotate_value = VGA_OR_MODE << 8 ; + break ; + case GXnand: /* 0xe NOT src OR NOT dst */ + invert_existing_data = DO_RECURSE ; + case GXorInverted: /* 0xd NOT src OR dst */ + color = ~color ; + case GXor: /* 0x7 src OR dst */ + data_rotate_value = VGA_OR_MODE << 8 ; + break ; + case GXcopyInverted: /* 0xc NOT src */ + color = ~color ; + break ; + case GXnoop: /* 0x5 dst */ + ; /* Shouldn't Get Here !! */ +} + +return ( color & VGA_ALLPLANES ) | data_rotate_value | invert_existing_data ; +} + +static void +vgaDrawMonoImage +( + WindowPtr pWin, /* GJA */ + unsigned char *data, + int x, + int y, + int w, + int h, + unsigned long int fg, + int alu, + unsigned long int planes +) +{ +unsigned long regState ; + +if ( !xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) { + xf4bppOffDrawMonoImage( pWin, data, x, y, w, h, fg, alu, planes ); + return; +} + +if ( ( alu == GXnoop ) || !( planes &= VGA_ALLPLANES ) ) + return ; + +#ifndef PC98_EGC +if ( ( regState = vgaCalcMonoMode( alu, fg ) ) & DO_RECURSE ) { + vgaDrawMonoImage( pWin, data, x, y, w, h, + VGA_ALLPLANES, GXinvert, planes ) ; + regState &= ~DO_RECURSE ; +} +#else +regState = vgaCalcMonoMode(alu, (char)fg); +#endif + + +vgaSetMonoRegisters( (DrawablePtr)pWin, planes, regState ) ; + +DoMonoSingle( pWin, w, x, y, (const unsigned char *) data, h, + w, ( ( w + 31 ) & ~31 ) >> 3, h, 0, 0 ) ; + + +return ; +} + +void +xf4bppFillStipple( pWin, pStipple, fg, alu, planes, x, y, w, h, xSrc, ySrc ) +WindowPtr pWin; /* GJA */ +register PixmapPtr const pStipple ; +unsigned long int fg ; +const int alu ; +unsigned long int planes ; +int x, y, w, h ; +const int xSrc, ySrc ; +{ +unsigned int width ; +unsigned int height ; +int xshift ; +int yshift ; +unsigned long regState ; + +if ( !xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) { + xf4bppOffFillStipple( pWin, pStipple, fg, alu, planes, + x, y, w, h, xSrc, ySrc ); + return; +} + +if ( ( alu == GXnoop ) || !( planes &= VGA_ALLPLANES ) ) + return ; + +#if 1 +if ( ( regState = vgaCalcMonoMode( alu, fg ) ) & DO_RECURSE ) { + xf4bppFillStipple( pWin, pStipple, VGA_ALLPLANES, GXinvert, planes, + x, y, w, h, xSrc, ySrc ) ; + regState &= ~DO_RECURSE ; +} +#else +regState = vgaCalcMonoMode(alu, (char)fg); +#endif + + +vgaSetMonoRegisters( (DrawablePtr)pWin, planes, regState ) ; + +/* Figure Bit Offsets & Source Address */ +width = pStipple->drawable.width ; +if ( ( xshift = ( x - xSrc ) ) < 0 ) + xshift = width - ( ( - xshift ) % width ) ; +else + xshift %= width ; +if ( xshift == (int)width ) xshift = 0; + +height = pStipple->drawable.height ; +if ( ( yshift = ( y - ySrc ) ) < 0 ) + yshift = height - ( ( - yshift ) % height ) ; +else + yshift %= height ; +if ( yshift == (int)height ) yshift = 0; + + (* ( (h > (int)height) ? DoMonoMany : DoMonoSingle ) ) ( + pWin, w, x, y, + (const unsigned char *) pStipple->devPrivate.ptr, + h, + width, + ( ( width + 31 ) & ((unsigned)(~31)) ) >> 3, + height, + xshift, yshift + ) ; + +return ; +} diff --git a/xorg-server/hw/xfree86/xf4bpp/vgaVideo.h b/xorg-server/hw/xfree86/xf4bpp/vgaVideo.h new file mode 100644 index 000000000..60afa5bb6 --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/vgaVideo.h @@ -0,0 +1,93 @@ +/* + * Copyright IBM Corporation 1987,1988,1989 + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * +*/ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include "misc.h" /* GJA -- for pointer data type */ +#ifdef lint +#if defined(volatile) +#undef volatile +#endif +#define volatile /**/ +#if defined(const) +#undef const +#endif +#define const /**/ +#if defined(signed) +#undef signed +#endif +#define signed /**/ +#endif + +/* + * References to all pc ( i.e. '286 ) memory in the + * regions used by the [ev]ga server ( the 128K windows ) + * MUST be long-word ( i.e. 32-bit ) reads or writes. + * This definition will change for other memory architectures + * ( e.g. AIX-Rt ) + */ +typedef unsigned char VideoAdapterObject ; +typedef volatile VideoAdapterObject *VideoMemoryPtr ; +typedef volatile VideoAdapterObject *VgaMemoryPtr ; +#if !defined(BITMAP_BIT_ORDER) +#define BITMAP_BIT_ORDER MSBFirst +#endif + +#if !defined(IMAGE_BYTE_ORDER) +#define IMAGE_BYTE_ORDER LSBFirst +#endif + +/* Bit Ordering Macros */ +#if !defined(SCRLEFT8) +#define SCRLEFT8(lw, n) ( (unsigned char) (((unsigned char) lw) << (n)) ) +#endif +#if !defined(SCRRIGHT8) +#define SCRRIGHT8(lw, n) ( (unsigned char) (((unsigned char)lw) >> (n)) ) +#endif +/* These work ONLY on 8-bit wide Quantities !! */ +#define LeftmostBit ( SCRLEFT8( 0xFF, 7 ) & 0xFF ) +#define RightmostBit ( SCRRIGHT8( 0xFF, 7 ) & 0xFF ) + +/* + * [ev]ga video screen defines & macros + */ +#define VGA_BLACK_PIXEL 0 +#define VGA_WHITE_PIXEL 1 + +#define VGA_MAXPLANES 4 +#define VGA_ALLPLANES 0xFL + +#define VIDBASE(pDraw) ((volatile unsigned char *) \ + (((PixmapPtr)(((DrawablePtr)(pDraw))->pScreen->devPrivate))-> \ + devPrivate.ptr)) +#define BYTES_PER_LINE(pDraw) \ + ((int)((PixmapPtr)(((DrawablePtr)(pDraw))->pScreen->devPrivate))->devKind) + +#define ROW_OFFSET( x ) ( ( x ) >> 3 ) +#define BIT_OFFSET( x ) ( ( x ) & 0x7 ) +#define SCREENADDRESS( pWin, x, y ) \ + ( VIDBASE(pWin) + (y) * BYTES_PER_LINE(pWin) + ROW_OFFSET(x) ) + + diff --git a/xorg-server/hw/xfree86/xf4bpp/vgamodule.c b/xorg-server/hw/xfree86/xf4bpp/vgamodule.c new file mode 100644 index 000000000..e7324914b --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/vgamodule.c @@ -0,0 +1,57 @@ +/* + * 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 <xorg-config.h> +#endif + +#include "xf86Module.h" + +static MODULESETUPPROTO(xf4bppSetup); + +static XF86ModuleVersionInfo VersRec = +{ + "xf4bpp", + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XORG_VERSION_CURRENT, + 1, 0, 0, + ABI_CLASS_ANSIC, /* Only need ansic layer */ + ABI_ANSIC_VERSION, + MOD_CLASS_NONE, + {0,0,0,0} /* signature, to be patched into the file by a tool */ +}; + +_X_EXPORT XF86ModuleData xf4bppModuleData = { &VersRec, xf4bppSetup, NULL }; + +static pointer +xf4bppSetup(pointer module, pointer opts, int *errmaj, int *errmin) +{ + /* This module requires xf1bpp for bitmap support */ + return LoadSubModule(module, "xf1bpp", NULL, NULL, NULL, NULL, + errmaj, errmin); +} diff --git a/xorg-server/hw/xfree86/xf4bpp/wm3.c b/xorg-server/hw/xfree86/xf4bpp/wm3.c new file mode 100644 index 000000000..3a57221f2 --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/wm3.c @@ -0,0 +1,203 @@ +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include "xf4bpp.h" +#include "OScompiler.h" +#include "wm3.h" +#include "vgaVideo.h" +#include "xf86.h" + +/* Ferraro is wrong. GJA */ +#define COPY (0 << 3) +#define AND (1 << 3) +#define OR (2 << 3) +#define XOR (3 << 3) + +int +wm3_set_regs(pGC) +GC *pGC; +{ +#ifndef PC98_EGC + IOADDRESS REGBASE = xf86Screens[pGC->pScreen->myNum]->domainIOBase + 0x300; + int post_invert = 0; + int ALU; + + switch(pGC->alu) { + case GXclear: /* rop0 = RROP_BLACK; rop1 = RROP_BLACK; */ + pGC->fgPixel = 0; + pGC->bgPixel = 0; + ALU = COPY; + break; + case GXand: /* rop0 = RROP_BLACK; rop1 = RROP_NOP; */ + ALU = AND; + break; + case GXandReverse: /* rop0 = RROP_BLACK; rop1 = RROP_INVERT; -- TRICKY */ + pGC->fgPixel = ~pGC->fgPixel; + pGC->bgPixel = ~pGC->bgPixel; + ALU = OR; + post_invert = 1; + break; + case GXcopy: /* rop0 = RROP_BLACK; rop1 = RROP_WHITE; */ + ALU = COPY; + break; + case GXandInverted: /* rop0 = RROP_NOP; rop1 = RROP_BLACK; */ + pGC->fgPixel = ~pGC->fgPixel; + pGC->bgPixel = ~pGC->bgPixel; + ALU = AND; + break; + default: + case GXnoop: /* rop0 = RROP_NOP; rop1 = RROP_NOP; */ + return 0; + case GXxor: /* rop0 = RROP_NOP; rop1 = RROP_INVERT; */ + ALU = XOR; + break; + case GXor: /* rop0 = RROP_NOP; rop1 = RROP_WHITE; */ + ALU = OR; + break; + case GXnor: /* rop0 = RROP_INVERT; rop1 = RROP_BLACK; -- TRICKY*/ + ALU = OR; + post_invert = 1; + break; + case GXequiv: /* rop0 = RROP_INVERT; rop1 = RROP_NOP; */ + pGC->fgPixel = ~pGC->fgPixel; + pGC->bgPixel = ~pGC->bgPixel; + ALU = XOR; + break; + case GXinvert: /* rop0 = RROP_INVERT; rop1 = RROP_INVERT; */ + pGC->fgPixel = 0x0F; + pGC->bgPixel = 0x0F; + ALU = XOR; + break; + case GXorReverse: /* rop0 = RROP_INVERT; rop1 = RROP_WHITE; -- TRICKY */ + pGC->fgPixel = ~pGC->fgPixel; + pGC->bgPixel = ~pGC->bgPixel; + ALU = AND; + post_invert = 1; + break; + case GXcopyInverted: /* rop0 = RROP_WHITE; rop1 = RROP_BLACK; */ + pGC->fgPixel = ~pGC->fgPixel; + pGC->bgPixel = ~pGC->bgPixel; + ALU = COPY; + break; + case GXorInverted: /* rop0 = RROP_WHITE; rop1 = RROP_NOP; */ + pGC->fgPixel = ~pGC->fgPixel; + pGC->bgPixel = ~pGC->bgPixel; + ALU = OR; + break; + case GXnand: /* rop0 = RROP_WHITE; rop1 = RROP_INVERT; -- TRICKY */ + ALU = AND; + post_invert = 1; + break; + case GXset: /* rop0 = RROP_WHITE; rop1 = RROP_WHITE; */ + pGC->fgPixel = 0x0F; + pGC->bgPixel = 0x0F; + ALU = COPY; + break; + } + + + SetVideoSequencer(Mask_MapIndex, (pGC->planemask & VGA_ALLPLANES)); + SetVideoGraphics(Enb_Set_ResetIndex, VGA_ALLPLANES); + SetVideoGraphics(Set_ResetIndex, pGC->fgPixel); + SetVideoGraphics(Bit_MaskIndex, 0xFF); + SetVideoGraphics(Graphics_ModeIndex, 3); /* Write Mode 3 */ + SetVideoGraphics(Data_RotateIndex, ALU); + + return post_invert; +#else + int ALU; + + switch(pGC->alu) { + case GXclear: /* rop0 = RROP_BLACK; rop1 = RROP_BLACK; */ + pGC->fgPixel = 0; + pGC->bgPixel = 0; + ALU = EGC_COPY_MODE; + break; + case GXand: /* rop0 = RROP_BLACK; rop1 = RROP_NOP; */ + ALU = EGC_AND_MODE; + break; + case GXandReverse: /* rop0 = RROP_BLACK; rop1 = RROP_INVERT; -- TRICKY */ + pGC->fgPixel = ~pGC->fgPixel; + pGC->bgPixel = ~pGC->bgPixel; + ALU = EGC_OR_INV_MODE; + break; + case GXcopy: /* rop0 = RROP_BLACK; rop1 = RROP_WHITE; */ + ALU = EGC_COPY_MODE; + break; + case GXandInverted: /* rop0 = RROP_NOP; rop1 = RROP_BLACK; */ + pGC->fgPixel = ~pGC->fgPixel; + pGC->bgPixel = ~pGC->bgPixel; + ALU = EGC_AND_MODE; + break; + case GXnoop: /* rop0 = RROP_NOP; rop1 = RROP_NOP; */ + return 0; + case GXxor: /* rop0 = RROP_NOP; rop1 = RROP_INVERT; */ + ALU = EGC_XOR_MODE; + break; + case GXor: /* rop0 = RROP_NOP; rop1 = RROP_WHITE; */ + ALU = EGC_OR_MODE; + break; + case GXnor: /* rop0 = RROP_INVERT; rop1 = RROP_BLACK; -- TRICKY*/ + ALU = EGC_OR_INV_MODE; + break; + case GXequiv: /* rop0 = RROP_INVERT; rop1 = RROP_NOP; */ + pGC->fgPixel = ~pGC->fgPixel; + pGC->bgPixel = ~pGC->bgPixel; + ALU = EGC_XOR_MODE; + break; + case GXinvert: /* rop0 = RROP_INVERT; rop1 = RROP_INVERT; */ + pGC->fgPixel = 0x0F; + pGC->bgPixel = 0x0F; + ALU = EGC_XOR_MODE; + break; + case GXorReverse: /* rop0 = RROP_INVERT; rop1 = RROP_WHITE; -- TRICKY */ + pGC->fgPixel = ~pGC->fgPixel; + pGC->bgPixel = ~pGC->bgPixel; + ALU = EGC_AND_INV_MODE; + break; + case GXcopyInverted: /* rop0 = RROP_WHITE; rop1 = RROP_BLACK; */ + pGC->fgPixel = ~pGC->fgPixel; + pGC->bgPixel = ~pGC->bgPixel; + ALU = EGC_COPY_MODE; + break; + case GXorInverted: /* rop0 = RROP_WHITE; rop1 = RROP_NOP; */ + pGC->fgPixel = ~pGC->fgPixel; + pGC->bgPixel = ~pGC->bgPixel; + ALU = EGC_OR_MODE; + break; + case GXnand: /* rop0 = RROP_WHITE; rop1 = RROP_INVERT; -- TRICKY */ + ALU = EGC_OR_INV_MODE; + break; + case GXset: /* rop0 = RROP_WHITE; rop1 = RROP_WHITE; */ + pGC->fgPixel = 0x0F; + pGC->bgPixel = 0x0F; + ALU = EGC_COPY_MODE; + break; + } + + outw(EGC_PLANE, ~(pGC->planemask & VGA_ALLPLANES)); + outw(EGC_MODE, ALU); + outw(EGC_FGC, pGC->fgPixel & VGA_ALLPLANES); /* set FGC */ + + return 0; +#endif +} + +/* + Now we will have to set the alu. + Problematic is: How do we handle IsDoubleDash, which draws with both fg + and bg colour? + The answer is: We take care to store the ink colour in one register only. + Then we need set only this register to change the ink. + */ + +/* -- MORE NOTES: + We might try to 'wrap' the mfb functions in a 16-colour wrapper that does + all operations once. However, this does not work: + Some operations (esp) CopyArea may for example cause expositions. + Such expositions will cause data to be copied in from backing store, + and this copying in may damage the contents of the VGA registers. + So we must take care to set the VGA registers at each place where they could + be modified. + */ diff --git a/xorg-server/hw/xfree86/xf4bpp/wm3.h b/xorg-server/hw/xfree86/xf4bpp/wm3.h new file mode 100644 index 000000000..113723283 --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/wm3.h @@ -0,0 +1,73 @@ +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include "vgaReg.h" + +#ifdef PC98_EGC +#define VGA_ALLPLANES 0xFL +#endif + +/* Do call in Write Mode 3. + * We take care of the possibility that two passes are needed. + */ +#ifndef PC98_EGC +#define DO_WM3(pgc,call) \ + { int _tp, _fg, _bg, _alu; \ + _fg = pgc->fgPixel; _bg = pgc->bgPixel; \ + _tp = wm3_set_regs(pgc); \ + (call); \ + if ( _tp ) { \ + _alu = pgc->alu; \ + pgc->alu = GXinvert; \ + _tp = wm3_set_regs(pgc); \ + (call); \ + pgc->alu = _alu; \ + } \ + pgc->fgPixel = _fg; pgc->bgPixel = _bg; \ + } +#else +#define DO_WM3(pgc,call) \ + { int _tp, _fg, _bg; \ + _fg = pgc->fgPixel; _bg = pgc->bgPixel; \ + _tp = wm3_set_regs(pgc); \ + (call); \ + pgc->fgPixel = _fg; pgc->bgPixel = _bg; \ + } +#endif + +#ifndef PC98_EGC +#define WM3_SET_INK(ink) \ + SetVideoGraphics(Set_ResetIndex, ink) +#else +#define WM3_SET_INK(ink) \ + outw(EGC_FGC, ink) +#endif + +/* GJA -- Move a long word to screen memory. + * The reads into 'dummy' are here to load the VGA latches. + * This is a RMW operation except for trivial cases. + * Notice that we ignore the operation. + */ +#ifdef PC98_EGC +#define UPDRW(destp,src) \ + { volatile unsigned short *_dtmp = \ + (volatile unsigned short *)(destp); \ + unsigned int _stmp = (src); \ + *_dtmp = _stmp; _dtmp++; _stmp >>= 16; \ + *_dtmp = _stmp; } +#else +#define UPDRW(destp,src) \ + { volatile char *_dtmp = (volatile char *)(destp); \ + unsigned int _stmp = (src); \ + volatile int dummy; /* Bit bucket. */ \ + _stmp = ldl_u(&_stmp); \ + dummy = *_dtmp; *_dtmp = _stmp; _dtmp++; _stmp >>= 8; \ + dummy = *_dtmp; *_dtmp = _stmp; _dtmp++; _stmp >>= 8; \ + dummy = *_dtmp; *_dtmp = _stmp; _dtmp++; _stmp >>= 8; \ + dummy = *_dtmp; *_dtmp = _stmp; } +#endif + +#define UPDRWB(destp,src) \ + { volatile int dummy; /* Bit bucket. */ \ + dummy = *(destp); *(destp) = (src); } diff --git a/xorg-server/hw/xfree86/xf4bpp/xf4bpp.h b/xorg-server/hw/xfree86/xf4bpp/xf4bpp.h new file mode 100644 index 000000000..cf0822444 --- /dev/null +++ b/xorg-server/hw/xfree86/xf4bpp/xf4bpp.h @@ -0,0 +1,622 @@ + +#ifndef __XF4BPP_H__ +#define __XF4BPP_H__ + + +#include "windowstr.h" +#include "gcstruct.h" +#include "colormapst.h" +#include <X11/fonts/fontstruct.h> +#ifndef PixelType +#define PixelType CARD32 +#endif + +/* ppcArea.c */ +void xf4bppFillArea( + WindowPtr, + int, + BoxPtr, + GCPtr +); + +/* ppcClip.c */ +void xf4bppDestroyClip( + GCPtr +); +void xf4bppChangeClip( + GCPtr, + int, + pointer, + int +); +void xf4bppCopyClip( + GCPtr, + GCPtr +); + +/* ppcCpArea.c */ +RegionPtr xf4bppCopyArea( + DrawablePtr, + DrawablePtr, + GCPtr, + int, + int, + int, + int, + int, + int +); + +/* ppcDepth.c */ +Bool xf4bppDepthOK( + DrawablePtr, + int +); + +/* ppcFillRct.c */ +void xf4bppPolyFillRect( + DrawablePtr, + GCPtr, + int, + xRectangle * +); + +/* ppcWindowFS.c */ +void xf4bppSolidWindowFS( + DrawablePtr, + GCPtr, + int, + DDXPointPtr, + int *, + int +); +void xf4bppStippleWindowFS( + DrawablePtr, + GCPtr, + int, + DDXPointPtr, + int *, + int +); +void xf4bppOpStippleWindowFS( + DrawablePtr, + GCPtr, + int, + DDXPointPtr, + int *, + int +); +void xf4bppTileWindowFS( + DrawablePtr, + GCPtr, + int, + DDXPointPtr, + int *, + int +); + +/* xf4bppPixmapFS.c */ +void xf4bppSolidPixmapFS( + DrawablePtr, + GCPtr, + int, + DDXPointPtr, + int *, + int +); +void xf4bppStipplePixmapFS( + DrawablePtr, + GCPtr, + int, + DDXPointPtr, + int *, + int +); +void xf4bppOpStipplePixmapFS( + DrawablePtr, + GCPtr, + int, + DDXPointPtr, + int *, + int +); +void xf4bppTilePixmapFS( + DrawablePtr, + GCPtr, + int, + DDXPointPtr, + int *, + int +); + +/* ppcGC.c */ +Bool xf4bppCreateGC( + GCPtr +); + +/* ppcGetSp.c */ +void xf4bppGetSpans( + DrawablePtr, + int, + DDXPointPtr, + int *, + int, + char * +); + +/* ppcImg.c */ +void xf4bppGetImage( + DrawablePtr, + int, + int, + int, + int, + unsigned int, + unsigned long, + char * +); + +/* ppcLine.c */ +void xf4bppScrnZeroLine( + DrawablePtr, + GCPtr, + int, + int, + DDXPointPtr +); +void xf4bppScrnZeroDash( + DrawablePtr, + GCPtr, + int, + int, + DDXPointPtr +); +void xf4bppScrnZeroSegs( + DrawablePtr, + GCPtr, + int, + xSegment * +); + +/* ppcPixmap.c */ +PixmapPtr xf4bppCreatePixmap( + ScreenPtr, + int, + int, + int, + unsigned +); +PixmapPtr xf4bppCopyPixmap( + PixmapPtr +); + +/* ppcPolyPnt.c */ +void xf4bppPolyPoint( + DrawablePtr, + GCPtr, + int, + int, + xPoint * +); + +/* ppcPolyRec.c */ +void xf4bppPolyRectangle( + DrawablePtr, + GCPtr, + int, + xRectangle * +); + +/* ppcQuery.c */ +void xf4bppQueryBestSize( + int, + unsigned short *, + unsigned short *, + ScreenPtr +); + +/* ppcRslvC.c */ +void xf4bppResolveColor( + unsigned short *, + unsigned short *, + unsigned short *, + VisualPtr +); +Bool xf4bppInitializeColormap( + ColormapPtr +); + +/* ppcSetSp.c */ +void xf4bppSetSpans( + DrawablePtr, + GCPtr, + char *, + DDXPointPtr, + int *, + int, + int +); + +/* ppcWindow.c */ +void xf4bppCopyWindow( + WindowPtr, + DDXPointRec, + RegionPtr +); +Bool xf4bppPositionWindow( + WindowPtr, + int, + int +); +Bool xf4bppUnrealizeWindow( + WindowPtr, + int, + int +); +Bool xf4bppDestroyWindow( + WindowPtr +); +Bool xf4bppCreateWindowForXYhardware( + WindowPtr +); + +/* emulOpStip.c */ +void xf4bppOpaqueStipple( + WindowPtr, + PixmapPtr, + unsigned long int, + unsigned long int, + int, + unsigned long int, + int, + int, + int, + int, + int, + int +); + +/* emulRepAre.c */ +void xf4bppReplicateArea( + WindowPtr, + int, + int, + int, + int, + int, + int, + int +); + +/* emulTile.c */ +void xf4bppTileRect( + WindowPtr, + PixmapPtr, + const int, + const unsigned long int, + int, + int, + int, + int, + int, + int +); + +/* vgaGC.c */ +Mask xf4bppChangeWindowGC( + GCPtr, + Mask +); + +/* vgaBitBlt.c */ +void xf4bppBitBlt( + WindowPtr, + int, + int, + int, + int, + int, + int, + int, + int +); + +/* vgaImages.c */ +void xf4bppDrawColorImage( + WindowPtr, + int, + int, + int, + int, + unsigned char *, + int, + const int, + const unsigned long int +); +void xf4bppReadColorImage( + WindowPtr, + int, + int, + int, + int, + unsigned char *, + int +); + +/* vgaLine.c */ +void xf4bppHorzLine( + WindowPtr, + unsigned long int, + int, + unsigned long int, + int, + int, + int +); +void xf4bppVertLine( + WindowPtr, + unsigned long int, + int, + unsigned long int, + int, + int, + int +); +void xf4bppBresLine( + WindowPtr, + unsigned long int, + int, + unsigned long int, + int, + int, + int, + int, + int, + int, + int, + int, + unsigned long int +); + +/* vgaStipple.c */ +void xf4bppFillStipple( + WindowPtr, + const PixmapPtr, + unsigned long int, + const int, + unsigned long int, + int, + int, + int, + int, + const int, + const int +); + +/* vgaSolid.c */ +void xf4bppFillSolid( + WindowPtr, + unsigned long int, + const int, + unsigned long int, + int, + const int, + int, + const int +); + +/* offscreen.c */ +void xf4bppOffBitBlt( + WindowPtr, + const int, + const int, + int, + int, + int, + int, + int, + int +); +void xf4bppOffDrawColorImage( + WindowPtr, + int, + int, + int, + int, + unsigned char *, + int, + const int, + const unsigned long int +); +void xf4bppOffReadColorImage( + WindowPtr, + int, + int, + int, + int, + unsigned char *, + int +); +void xf4bppOffFillSolid( + WindowPtr, + unsigned long int, + const int, + unsigned long int, + int, + const int, + int, + const int +); +void xf4bppOffDrawMonoImage( + WindowPtr, + unsigned char *, + int, + int, + int, + int, + unsigned long int, + int, + unsigned long int +); +void xf4bppOffFillStipple( + WindowPtr, + const PixmapPtr, + unsigned long int, + const int, + unsigned long int, + int, + int, + int, + int, + const int, + const int +); + +/* mfbimggblt.c */ +void xf4bppImageGlyphBlt( + DrawablePtr, + GCPtr, + int, + int, + unsigned int, + CharInfoPtr *, + pointer +); + +/* wm3.c */ +int wm3_set_regs( + GC * +); + +/* ppcIO.c */ +void xf4bppNeverCalled( + void +); +Bool xf4bppScreenInit( + ScreenPtr, + pointer, + int, + int, + int, + int, + int +); + +/* mfbfillarc.c */ +void xf4bppPolyFillArc( + DrawablePtr, + GCPtr, + int, + xArc * +); + +/* mfbzerarc.c */ +void xf4bppZeroPolyArc( + DrawablePtr, + GCPtr, + int, + xArc * +); + +/* mfbline.c */ +void xf4bppSegmentSS ( + DrawablePtr, + GCPtr, + int, + xSegment * +); +void xf4bppLineSS ( + DrawablePtr, + GCPtr, + int, + int, + DDXPointPtr +); +void xf4bppSegmentSD ( + DrawablePtr, + GCPtr, + int, + xSegment * +); +void xf4bppLineSD ( + DrawablePtr, + GCPtr, + int, + int, + DDXPointPtr +); + +/* mfbbres.c */ +void xf4bppBresS( + PixelType *, + int, + int, + int, + int, + int, + int, + int, + int, + int, + int +); + +/* mfbbresd.c */ +void xf4bppBresD( + DrawablePtr, + int, int, + int *, + unsigned char *, + int, + int *, + int, + PixelType *, + int, int, int, int, int, int, + int, int, + int, int +); + +/* mfbhrzvert.c */ +void xf4bppHorzS( + PixelType *, + int, + int, + int, + int +); +void xf4bppVertS( + PixelType *, + int, + int, + int, + int +); + +#ifdef PC98_EGC + +/* egc_asm.s */ +unsigned char getbits_x( + int, + unsigned int, + pointer, + unsigned int +); +void wcopyr( + pointer, + pointer, + int, + pointer +); +void wcopyl( + pointer, + pointer, + int, + pointer +); +unsigned long int read8Z( + pointer +); + +#endif /* PC98_EGC */ + +#endif /* __XF4BPP_H__ */ |