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/kdrive/mga | |
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/kdrive/mga')
-rw-r--r-- | xorg-server/hw/kdrive/mga/Makefile.am | 38 | ||||
-rw-r--r-- | xorg-server/hw/kdrive/mga/Makefile.in | 720 | ||||
-rw-r--r-- | xorg-server/hw/kdrive/mga/g400_common.h | 185 | ||||
-rw-r--r-- | xorg-server/hw/kdrive/mga/g400_composite.c | 510 | ||||
-rw-r--r-- | xorg-server/hw/kdrive/mga/mga.c | 240 | ||||
-rw-r--r-- | xorg-server/hw/kdrive/mga/mga.h | 164 | ||||
-rw-r--r-- | xorg-server/hw/kdrive/mga/mgadraw.c | 324 | ||||
-rw-r--r-- | xorg-server/hw/kdrive/mga/mgastub.c | 64 |
8 files changed, 2245 insertions, 0 deletions
diff --git a/xorg-server/hw/kdrive/mga/Makefile.am b/xorg-server/hw/kdrive/mga/Makefile.am new file mode 100644 index 000000000..a7dd2cbf6 --- /dev/null +++ b/xorg-server/hw/kdrive/mga/Makefile.am @@ -0,0 +1,38 @@ +INCLUDES = \ + @KDRIVE_INCS@ \ + -I$(top_srcdir)/hw/kdrive/vesa \ + @KDRIVE_CFLAGS@ + +bin_PROGRAMS = Xmga + +noinst_LIBRARIES = libmga.a + +libmga_a_SOURCES = \ + mgadraw.c \ + g400_composite.c \ + g400_common.h \ + mga.c \ + mga.h + +Xmga_SOURCES = \ + mgastub.c + +MGA_LIBS = \ + libmga.a \ + $(top_builddir)/hw/kdrive/vesa/libvesa.a \ + @KDRIVE_LIBS@ + +if GLX +Xmga_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) +endif + +Xmga_LDADD = \ + $(MGA_LIBS) \ + @KDRIVE_LIBS@ + +Xmga_DEPENDENCIES = \ + libmga.a \ + @KDRIVE_LOCAL_LIBS@ + +relink: + rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS) diff --git a/xorg-server/hw/kdrive/mga/Makefile.in b/xorg-server/hw/kdrive/mga/Makefile.in new file mode 100644 index 000000000..45b95f2e0 --- /dev/null +++ b/xorg-server/hw/kdrive/mga/Makefile.in @@ -0,0 +1,720 @@ +# 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@ +bin_PROGRAMS = Xmga$(EXEEXT) +subdir = hw/kdrive/mga +DIST_COMMON = $(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 = +LIBRARIES = $(noinst_LIBRARIES) +ARFLAGS = cru +libmga_a_AR = $(AR) $(ARFLAGS) +libmga_a_LIBADD = +am_libmga_a_OBJECTS = mgadraw.$(OBJEXT) g400_composite.$(OBJEXT) \ + mga.$(OBJEXT) +libmga_a_OBJECTS = $(am_libmga_a_OBJECTS) +am__installdirs = "$(DESTDIR)$(bindir)" +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) +am_Xmga_OBJECTS = mgastub.$(OBJEXT) +Xmga_OBJECTS = $(am_Xmga_OBJECTS) +am__DEPENDENCIES_1 = libmga.a $(top_builddir)/hw/kdrive/vesa/libvesa.a +Xmga_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(Xmga_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 = $(libmga_a_SOURCES) $(Xmga_SOURCES) +DIST_SOURCES = $(libmga_a_SOURCES) $(Xmga_SOURCES) +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@ +INCLUDES = \ + @KDRIVE_INCS@ \ + -I$(top_srcdir)/hw/kdrive/vesa \ + @KDRIVE_CFLAGS@ + +noinst_LIBRARIES = libmga.a +libmga_a_SOURCES = \ + mgadraw.c \ + g400_composite.c \ + g400_common.h \ + mga.c \ + mga.h + +Xmga_SOURCES = \ + mgastub.c + +MGA_LIBS = \ + libmga.a \ + $(top_builddir)/hw/kdrive/vesa/libvesa.a \ + @KDRIVE_LIBS@ + +@GLX_TRUE@Xmga_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) +Xmga_LDADD = \ + $(MGA_LIBS) \ + @KDRIVE_LIBS@ + +Xmga_DEPENDENCIES = \ + libmga.a \ + @KDRIVE_LOCAL_LIBS@ + +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/kdrive/mga/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign hw/kdrive/mga/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 + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libmga.a: $(libmga_a_OBJECTS) $(libmga_a_DEPENDENCIES) + -rm -f libmga.a + $(libmga_a_AR) libmga.a $(libmga_a_OBJECTS) $(libmga_a_LIBADD) + $(RANLIB) libmga.a +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +Xmga$(EXEEXT): $(Xmga_OBJECTS) $(Xmga_DEPENDENCIES) + @rm -f Xmga$(EXEEXT) + $(Xmga_LINK) $(Xmga_OBJECTS) $(Xmga_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g400_composite.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mga.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mgadraw.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mgastub.Po@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 + +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 $(LIBRARIES) $(PROGRAMS) +installdirs: + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(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) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-libtool \ + clean-noinstLIBRARIES 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-dvi: install-dvi-am + +install-exec-am: install-binPROGRAMS + +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-binPROGRAMS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libtool clean-noinstLIBRARIES ctags \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-binPROGRAMS \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-binPROGRAMS + + +relink: + rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS) +# 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/kdrive/mga/g400_common.h b/xorg-server/hw/kdrive/mga/g400_common.h new file mode 100644 index 000000000..9f16d2431 --- /dev/null +++ b/xorg-server/hw/kdrive/mga/g400_common.h @@ -0,0 +1,185 @@ +/* + * Copyright © 2004 Damien Ciabrini + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Anders Carlsson not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Anders Carlsson makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * DAMIEN CIABRINI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ANDERS CARLSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef __G400_COMMON_H__ +#define __G400_COMMON_H__ + +/* Color registers */ +#define MGA_REG_DR4 (0x1CD0) +#define MGA_REG_DR6 (0x1CD8) +#define MGA_REG_DR7 (0x1CDC) +#define MGA_REG_DR8 (0x1CE0) +#define MGA_REG_DR10 (0x1CE8) +#define MGA_REG_DR11 (0x1CEC) +#define MGA_REG_DR12 (0x1CF0) +#define MGA_REG_DR14 (0x1CF8) +#define MGA_REG_DR15 (0x1CFC) + +/* Alpha registers */ +#define MGA_REG_ALPHASTART (0x2C70) +#define MGA_REG_ALPHAXINC (0x2C74) +#define MGA_REG_ALPHAYINC (0x2C78) +#define MGA_REG_ALPHACTRL (0x2C7C) +# define MGA_SRC_ZERO (0x00000000) +# define MGA_SRC_ONE (0x00000001) +# define MGA_SRC_DST_COLOR (0x00000002) +# define MGA_SRC_ONE_MINUS_DST_COLOR (0x00000003) +# define MGA_SRC_ALPHA (0x00000004) +# define MGA_SRC_ONE_MINUS_SRC_ALPHA (0x00000005) +# define MGA_SRC_DST_ALPHA (0x00000006) +# define MGA_SRC_ONE_MINUS_DST_ALPHA (0x00000007) +# define MGA_SRC_SRC_ALPHA_SATURATE (0x00000008) +# define MGA_SRC_BLEND_MASK (0x0000000f) + +# define MGA_DST_ZERO (0x00000000) +# define MGA_DST_ONE (0x00000010) +# define MGA_DST_SRC_COLOR (0x00000020) +# define MGA_DST_ONE_MINUS_SRC_COLOR (0x00000030) +# define MGA_DST_SRC_ALPHA (0x00000040) +# define MGA_DST_ONE_MINUS_SRC_ALPHA (0x00000050) +# define MGA_DST_DST_ALPHA (0x00000060) +# define MGA_DST_ONE_MINUS_DST_ALPHA (0x00000070) +# define MGA_DST_BLEND_MASK (0x00000070) + +# define MGA_ALPHACHANNEL (0x00000100) +# define MGA_VIDEOALPHA (0x00000200) +# define MGA_DIFFUSEDALPHA (0x01000000) +# define MGA_MODULATEDALPHA (0x02000000) + +/* Textures registers */ +#define MGA_REG_TEXORG (0x2c24) +#define MGA_REG_TEXORG1 (0x2ca4) +#define MGA_REG_TEXWIDTH (0x2C28) +#define MGA_REG_TEXHEIGHT (0x2C2C) +#define MGA_REG_TMR0 (0x2C00) +#define MGA_REG_TMR1 (0x2C04) +#define MGA_REG_TMR2 (0x2C08) +#define MGA_REG_TMR3 (0x2C0C) +#define MGA_REG_TMR4 (0x2C10) +#define MGA_REG_TMR5 (0x2C14) +#define MGA_REG_TMR6 (0x2C18) +#define MGA_REG_TMR7 (0x2C1C) +#define MGA_REG_TMR8 (0x2C20) + +/* Texture Control Registers */ +#define MGA_REG_TEXCTL (0x2C30) +# define MGA_TW4 (0x00000000) +# define MGA_TW8 (0x00000001) +# define MGA_TW15 (0x00000002) +# define MGA_TW16 (0x00000003) +# define MGA_TW12 (0x00000004) +# define MGA_TW32 (0x00000006) +# define MGA_TW8A (0x00000007) +# define MGA_TW8AL (0x00000008) +# define MGA_TW422 (0x0000000A) +# define MGA_TW422UYVY (0x0000000B) +# define MGA_PITCHLIN (0x00000100) +# define MGA_NOPERSPECTIVE (0x00200000) +# define MGA_TAKEY (0x02000000) +# define MGA_TAMASK (0x04000000) +# define MGA_CLAMPUV (0x18000000) +#define MGA_REG_TEXCTL2 (0x2C3C) +# define MGA_G400_TC2_MAGIC (0x00008000) +# define MGA_TC2_DECALBLEND (0x00000001) +# define MGA_TC2_IDECAL (0x00000002) +# define MGA_TC2_DECALDIS (0x00000004) +# define MGA_TC2_CKSTRANSDIS (0x00000010) +# define MGA_TC2_BORDEREN (0x00000020) +# define MGA_TC2_SPECEN (0x00000040) +# define MGA_TC2_DUALTEX (0x00000080) +# define MGA_TC2_TABLEFOG (0x00000100) +# define MGA_TC2_BUMPMAP (0x00000200) +# define MGA_TC2_SELECT_TMU1 (0x80000000) +#define MGA_REG_TEXFILTER (0x2C58) +# define MGA_MIN_NRST (0x00000000) +# define MGA_MIN_BILIN (0x00000002) +# define MGA_MIN_ANISO (0x0000000D) +# define MGA_MAG_NRST (0x00000000) +# define MGA_MAG_BILIN (0x00000020) + +/* Multi-Textures Control Registers */ +#define MGA_REG_TDUALSTAGE0 (0x2CF8) +#define MGA_REG_TDUALSTAGE1 (0x2CFC) +# define MGA_TDS_COLOR_ARG2_DIFFUSE (0x00000000) +# define MGA_TDS_COLOR_ARG2_SPECULAR (0x00000001) +# define MGA_TDS_COLOR_ARG2_FCOL (0x00000002) +# define MGA_TDS_COLOR_ARG2_PREVSTAGE (0x00000003) +# define MGA_TDS_COLOR_ALPHA_DIFFUSE (0x00000000) +# define MGA_TDS_COLOR_ALPHA_FCOL (0x00000004) +# define MGA_TDS_COLOR_ALPHA_CURRTEX (0x00000008) +# define MGA_TDS_COLOR_ALPHA_PREVTEX (0x0000000c) +# define MGA_TDS_COLOR_ALPHA_PREVSTAGE (0x00000010) +# define MGA_TDS_COLOR_ARG1_REPLICATEALPHA (0x00000020) +# define MGA_TDS_COLOR_ARG1_INV (0x00000040) +# define MGA_TDS_COLOR_ARG2_REPLICATEALPHA (0x00000080) +# define MGA_TDS_COLOR_ARG2_INV (0x00000100) +# define MGA_TDS_COLOR_ALPHA1INV (0x00000200) +# define MGA_TDS_COLOR_ALPHA2INV (0x00000400) +# define MGA_TDS_COLOR_ARG1MUL_ALPHA1 (0x00000800) +# define MGA_TDS_COLOR_ARG2MUL_ALPHA2 (0x00001000) +# define MGA_TDS_COLOR_ARG1ADD_MULOUT (0x00002000) +# define MGA_TDS_COLOR_ARG2ADD_MULOUT (0x00004000) +# define MGA_TDS_COLOR_MODBRIGHT_2X (0x00008000) +# define MGA_TDS_COLOR_MODBRIGHT_4X (0x00010000) +# define MGA_TDS_COLOR_ADD_SUB (0x00000000) +# define MGA_TDS_COLOR_ADD_ADD (0x00020000) +# define MGA_TDS_COLOR_ADD2X (0x00040000) +# define MGA_TDS_COLOR_ADDBIAS (0x00080000) +# define MGA_TDS_COLOR_BLEND (0x00100000) +# define MGA_TDS_COLOR_SEL_ARG1 (0x00000000) +# define MGA_TDS_COLOR_SEL_ARG2 (0x00200000) +# define MGA_TDS_COLOR_SEL_ADD (0x00400000) +# define MGA_TDS_COLOR_SEL_MUL (0x00600000) +# define MGA_TDS_ALPHA_ARG1_INV (0x00800000) +# define MGA_TDS_ALPHA_ARG2_DIFFUSE (0x00000000) +# define MGA_TDS_ALPHA_ARG2_FCOL (0x01000000) +# define MGA_TDS_ALPHA_ARG2_PREVTEX (0x02000000) +# define MGA_TDS_ALPHA_ARG2_PREVSTAGE (0x03000000) +# define MGA_TDS_ALPHA_ARG2_INV (0x04000000) +# define MGA_TDS_ALPHA_ADD (0x08000000) +# define MGA_TDS_ALPHA_ADDBIAS (0x10000000) +# define MGA_TDS_ALPHA_ADD2X (0x20000000) +# define MGA_TDS_ALPHA_SEL_ARG1 (0x00000000) +# define MGA_TDS_ALPHA_SEL_ARG2 (0x40000000) +# define MGA_TDS_ALPHA_SEL_ADD (0x80000000) +# define MGA_TDS_ALPHA_SEL_MUL (0xc0000000) + + + +/* Composition Prototypes. MMIO Access */ +Bool +mgaCheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, + PicturePtr pDstPicture); + +Bool +mgaPrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, + PicturePtr pDstPicture, PixmapPtr pSrc, + PixmapPtr pMask, PixmapPtr pDst); + +void +mgaComposite(int srcX, int srcY, int maskX, int maskY, + int dstX, int dstY, int w, int h); + +void +mgaDoneComposite(void); + +#endif diff --git a/xorg-server/hw/kdrive/mga/g400_composite.c b/xorg-server/hw/kdrive/mga/g400_composite.c new file mode 100644 index 000000000..dda9d9347 --- /dev/null +++ b/xorg-server/hw/kdrive/mga/g400_composite.c @@ -0,0 +1,510 @@ +/* + * Copyright © 2004 Damien Ciabrini + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Anders Carlsson not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Anders Carlsson makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * DAMIEN CIABRINI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ANDERS CARLSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +#include <kdrive-config.h> +#endif + +#include "mga.h" +#include "g400_common.h" + + +static PicturePtr currentSrcPicture; +static PicturePtr currentMaskPicture; +static PixmapPtr currentSrc; +static PixmapPtr currentMask; +static int src_w2; +static int src_h2; +static int mask_w2; +static int mask_h2; + +struct blendinfo { + Bool dst_alpha; + Bool src_alpha; + CARD32 blend_cntl; +}; + +static struct blendinfo mgaBlendOP[] = { + /* Clear */ + {0, 0, MGA_SRC_ZERO | MGA_DST_ZERO}, + /* Src */ + {0, 0, MGA_SRC_ONE | MGA_DST_ZERO}, + /* Dst */ + {0, 0, MGA_SRC_ZERO | MGA_DST_ONE}, + /* Over */ + {0, 1, MGA_SRC_ONE | MGA_DST_ONE_MINUS_SRC_ALPHA}, + /* OverReverse */ + {1, 0, MGA_SRC_ONE_MINUS_DST_ALPHA | MGA_DST_ONE}, + /* In */ + {1, 0, MGA_SRC_DST_ALPHA | MGA_DST_ZERO}, + /* InReverse */ + {0, 1, MGA_SRC_ZERO | MGA_DST_SRC_ALPHA}, + /* Out */ + {1, 0, MGA_SRC_ONE_MINUS_DST_ALPHA | MGA_DST_ZERO}, + /* OutReverse */ + {0, 1, MGA_SRC_ZERO | MGA_DST_ONE_MINUS_SRC_ALPHA}, + /* Atop */ + {1, 1, MGA_SRC_DST_ALPHA | MGA_DST_ONE_MINUS_SRC_ALPHA}, + /* AtopReverse */ + {1, 1, MGA_SRC_ONE_MINUS_DST_ALPHA | MGA_DST_SRC_ALPHA}, + /* Xor */ + {1, 1, MGA_SRC_ONE_MINUS_DST_ALPHA | MGA_DST_ONE_MINUS_SRC_ALPHA}, + /* Add */ + {0, 0, MGA_SRC_ONE | MGA_DST_ONE}, +}; + +struct formatinfo { + int fmt; + CARD32 card_fmt; +}; + +static struct formatinfo texformats[] = { + {PICT_a8r8g8b8, MGA_TW32}, + {PICT_x8r8g8b8, MGA_TW32}, + {PICT_r5g6b5, MGA_TW16}, + {PICT_a1r5g5b5, MGA_TW15}, + {PICT_x1r5g5b5, MGA_TW15}, + {PICT_a4r4g4b4, MGA_TW12}, + {PICT_x4r4g4b4, MGA_TW12}, + {PICT_a8, MGA_TW8A}, +}; + +static int +MGA_LOG2( int val ) +{ + int ret = 0; + if (val==1) return 0; + while (val >> ret) + ret++; + + return ((1 << (ret-1)) == val) ? (ret-1) : ret; +} + + +static Bool +mgaCheckSourceTexture (int tmu, + PicturePtr pPict) +{ + int w = pPict->pDrawable->width; + int h = pPict->pDrawable->height; + int i; + CARD32 texctl = 0; + + if ((w > 2047) || (h > 2047)) + MGA_FALLBACK(("Picture w/h too large (%dx%d)\n", w, h)); + + for (i = 0; i < sizeof(texformats) / sizeof(texformats[0]); i++) { + if (texformats[i].fmt == pPict->format) { + texctl = texformats[i].card_fmt; + break; + } + } + if (texctl == 0) { + MGA_FALLBACK(("Unsupported picture format 0x%x\n", pPict->format)); + } + + if (pPict->repeat && ((w & (w - 1)) != 0 || (h & (h - 1)) != 0)) + MGA_FALLBACK(("NPOT repeat unsupported (%dx%d)\n", w, h)); + + if (pPict->filter != PictFilterNearest && + pPict->filter != PictFilterBilinear) + MGA_FALLBACK(("Unsupported filter 0x%x\n", pPict->filter)); + + return TRUE; +} + +static Bool +PrepareSourceTexture (int tmu, + PicturePtr pSrcPicture, + PixmapPtr pSrc) +{ + KdScreenPriv (pSrc->drawable.pScreen); + int mem_base=(int)pScreenPriv->screen->memory_base; + int pitch = pSrc->devKind / (pSrc->drawable.bitsPerPixel >> 3); + int i; + + int w = pSrc->drawable.width; + int h = pSrc->drawable.height; + int w_log2 = MGA_LOG2(w); + int h_log2 = MGA_LOG2(h); + + int texctl = MGA_PITCHLIN | ((pitch & (2048 - 1)) << 9) | + MGA_CLAMPUV | MGA_NOPERSPECTIVE; + int flags = 0; + int texctl2 = MGA_G400_TC2_MAGIC | flags; + + for (i = 0; i < sizeof(texformats) / sizeof(texformats[0]); i++) { + if (texformats[i].fmt == pSrcPicture->format) { + texctl |= texformats[i].card_fmt; + break; + } + } + + if (PICT_FORMAT_A(pSrcPicture->format) != 0) { + texctl |= MGA_TAKEY; + } else { + texctl |= MGA_TAMASK | MGA_TAKEY; + } + + if (pSrcPicture->repeat) { + texctl &= ~MGA_CLAMPUV; + } + + if (tmu == 1) + texctl2 |= MGA_TC2_DUALTEX | MGA_TC2_SELECT_TMU1 | flags; + + mgaWaitAvail (6); + MGA_OUT32 (mmio, MGA_REG_TEXCTL2, texctl2); + MGA_OUT32 (mmio, MGA_REG_TEXCTL, texctl); + /* Source (texture) address + pitch */ + MGA_OUT32 (mmio, MGA_REG_TEXORG, ((int)pSrc->devPrivate.ptr - mem_base)); + MGA_OUT32 (mmio, MGA_REG_TEXWIDTH, (w-1)<<18 | ((8-w_log2)&63)<<9 | w_log2); + MGA_OUT32 (mmio, MGA_REG_TEXHEIGHT, (h-1)<<18 | ((8-h_log2)&63)<<9 | h_log2); + /* Set blit filtering flags */ + if (pSrcPicture->filter == PictFilterBilinear) { + MGA_OUT32 (mmio, MGA_REG_TEXFILTER, + (0x10<<21) | MGA_MAG_BILIN | MGA_MIN_BILIN); + } else { + MGA_OUT32 (mmio, MGA_REG_TEXFILTER, + (0x10<<21) | MGA_MAG_NRST | MGA_MIN_NRST); + } + + if (tmu == 1) { + mgaWaitAvail (1); + MGA_OUT32 (mmio, MGA_REG_TEXCTL2, MGA_G400_TC2_MAGIC | MGA_TC2_DUALTEX | flags); + } + + return TRUE; +} + + +/* + * The formals params are the elements of the following matrix: + * + * Dest Transform Src + * coords coords + * / Xdst \ / X_incx X_incy X_init \ / Xsrc \ + * | Ydst | = | Y_incx Y_incy Y_init | x | Ysrc | + * \ 1 / \ H_incx H_incy H_init / \ 1 / + * + * matrix elements are 32bits fixed points (16.16) + * mga_fx_* is the size of the fixed point for the TMU + */ +static void +setTMIncrementsRegs(int X_incx, + int X_incy, + int X_init, + int Y_incx, + int Y_incy, + int Y_init, + int H_incx, + int H_incy, + int H_init, + int mga_fx_width_size, + int mga_fx_height_size) { + int decalw = mga_fx_width_size - 16; + int decalh = mga_fx_height_size - 16; + + /* Convert 16 bits fixpoint -> MGA variable size fixpoint */ + if (decalw >= 0) { + X_incx = X_incx << decalw; + X_incy = X_incy << decalw; + X_init = X_init << decalw; + } else { + decalw =- decalw; + X_incx = X_incx >> decalw; + X_incy = X_incy >> decalw; + X_init = X_init >> decalw; + } + + /* Convert 16 bits fixpoint -> MGA variable size fixpoint */ + if (decalh >= 0) { + Y_incx = Y_incx << decalh; + Y_incy = Y_incy << decalh; + Y_init = Y_init << decalh; + } else { + decalh =- decalh; + Y_incx = Y_incx >> decalh; + Y_incy = Y_incy >> decalh; + Y_init = Y_init >> decalh; + } + + /* Set TM registers */ + mgaWaitAvail (9); + MGA_OUT32 (mmio, MGA_REG_TMR0, X_incx); + MGA_OUT32 (mmio, MGA_REG_TMR1, Y_incx); + MGA_OUT32 (mmio, MGA_REG_TMR2, X_incy); + MGA_OUT32 (mmio, MGA_REG_TMR3, Y_incy); + MGA_OUT32 (mmio, MGA_REG_TMR4, H_incx); + MGA_OUT32 (mmio, MGA_REG_TMR5, H_incy); + MGA_OUT32 (mmio, MGA_REG_TMR6, X_init); + MGA_OUT32 (mmio, MGA_REG_TMR7, Y_init); + MGA_OUT32 (mmio, MGA_REG_TMR8, H_init); +} + + + + +Bool +mgaCheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, + PicturePtr pDstPicture) +{ + if (op >= sizeof(mgaBlendOP) / sizeof(mgaBlendOP[0])) + MGA_FALLBACK(("unsupported op %x", op)); + if (!mgaCheckSourceTexture (0, pSrcPicture)) + return FALSE; + + if (pMaskPicture != NULL) { + if (PICT_FORMAT_A(pMaskPicture->format) == 0) + MGA_FALLBACK(("Mask without alpha unsupported")); + if (!mgaCheckSourceTexture (1, pMaskPicture)) + return FALSE; + } + + if (pMaskPicture->componentAlpha) + MGA_FALLBACK(("Component alpha unsupported")); + + if (pDstPicture->format == PICT_a8) + MGA_FALLBACK(("render to A8 unsupported")); + + return TRUE; +} + +#define C_ARG1_CUR 0x0 +#define C_ARG1_ALPHA MGA_TDS_COLOR_ARG1_REPLICATEALPHA +#define C_ARG2_DIFFUSE MGA_TDS_COLOR_ARG2_DIFFUSE +#define C_ARG2_FCOL MGA_TDS_COLOR_ARG2_FCOL +#define C_ARG2_PREV MGA_TDS_COLOR_ARG2_PREVSTAGE +#define C_ARG1_INV MGA_TDS_COLOR_ARG1_INV +#define C_ARG2_INV MGA_TDS_COLOR_ARG2_INV +#define COLOR_MUL MGA_TDS_COLOR_SEL_MUL +#define COLOR_ARG1 MGA_TDS_COLOR_SEL_ARG1 +#define COLOR_ARG2 MGA_TDS_COLOR_SEL_ARG2 +#define A_ARG1_CUR 0x0 +#define A_ARG2_IGN A_ARG2_DIFFUSE +#define A_ARG2_FCOL MGA_TDS_ALPHA_ARG2_FCOL +#define A_ARG2_DIFFUSE MGA_TDS_ALPHA_ARG2_DIFFUSE +#define A_ARG2_PREV MGA_TDS_ALPHA_ARG2_PREVSTAGE +#define ALPHA_MUL MGA_TDS_ALPHA_SEL_MUL +#define ALPHA_ARG1 MGA_TDS_ALPHA_SEL_ARG1 +#define ALPHA_ARG2 MGA_TDS_ALPHA_SEL_ARG2 + + +Bool +mgaPrepareComposite (int op, + PicturePtr pSrcPicture, + PicturePtr pMaskPicture, + PicturePtr pDstPicture, + PixmapPtr pSrc, + PixmapPtr pMask, + PixmapPtr pDst) +{ + KdScreenPriv (pSrc->drawable.pScreen); + int mem_base=(int)pScreenPriv->screen->memory_base; + int cmd, blendcntl; + int ds0, ds1; + + /* Init MGA (clipping) */ + mgaSetup (pSrc->drawable.pScreen, pDst->drawable.bitsPerPixel, 1); + + /* Initialize fg color to 0, used in the src = A8 case */ + MGA_OUT32 (mmio, MGA_REG_FCOL, 0xff000000); + + /* Destination flags */ + mgaWaitAvail (2); + MGA_OUT32 (mmio, MGA_REG_DSTORG, ((int)pDst->devPrivate.ptr - mem_base)); + MGA_OUT32 (mmio, MGA_REG_PITCH, + pDst->devKind / (pDst->drawable.bitsPerPixel >> 3)); + + + /* Source(s) flags */ + if (!PrepareSourceTexture (0, pSrcPicture, pSrc)) return FALSE; + if (pMask != NULL) { + if (!PrepareSourceTexture (1, pMaskPicture, pMask)) return FALSE; + } + + /* Prepare multi-texture registers */ + ds0=ds1=0; + + if (pSrcPicture->format == PICT_a8) { + /* C = 0 A = As */ + /* MGA HW: A8 format makes RGB white. We use FCOL for the black + * If FCOL was not 0, it would have been be premultiplied (RENDER) + * color component would have been: + * C_ARG1_ALPHA | C_ARG2_FCOL | COLOR_MUL + */ + ds0=C_ARG2_FCOL | COLOR_ARG2 | + A_ARG1_CUR | ALPHA_ARG1; + /* MGA HW: TMU1 must be enabled when DUALSTAGE0 contains something */ + if (pMask == NULL) { + if (!PrepareSourceTexture (1, pSrcPicture, pSrc)) return FALSE; + ds1=C_ARG2_PREV | COLOR_ARG2 | + A_ARG2_PREV | ALPHA_ARG2; + } + } else { + /* C = Cs A = As */ + ds0=C_ARG1_CUR | COLOR_ARG1 | + A_ARG1_CUR | ALPHA_ARG1; + } + + if (pMask != NULL) { + /* As or Am might be NULL. in this case we don't multiply because, + * the alpha component holds garbage. + */ + int color,alpha; + if (PICT_FORMAT_A (pMaskPicture->format) == 0) { + /* C = Cs */ + color = C_ARG2_PREV | COLOR_ARG2; + } else { + /* C = Am * Cs */ + color = C_ARG1_ALPHA | C_ARG2_PREV | COLOR_MUL; + } + + if (PICT_FORMAT_A (pMaskPicture->format) == 0) { + /* A = As */ + alpha = A_ARG2_PREV | ALPHA_ARG2; + } else if (PICT_FORMAT_A (pSrcPicture->format) == 0) { + /* A = Am */ + alpha = A_ARG1_CUR | ALPHA_ARG1; + } else { + /* A = Am * As */ + alpha = A_ARG1_CUR | A_ARG2_PREV | ALPHA_MUL; + } + + ds1 = color | alpha; + } + + /* MultiTexture modulation */ + mgaWaitAvail (2); + MGA_OUT32 (mmio, MGA_REG_TDUALSTAGE0, ds0); + MGA_OUT32 (mmio, MGA_REG_TDUALSTAGE1, ds1); + + + cmd = MGA_OPCOD_TEXTURE_TRAP | MGA_ATYPE_RSTR | 0x000c0000 | + MGA_DWGCTL_SHIFTZERO | MGA_DWGCTL_SGNZERO | MGA_DWGCTL_ARZERO | + MGA_ATYPE_I; + + blendcntl = mgaBlendOP[op].blend_cntl; + if (PICT_FORMAT_A(pDstPicture->format) == 0 && mgaBlendOP[op].dst_alpha) { + if ((blendcntl & MGA_SRC_BLEND_MASK) == MGA_SRC_DST_ALPHA) + blendcntl = (blendcntl & ~MGA_SRC_BLEND_MASK) | MGA_SRC_ONE; + else if ((blendcntl & MGA_SRC_BLEND_MASK) == MGA_SRC_ONE_MINUS_DST_ALPHA) + blendcntl = (blendcntl & ~MGA_SRC_BLEND_MASK) | MGA_SRC_ZERO; + } + + mgaWaitAvail (2); + MGA_OUT32 (mmio, MGA_REG_DWGCTL, cmd); + MGA_OUT32 (mmio, MGA_REG_ALPHACTRL, MGA_ALPHACHANNEL | blendcntl); + + currentSrcPicture = pSrcPicture; + currentMaskPicture = pMaskPicture; + currentSrc = pSrc; + currentMask = pMask; + src_w2 = MGA_LOG2 (currentSrc->drawable.width); + src_h2 = MGA_LOG2 (currentSrc->drawable.height); + mask_w2 = MGA_LOG2 (currentMask->drawable.width); + mask_h2 = MGA_LOG2 (currentMask->drawable.height); + + return TRUE; +} + + +void +mgaComposite (int srcX, + int srcY, + int maskX, + int maskY, + int dstX, + int dstY, + int width, + int height) +{ + /* Source positions can be outside source textures' boundaries. + * We clamp the values here to avoid rendering glitches. + */ + srcX=srcX % currentSrc->drawable.width; + srcY=srcY % currentSrc->drawable.height; + maskX=maskX % currentMask->drawable.width; + maskY=maskY % currentMask->drawable.height; + + if (currentSrcPicture->transform) { + setTMIncrementsRegs (currentSrcPicture->transform->matrix[0][0], + currentSrcPicture->transform->matrix[0][1], + currentSrcPicture->transform->matrix[0][2] + + (srcX << 16), + currentSrcPicture->transform->matrix[1][0], + currentSrcPicture->transform->matrix[1][1], + currentSrcPicture->transform->matrix[1][2] + + (srcY << 16), + currentSrcPicture->transform->matrix[2][0], + currentSrcPicture->transform->matrix[2][1], + currentSrcPicture->transform->matrix[2][2], + 20-src_w2, 20-src_h2); + } else { + setTMIncrementsRegs (1 << 16, 0, srcX << 16, + 0, 1 << 16, srcY << 16, + 0, 0, 0x10000, + 20-src_w2, 20-src_h2); + } + + if (currentMask != NULL) { + mgaWaitAvail (1); + MGA_OUT32 (mmio, MGA_REG_TEXCTL2, + MGA_G400_TC2_MAGIC | MGA_TC2_DUALTEX | MGA_TC2_SELECT_TMU1); + if (currentMaskPicture->transform) { + setTMIncrementsRegs (currentMaskPicture->transform->matrix[0][0], + currentMaskPicture->transform->matrix[0][1], + currentMaskPicture->transform->matrix[0][2] + + (maskX << 16), + currentMaskPicture->transform->matrix[1][0], + currentMaskPicture->transform->matrix[1][1], + currentMaskPicture->transform->matrix[1][2] + + (maskY << 16), + currentMaskPicture->transform->matrix[2][0], + currentMaskPicture->transform->matrix[2][1], + currentMaskPicture->transform->matrix[2][2], + 20-mask_w2, 20-mask_h2); + } else { + setTMIncrementsRegs (1 << 16, 0, maskX << 16, + 0, 1 << 16, maskY << 16, + 0, 0, 0x10000, + 20-mask_w2, 20-mask_h2); + } + + mgaWaitAvail (1); + MGA_OUT32 (mmio, MGA_REG_TEXCTL2, MGA_G400_TC2_MAGIC | MGA_TC2_DUALTEX); + } + + /* Destination Bounding Box + * (Boundary Right | Boundary Left, Y dest | Height) + */ + mgaWaitAvail (2); + MGA_OUT32 (mmio, MGA_REG_FXBNDRY, + ((dstX + width) << 16) | (dstX & 0xffff)); + MGA_OUT32 (mmio, MGA_REG_YDSTLEN | MGA_REG_EXEC, + (dstY << 16) | (height & 0xffff)); +} + +void +mgaDoneComposite (void) +{ +} diff --git a/xorg-server/hw/kdrive/mga/mga.c b/xorg-server/hw/kdrive/mga/mga.c new file mode 100644 index 000000000..2ae35d143 --- /dev/null +++ b/xorg-server/hw/kdrive/mga/mga.c @@ -0,0 +1,240 @@ +/* + * Copyright © 2003 Anders Carlsson + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Anders Carlsson not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Anders Carlsson makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ANDERS CARLSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +#ifdef HAVE_CONFIG_H +#include <kdrive-config.h> +#endif +#include "mga.h" + +static Bool +mgaCardInit (KdCardInfo *card) +{ + MgaCardInfo *mgac; + + mgac = (MgaCardInfo *) xalloc (sizeof (MgaCardInfo)); + if (!mgac) + return FALSE; + + mgaMapReg (card, mgac); + + if (!vesaInitialize (card, &mgac->vesa)) + { + xfree (mgac); + return FALSE; + } + + mgac->fifo_size = 0; + + card->driver = mgac; + + return TRUE; +} + +static Bool +mgaScreenInit (KdScreenInfo *screen) +{ + MgaScreenInfo *mgas; + + mgas = (MgaScreenInfo *) xalloc (sizeof (MgaScreenInfo)); + if (!mgas) + return FALSE; + memset (mgas, '\0', sizeof (MgaScreenInfo)); + if (!vesaScreenInitialize (screen, &mgas->vesa)) + { + xfree (mgas); + return FALSE; + } +#if 0 + /* if (!mgac->reg) + screen->dumb = TRUE; */ + + if (mgas->vesa.mapping != VESA_LINEAR) + screen->dumb = TRUE; + + fprintf (stderr, "vesa mapping is %d\n", mgas->vesa.mapping); +#endif + screen->driver = mgas; + return TRUE; +} + +static Bool +mgaInitScreen (ScreenPtr pScreen) +{ + return vesaInitScreen (pScreen); +} + +static Bool +mgaFinishInitScreen (ScreenPtr pScreen) +{ + Bool ret; + + ret = vesaFinishInitScreen (pScreen); + + return ret; +} + +static Bool +mgaCreateResources (ScreenPtr pScreen) +{ + return vesaCreateResources (pScreen); +} + +static void +mgaPreserve (KdCardInfo *card) +{ + vesaPreserve (card); +} + +Bool +mgaMapReg (KdCardInfo *card, MgaCardInfo *mgac) +{ + mgac->reg_base = (CARD8 *) KdMapDevice (MGA_REG_BASE (card), + MGA_REG_SIZE (card)); + + if (!mgac->reg_base) + { + return FALSE; + } + + KdSetMappedMode (MGA_REG_BASE (card), + MGA_REG_SIZE (card), + KD_MAPPED_MODE_REGISTERS); + + return TRUE; +} + +void +mgaUnmapReg (KdCardInfo *card, MgaCardInfo *mgac) +{ + if (mgac->reg_base) + { + KdResetMappedMode (MGA_REG_BASE (card), + MGA_REG_SIZE (card), + KD_MAPPED_MODE_REGISTERS); + KdUnmapDevice ((void *) mgac->reg_base, MGA_REG_SIZE (card)); + mgac->reg_base = 0; + /* mgac->reg = 0; */ + } +} + +void +mgaSetMMIO (KdCardInfo *card, MgaCardInfo *mgac) +{ + if (!mgac->reg_base) + mgaMapReg (card, mgac); +} + +void +mgaResetMMIO (KdCardInfo *card, MgaCardInfo *mgac) +{ + mgaUnmapReg (card, mgac); +} + +static Bool +mgaDPMS (ScreenPtr pScreen, int mode) +{ + /* XXX */ + return TRUE; +} + +static Bool +mgaEnable (ScreenPtr pScreen) +{ + KdScreenPriv (pScreen); + MgaCardInfo *mgac = pScreenPriv->card->driver; + + if (!vesaEnable (pScreen)) + return FALSE; + + mgaSetMMIO (pScreenPriv->card, mgac); + mgaDPMS (pScreen, KD_DPMS_NORMAL); + + return TRUE; +} + +static void +mgaDisable (ScreenPtr pScreen) +{ + KdScreenPriv (pScreen); + MgaCardInfo *mgac = pScreenPriv->card->driver; + + mgaResetMMIO (pScreenPriv->card, mgac); + + vesaDisable (pScreen); +} + +static void +mgaRestore (KdCardInfo *card) +{ + MgaCardInfo *mgac = card->driver; + + mgaResetMMIO (card, mgac); + vesaRestore (card); +} + +static void +mgaScreenFini (KdScreenInfo *screen) +{ + MgaScreenInfo *mgas = (MgaScreenInfo *) screen->driver; + + vesaScreenFini (screen); + xfree (mgas); + screen->driver = 0; +} + +static void +mgaCardFini (KdCardInfo *card) +{ + MgaCardInfo *mgac = (MgaCardInfo *)card->driver; + + mgaUnmapReg (card, mgac); + vesaCardFini (card); +} + +KdCardFuncs mgaFuncs = { + mgaCardInit, /* cardinit */ + mgaScreenInit, /* scrinit */ + mgaInitScreen, /* initScreen */ + mgaFinishInitScreen, /* finishInitScreen */ + mgaCreateResources, /* createRes */ + mgaPreserve, /* preserve */ + mgaEnable, /* enable */ + mgaDPMS, /* dpms */ + mgaDisable, /* disable */ + mgaRestore, /* restore */ + mgaScreenFini, /* scrfini */ + mgaCardFini, /* cardfini */ + + 0, /* initCursor */ + 0, /* enableCursor */ + 0, /* disableCursor */ + 0, /* finiCursor */ + 0, /* recolorCursor */ + + mgaDrawInit, /* initAccel */ + mgaDrawEnable, /* enableAccel */ + mgaDrawDisable, /* disableAccel */ + mgaDrawFini, /* finiAccel */ + + vesaGetColors, /* getColors */ + vesaPutColors, /* putColors */ +}; + diff --git a/xorg-server/hw/kdrive/mga/mga.h b/xorg-server/hw/kdrive/mga/mga.h new file mode 100644 index 000000000..8fa956096 --- /dev/null +++ b/xorg-server/hw/kdrive/mga/mga.h @@ -0,0 +1,164 @@ +/* + * Copyright © 2003-2004 Anders Carlsson + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Anders Carlsson not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Anders Carlsson makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ANDERS CARLSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _MGA_H_ +#define _MGA_H_ +#include <vesa.h> +#include <klinux.h> + +#define MGA_REG_BASE(c) ((c)->attr.address[1]) +#define MGA_REG_SIZE(c) (0x4000) + +#define MGA_OUT32(mmio, a, v) (*(VOL32 *) ((mmio) + (a)) = (v)) +#define MGA_IN32(mmio, a) (*(VOL32 *) ((mmio) + (a))) + +#define MGA_REG_EXEC (0x0100) +#define MGA_REG_DWGCTL (0x1c00) +#define MGA_REG_PLNWT (0x1c1c) +#define MGA_REG_FCOL (0x1c24) +#define MGA_REG_MACCESS (0x1c04) +#define MGA_REG_SGN (0x1c58) +#define MGA_REG_AR0 (0x1c60) +#define MGA_REG_AR1 (0x1c64) +#define MGA_REG_AR2 (0x1c68) +#define MGA_REG_AR3 (0x1c6C) +#define MGA_REG_AR4 (0x1c70) +#define MGA_REG_AR5 (0x1c74) +#define MGA_REG_AR6 (0x1c78) + +#define MGA_REG_CXBNDRY (0x1c80) +#define MGA_REG_FXBNDRY (0x1c84) +#define MGA_REG_YDSTLEN (0x1c88) +#define MGA_REG_PITCH (0x1c8c) +#define MGA_REG_YTOP (0x1c98) +#define MGA_REG_YBOT (0x1c9c) +#define MGA_REG_FIFOSTATUS (0x1e10) +#define MGA_REG_STATUS (0x1e14) +#define MGA_REG_CACHEFLUSH (0x1fff) +#define MGA_REG_SRCORG (0x2cb4) +#define MGA_REG_DSTORG (0x2cb8) + +#define MGA_G4XX_DEVICE_ID (0x0525) + +#define MGA_PW8 (0) +#define MGA_PW16 (1) +#define MGA_PW24 (2) +#define MGA_PW32 (3) + +/* Drawing opcodes */ +#define MGA_OPCOD_TRAP (4) +#define MGA_OPCOD_TEXTURE_TRAP (6) +#define MGA_OPCOD_BITBLT (8) + +#define MGA_DWGCTL_SOLID (1 << 11) +#define MGA_DWGCTL_ARZERO (1 << 12) +#define MGA_DWGCTL_SGNZERO (1 << 13) +#define MGA_DWGCTL_SHIFTZERO (1 << 14) + +#define MGA_DWGCTL_BFCOL (2 << 25) + +#define MGA_ATYPE_RPL (0 << 4) +#define MGA_ATYPE_RSTR (1 << 4) +#define MGA_ATYPE_ZI (3 << 4) +#define MGA_ATYPE_BLK (4 << 4) +#define MGA_ATYPE_I (7 << 4) + +typedef volatile CARD8 VOL8; +typedef volatile CARD16 VOL16; +typedef volatile CARD32 VOL32; + +typedef struct _mgaCardInfo { + VesaCardPrivRec vesa; + CARD8 *reg_base; + int fifo_size; +} MgaCardInfo; + +#define getMgaCardInfo(kd) ((MgaCardInfo *) ((kd)->card->driver)) +#define mgaCardInfo(kd) MgaCardInfo *mgac = getMgaCardInfo(kd) + +typedef struct _mgaScreenInfo { + VesaScreenPrivRec vesa; + + KaaScreenInfoRec kaa; + + int pitch; + int pw; +} MgaScreenInfo; + +#define getMgaScreenInfo(kd) ((MgaScreenInfo *) ((kd)->screen->driver)) +#define mgaScreenInfo(kd) MgaScreenInfo *mgas = getMgaScreenInfo(kd) + + +VOL8 *mmio; + + +Bool +mgaMapReg (KdCardInfo *card, MgaCardInfo *mgac); + +void +mgaUnmapReg (KdCardInfo *card, MgaCardInfo *mgac); + +void +mgaSetMMIO (KdCardInfo *card, MgaCardInfo *mgac); + +void +mgaResetMMIO (KdCardInfo *card, MgaCardInfo *mgac); + +Bool +mgaDrawSetup (ScreenPtr pScreen); + +Bool +mgaDrawInit (ScreenPtr pScreen); + +void +mgaDrawEnable (ScreenPtr pScreen); + +void +mgaDrawDisable (ScreenPtr pScreen); + +void +mgaDrawFini (ScreenPtr pScreen); + +extern KdCardFuncs mgaFuncs; + + +void +mgaWaitAvail (int n); + +void +mgaWaitIdle (void); + +Bool +mgaSetup (ScreenPtr pScreen, int dest_bpp, int wait); + + +#if 0 +#define MGA_FALLBACK(x) \ +do { \ + ErrorF x; \ + return FALSE; \ +} while (0); +#else +#define MGA_FALLBACK(x) return FALSE; +#endif + +#endif /* _MGA_H_ */ diff --git a/xorg-server/hw/kdrive/mga/mgadraw.c b/xorg-server/hw/kdrive/mga/mgadraw.c new file mode 100644 index 000000000..d27e8c9cc --- /dev/null +++ b/xorg-server/hw/kdrive/mga/mgadraw.c @@ -0,0 +1,324 @@ +/* + * Copyright © 2003-2004 Anders Carlsson + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Anders Carlsson not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Anders Carlsson makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ANDERS CARLSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +#ifdef HAVE_CONFIG_H +#include <kdrive-config.h> +#endif +#include "mga.h" +#include "g400_common.h" +#include "kaa.h" +#include <unistd.h> + +CARD32 mgaRop[16] = { + /* GXclear */ MGA_ATYPE_RPL | 0x00000000, /* 0 */ + /* GXand */ MGA_ATYPE_RSTR | 0x00080000, /* src AND dst */ + /* GXandReverse */ MGA_ATYPE_RSTR | 0x00040000, /* src AND NOT dst */ + /* GXcopy */ MGA_ATYPE_RSTR | 0x000c0000, /* src */ + /* GXandInverted */ MGA_ATYPE_RSTR | 0x00020000, /* NOT src AND dst */ + /* GXnoop */ MGA_ATYPE_RSTR | 0x000a0000, /* dst */ + /* GXxor */ MGA_ATYPE_RSTR | 0x00060000, /* src XOR dst */ + /* GXor */ MGA_ATYPE_RSTR | 0x000e0000, /* src OR dst */ + /* GXnor */ MGA_ATYPE_RSTR | 0x00010000, /* NOT src AND NOT dst */ + /* GXequiv */ MGA_ATYPE_RSTR | 0x00090000, /* NOT src XOR dst */ + /* GXinvert */ MGA_ATYPE_RSTR | 0x00050000, /* NOT dst */ + /* GXorReverse */ MGA_ATYPE_RSTR | 0x000d0000, /* src OR NOT dst */ + /* GXcopyInverted */ MGA_ATYPE_RPL | 0x00030000, /* NOT src */ + /* GXorInverted */ MGA_ATYPE_RSTR | 0x000b0000, /* NOT src OR dst */ + /* GXnand */ MGA_ATYPE_RSTR | 0x00070000, /* NOT src OR NOT dst */ + /* GXset */ MGA_ATYPE_RPL | 0x000f0000 /* 1 */ +}; + +VOL8 *mmio; +int fifo_size; +int pitch, src_pitch; +int dir; + +void +mgaWaitAvail (int n) +{ + if (fifo_size < n) { + while ((fifo_size = MGA_IN32 (mmio, MGA_REG_FIFOSTATUS) & 0xff) < n) + ; + } + + fifo_size -= n; +} + +#define MGA_OUT8(mmio, a, v) (*(VOL8 *) ((mmio) + (a)) = (v)) +#define MGA_REG_CRTC_INDEX (0x1fd4) + +void +mgaWaitIdle (void) +{ + + mgaWaitAvail (2); + MGA_OUT32(mmio, MGA_REG_CACHEFLUSH, 0); + /* MGA_OUT8 (mmio, MGA_REG_CRTC_INDEX, 0); */ + while (MGA_IN32 (mmio, MGA_REG_STATUS) & 0x10000) + ; +} + +static void +mgaWaitMarker (ScreenPtr pScreen, int marker) +{ + KdScreenPriv (pScreen); + mgaCardInfo (pScreenPriv); + + mmio = mgac->reg_base; + + mgaWaitIdle (); +} + +Bool +mgaSetup (ScreenPtr pScreen, int dest_bpp, int wait) +{ + KdScreenPriv (pScreen); + mgaScreenInfo (pScreenPriv); + mgaCardInfo (pScreenPriv); + + fifo_size = 0; + mmio = mgac->reg_base; + pitch = mgas->pitch; + + if (!mmio) + return FALSE; + + mgaWaitAvail (wait + 4); + /* Set the format of the destination pixmap */ + switch (dest_bpp) { + case 8: + MGA_OUT32 (mmio, MGA_REG_MACCESS, MGA_PW8); + break; + case 16: + MGA_OUT32 (mmio, MGA_REG_MACCESS, MGA_PW16); + break; + case 24: + case 32: + MGA_OUT32 (mmio, MGA_REG_MACCESS, MGA_PW24); + break; + } + MGA_OUT32 (mmio, MGA_REG_CXBNDRY, 0xffff0000); + MGA_OUT32 (mmio, MGA_REG_YTOP, 0x00000000); + MGA_OUT32 (mmio, MGA_REG_YBOT, 0x007fffff); + + return TRUE; +} + +static Bool +mgaPrepareSolid (PixmapPtr pPixmap, int alu, Pixel pm, Pixel fg) +{ + + KdScreenPriv(pPixmap->drawable.pScreen); + int cmd; + int dst_org; + /* We must pad pm and fg depending on the format of the + * destination pixmap + */ + switch (pPixmap->drawable.bitsPerPixel) { + case 16: + fg |= fg << 16; + pm |= pm << 16; + break; + case 8: + fg |= (fg << 8) | (fg << 16) | (fg << 24); + pm |= (pm << 8) | (pm << 16) | (pm << 24); + break; + } + + cmd = MGA_OPCOD_TRAP | MGA_DWGCTL_SOLID | MGA_DWGCTL_ARZERO | MGA_DWGCTL_SGNZERO | + MGA_DWGCTL_SHIFTZERO | mgaRop[alu]; + + dst_org = (int)pPixmap->devPrivate.ptr - (int)pScreenPriv->screen->memory_base; + + mgaSetup (pPixmap->drawable.pScreen, pPixmap->drawable.bitsPerPixel, 5); + MGA_OUT32 (mmio, MGA_REG_DSTORG, dst_org); + MGA_OUT32 (mmio, MGA_REG_PITCH, pPixmap->devKind / (pPixmap->drawable.bitsPerPixel >> 3)); + MGA_OUT32 (mmio, MGA_REG_DWGCTL, cmd); + MGA_OUT32 (mmio, MGA_REG_FCOL, fg); + MGA_OUT32 (mmio, MGA_REG_PLNWT, pm); + + return TRUE; +} + +static void +mgaSolid (int x1, int y1, int x2, int y2) +{ + mgaWaitAvail (2); + MGA_OUT32 (mmio, MGA_REG_FXBNDRY, (x2 << 16) | (x1 & 0xffff)); + MGA_OUT32 (mmio, MGA_REG_YDSTLEN | MGA_REG_EXEC, (y1 << 16) | (y2 - y1)); +} + +static void +mgaDoneSolid (void) +{ +} + +#define BLIT_LEFT 1 +#define BLIT_UP 4 + +static Bool +mgaPrepareCopy (PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, + int dx, int dy, int alu, Pixel pm) +{ + KdScreenPriv(pSrcPixmap->drawable.pScreen); + int cmd; + + cmd = MGA_OPCOD_BITBLT | MGA_DWGCTL_BFCOL | MGA_DWGCTL_SHIFTZERO | mgaRop[alu]; + + dir = 0; + + if (dy < 0) + dir |= BLIT_UP; + if (dx < 0) + dir |= BLIT_LEFT; + + mgaSetup (pSrcPixmap->drawable.pScreen, + pDstPixmap->drawable.bitsPerPixel, 7); + + MGA_OUT32 (mmio, MGA_REG_SRCORG, ((int)pSrcPixmap->devPrivate.ptr - + (int)pScreenPriv->screen->memory_base)); + MGA_OUT32 (mmio, MGA_REG_DSTORG, ((int)pDstPixmap->devPrivate.ptr - + (int)pScreenPriv->screen->memory_base)); + MGA_OUT32 (mmio, MGA_REG_PITCH, (pDstPixmap->devKind / + (pDstPixmap->drawable.bitsPerPixel >> 3))); + src_pitch = pSrcPixmap->devKind / (pSrcPixmap->drawable.bitsPerPixel >> 3); + + MGA_OUT32 (mmio, MGA_REG_DWGCTL, cmd); + MGA_OUT32 (mmio, MGA_REG_SGN, dir); + MGA_OUT32 (mmio, MGA_REG_PLNWT, pm); + MGA_OUT32 (mmio, MGA_REG_AR5, src_pitch * (dy < 0 ? -1 : 1) ); + + return TRUE; +} + +static void +mgaCopy (int srcX, int srcY, int dstX, int dstY, int w, int h) +{ + int start, end; + if (dir & BLIT_UP) + { + srcY += h - 1; + dstY += h - 1; + } + + w--; + start = end = srcY * src_pitch + srcX; + + if (dir & BLIT_LEFT) + start += w; + else + end += w; + + mgaWaitAvail (4); + MGA_OUT32 (mmio, MGA_REG_AR0, end); + MGA_OUT32 (mmio, MGA_REG_AR3, start); + MGA_OUT32 (mmio, MGA_REG_FXBNDRY, ((dstX + w) << 16) | (dstX & 0xffff)); + MGA_OUT32 (mmio, MGA_REG_YDSTLEN | MGA_REG_EXEC, (dstY << 16) | h); +} + +static void +mgaDoneCopy (void) +{ +} + +#if 0 +static Bool +mgaUploadToScreen(PixmapPtr pDst, char *src, int src_pitch) { + /*fprintf(stderr,"Upload to Screen %p [%d]\n",src,src_pitch);*/ + return TRUE; +} +#endif + +Bool +mgaDrawInit (ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + mgaScreenInfo (pScreenPriv); + KdCardInfo *card = pScreenPriv->card; + + memset(&mgas->kaa, 0, sizeof(KaaScreenInfoRec)); + mgas->kaa.waitMarker = mgaWaitMarker; + mgas->kaa.PrepareSolid = mgaPrepareSolid; + mgas->kaa.Solid = mgaSolid; + mgas->kaa.DoneSolid = mgaDoneSolid; + mgas->kaa.PrepareCopy = mgaPrepareCopy; + mgas->kaa.Copy = mgaCopy; + mgas->kaa.DoneCopy = mgaDoneCopy; + /* In PW24 mode, we need to align to "3 64-bytes" */ + mgas->kaa.offsetAlign = 192; + /* Pitch alignment is in sets of 32 pixels, and we need to cover 32bpp, so + * 128 bytes + */ + mgas->kaa.pitchAlign = 128; + mgas->kaa.flags = KAA_OFFSCREEN_PIXMAPS; + + if (card->attr.deviceID == MGA_G4XX_DEVICE_ID) { + mgas->kaa.CheckComposite = mgaCheckComposite; + mgas->kaa.PrepareComposite = mgaPrepareComposite; + mgas->kaa.Composite = mgaComposite; + mgas->kaa.DoneComposite = mgaDoneComposite; + } + + /*mgas->kaa.UploadToScreen=mgaUploadToScreen;*/ + + if (!kaaDrawInit (pScreen, &mgas->kaa)) + return FALSE; + + return TRUE; +} + +void +mgaDrawEnable (ScreenPtr pScreen) +{ + KdScreenPriv (pScreen); + mgaScreenInfo (pScreenPriv); + + mgas->pitch = pScreenPriv->screen->width; + + switch (pScreenPriv->screen->fb[0].depth) { + case 8: + mgas->pw = MGA_PW8; + break; + case 16: + mgas->pw = MGA_PW16; + break; + case 24: + case 32: + mgas->pw = MGA_PW24; + break; + default: + FatalError ("unsupported pixel format"); + } + + kaaMarkSync (pScreen); +} + +void +mgaDrawDisable (ScreenPtr pScreen) +{ + kaaWaitSync(pScreen); +} + +void +mgaDrawFini (ScreenPtr pScreen) +{ +} + diff --git a/xorg-server/hw/kdrive/mga/mgastub.c b/xorg-server/hw/kdrive/mga/mgastub.c new file mode 100644 index 000000000..61e6963b8 --- /dev/null +++ b/xorg-server/hw/kdrive/mga/mgastub.c @@ -0,0 +1,64 @@ +/* + * Copyright © 2003 Anders Carlsson + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Anders Carlsson not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Anders Carlsson makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ANDERS CARLSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +#ifdef HAVE_CONFIG_H +#include <kdrive-config.h> +#endif +#include "mga.h" + +void +InitCard (char *name) +{ + KdCardAttr attr; + + if (LinuxFindPci (0x102b, 0x0525, 0, &attr)) + KdCardInfoAdd (&mgaFuncs, &attr, 0); +} + +void +InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) +{ + KdInitOutput (pScreenInfo, argc, argv); +} + +void +InitInput (int argc, char **argv) +{ + KdOsAddInputDrivers (); + KdInitInput (); +} + +void +ddxUseMsg (void) +{ + KdUseMsg(); + vesaUseMsg(); +} + +int +ddxProcessArgument (int argc, char **argv, int i) +{ + int ret; + + if (!(ret = vesaProcessArgument (argc, argv, i))) + ret = KdProcessArgument(argc, argv, i); + return ret; +} |