diff options
Diffstat (limited to 'xorg-server/hw/kdrive/via')
-rw-r--r-- | xorg-server/hw/kdrive/via/Makefile.am | 37 | ||||
-rw-r--r-- | xorg-server/hw/kdrive/via/Makefile.in | 716 | ||||
-rw-r--r-- | xorg-server/hw/kdrive/via/via.c | 435 | ||||
-rw-r--r-- | xorg-server/hw/kdrive/via/via.h | 129 | ||||
-rw-r--r-- | xorg-server/hw/kdrive/via/via_regs.h | 154 | ||||
-rw-r--r-- | xorg-server/hw/kdrive/via/viadraw.c | 499 | ||||
-rw-r--r-- | xorg-server/hw/kdrive/via/viadraw.h | 45 | ||||
-rw-r--r-- | xorg-server/hw/kdrive/via/viastub.c | 135 |
8 files changed, 2150 insertions, 0 deletions
diff --git a/xorg-server/hw/kdrive/via/Makefile.am b/xorg-server/hw/kdrive/via/Makefile.am new file mode 100644 index 000000000..c659379f0 --- /dev/null +++ b/xorg-server/hw/kdrive/via/Makefile.am @@ -0,0 +1,37 @@ +INCLUDES = \ + @KDRIVE_INCS@ \ + -I$(top_srcdir)/hw/kdrive/vesa \ + @KDRIVE_CFLAGS@ + +bin_PROGRAMS = Xvia + +noinst_LIBRARIES = libvia.a + +libvia_a_SOURCES = \ + via.c \ + viadraw.c \ + viadraw.h \ + via.h \ + via_regs.h + +Xvia_SOURCES = \ + viastub.c + +VIA_LIBS = \ + libvia.a \ + $(top_builddir)/hw/kdrive/vesa/libvesa.a + +if GLX +Xvia_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) +endif + +Xvia_LDADD = \ + $(VIA_LIBS) \ + @KDRIVE_LIBS@ + +Xvia_DEPENDENCIES = \ + libvia.a \ + @KDRIVE_LOCAL_LIBS@ + +relink: + rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS) diff --git a/xorg-server/hw/kdrive/via/Makefile.in b/xorg-server/hw/kdrive/via/Makefile.in new file mode 100644 index 000000000..4f4327e21 --- /dev/null +++ b/xorg-server/hw/kdrive/via/Makefile.in @@ -0,0 +1,716 @@ +# 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 = Xvia$(EXEEXT) +subdir = hw/kdrive/via +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 +libvia_a_AR = $(AR) $(ARFLAGS) +libvia_a_LIBADD = +am_libvia_a_OBJECTS = via.$(OBJEXT) viadraw.$(OBJEXT) +libvia_a_OBJECTS = $(am_libvia_a_OBJECTS) +am__installdirs = "$(DESTDIR)$(bindir)" +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) +am_Xvia_OBJECTS = viastub.$(OBJEXT) +Xvia_OBJECTS = $(am_Xvia_OBJECTS) +Xvia_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(Xvia_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 = $(libvia_a_SOURCES) $(Xvia_SOURCES) +DIST_SOURCES = $(libvia_a_SOURCES) $(Xvia_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 = libvia.a +libvia_a_SOURCES = \ + via.c \ + viadraw.c \ + viadraw.h \ + via.h \ + via_regs.h + +Xvia_SOURCES = \ + viastub.c + +VIA_LIBS = \ + libvia.a \ + $(top_builddir)/hw/kdrive/vesa/libvesa.a + +@GLX_TRUE@Xvia_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) +Xvia_LDADD = \ + $(VIA_LIBS) \ + @KDRIVE_LIBS@ + +Xvia_DEPENDENCIES = \ + libvia.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/via/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign hw/kdrive/via/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) +libvia.a: $(libvia_a_OBJECTS) $(libvia_a_DEPENDENCIES) + -rm -f libvia.a + $(libvia_a_AR) libvia.a $(libvia_a_OBJECTS) $(libvia_a_LIBADD) + $(RANLIB) libvia.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 +Xvia$(EXEEXT): $(Xvia_OBJECTS) $(Xvia_DEPENDENCIES) + @rm -f Xvia$(EXEEXT) + $(Xvia_LINK) $(Xvia_OBJECTS) $(Xvia_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/via.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/viadraw.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/viastub.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/via/via.c b/xorg-server/hw/kdrive/via/via.c new file mode 100644 index 000000000..b8e1036aa --- /dev/null +++ b/xorg-server/hw/kdrive/via/via.c @@ -0,0 +1,435 @@ +/* + * Copyright © 2004 Ralph Thomas + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Ralph Thomas not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Ralph Thomas makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * RALPH THOMAS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL RALPH THOMAS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +/* +** VIA CLE266 driver +** Copyright 2004 (C) Ralph Thomas <ralpht@gmail.com> +** +** http://www.viatech.com.tw/ +*/ + +#include "via.h" +#include "viadraw.h" + +/* +** viaCardInit( KdCardInfo* card ) +** +** Description: +** Create card specific structures, map chip registers and initialize the +** VESA driver. We make the VESA driver do boring stuff for us, like set +** up a framebuffer and program a mode. +** +** Parameters: +** card Information stucture for the card we want to bring up. +** It should be a VIA card. +** +** Return: +** TRUE Initialization went ok. +** FALSE Initialization failed. +*/ +static Bool +viaCardInit( KdCardInfo* card ) { + ViaCardInfo* viac; + + viac = (ViaCardInfo*) xalloc( sizeof( ViaCardInfo ) ); + if( !viac ) return FALSE; + memset( viac, '\0', sizeof( ViaCardInfo ) ); + + + viaMapReg( card, viac ); + + if( !vesaInitialize( card, &viac->vesa ) ) { + xfree( viac ); + return FALSE; + } + + card->driver = viac; + + return TRUE; +} + +/* +** Bool viaScreenInit( KdScreenInfo* screen ) +** +** Description: +** Initialize a single screen, described by the screen parameter. +** This is where fairly low-level screen related things get setup, +** such as video mode and resolution. Currently that all gets +** handed off to the VESA driver. +** +** Parameters: +** screen Information structure for the screen to enable. +** +** Return: +** TRUE Screen was initialized successfully +** FALSE Screen initialization failed +*/ +static Bool +viaScreenInit( KdScreenInfo* screen ) { + ViaCardInfo* viac = screen->card->driver; + ViaScreenInfo* vias; + + vias = (ViaScreenInfo*) xalloc( sizeof( ViaScreenInfo ) ); + if( !vias ) return FALSE; + memset( vias, '\0', sizeof( ViaScreenInfo ) ); + + if( !vesaScreenInitialize( screen, &vias->vesa ) ) { + xfree( vias ); + return FALSE; + } + + /* + ** XXX: What does this do? + */ + if( !viac->mapBase ) + screen->dumb = TRUE; + if( vias->vesa.mapping != VESA_LINEAR ) + screen->dumb = TRUE; + + screen->driver = vias; + return TRUE; +} + +/* +** Bool viaInitScreen( ScreenPtr pScreen ) +** +** Description: +** High level screen initialization occurs here. We could register XV +** adaptors, etc, here. +** +** Arguments: +** pScreen X screen information +** +** Return: +** TRUE Initialization was successful, +** FALSE Initialization failed. +*/ +static Bool +viaInitScreen( ScreenPtr pScreen ) { + return vesaInitScreen( pScreen ); +} + +/* +** Bool viaFinishInitScreen +** +** Description: +** Finish up any high-level screen initialization. Per-Screen extension +** initialization can be done here. +** +** Arguments: +** pScreen X screen information +** +** Return: +** TRUE Initialization was successful. +** FALSE Initialization failed. +*/ +static Bool +viaFinishInitScreen( ScreenPtr pScreen ) { + return vesaFinishInitScreen( pScreen ); +} + +/* +** Bool viaCreateResources( ScreenPtr pScreen ) +** +** Description: +** Do any screen specific configuration. +** +** Arguments: +** pScreen X screen information +** +** Return: +** TRUE configuration was successful. +** FALSE configuration failed. +*/ +static Bool +viaCreateResources( ScreenPtr pScreen ) { + return vesaCreateResources( pScreen ); +} + +/* +** void viaPreserve( KdCardInfo* card ) +** +** Description: +** Save the current state of the chip, so that it can be restored by +** viaRestore at a later time. +** +** Arguments: +** card Information structure for the chip we want to preserve the +** state of. +** +** Return: +** None. +** +** See Also: +** viaRestore +*/ +static void +viaPreserve( KdCardInfo* card ) { + vesaPreserve( card ); +} + +/* +** void viaRestore( KdCardInfo* card ) +** +** Description: +** Restore the previous state of the chip, as saved by viaPreserve +** earlier. +** +** Arguments: +** card Information structure for the chip we want to restore the +** state of. +** +** Return: +** None. +** +** See Also: +** viaPreserve +*/ +static void viaRestore( KdCardInfo* card ) { + ViaCardInfo* viac = card->driver; + + viaResetMMIO( card, viac ); + vesaRestore( card ); +} + +/* +** Bool viaEnable( ScreenPtr pScreen ) +** +** Description: +** This is where we set the card up for drawing the specified screen, e.g.: +** set the mode and mmap the framebuffer. +** +** Arguments: +** pScreen X screen information +** +** Return: +** TRUE the screen was enabled +** FALSE the screen could not be enabled +*/ +static Bool +viaEnable( ScreenPtr pScreen ) { + KdScreenPriv( pScreen ); + ViaCardInfo* viac = pScreenPriv->card->driver; + + if( !vesaEnable( pScreen ) ) return FALSE; + + viaSetMMIO( pScreenPriv->card, viac ); + + if( !viac->mapBase ) { + ErrorF( "Could not map CLE266 graphics registers" ); + return FALSE; + } + + return TRUE; +} + +/* +** void viaDisable( ScreenPtr pScreen ) +** +** Description: +** Shut down drawing: save some state and unmap the framebuffer. +** +** Arguments: +** pScreen X screen information +** +** Return: +** None. +*/ +static void +viaDisable( ScreenPtr pScreen ) { + KdScreenPriv( pScreen ); + ViaCardInfo* viac = pScreenPriv->card->driver; + + viaResetMMIO( pScreenPriv->card, viac ); + vesaDisable( pScreen ); +} + +/* +** void viaScreenFini( KdScreenInfo* screen ) +** +** Description: +** Release memory and resources allocated by viaScreenInit. +** +** Arguments: +** screen Information structure for the screen to release. +** +** Return: +** None. +** +** See Also: +** viaScreenInit +*/ +static void +viaScreenFini( KdScreenInfo* screen ) { + ViaScreenInfo* vias = screen->driver; + + vesaScreenFini( screen ); + xfree( vias ); + screen->driver = 0; +} + +/* +** void viaCardFini( KdCardInfo* card ) +** +** Description: +** Release memory and resources allocated by viaCardInit. +** +** Arguments: +** card Information structure for the chip to release. +** +** Return: +** None. +** +** See Also: +** viaCardInit +*/ +static void +viaCardFini( KdCardInfo* card ) { + ViaCardInfo* viac = card->driver; + + viaUnmapReg( card, viac ); + vesaCardFini( card ); + xfree( viac ); +} + +/* +** void viaSetMMIO( KdCardInfo* card, ViaCardInfo* viac ) +** +** Description: +** Map the card's registers, if they're not already +** mapped. +** +** Arguments: +** card generic chip information +** viac VIA-driver specific chip information +** +** Return: +** None. +*/ +void viaSetMMIO( KdCardInfo* card, ViaCardInfo* viac ) { + if( !viac->mapBase ) viaMapReg( card, viac ); +} + +/* +** void viaResetMMIO( KdCardInfo* card, ViaCardInfo* viac ) +** +** Description: +** Unmap chip's registers. +** +** Arguments: +** card generic chip information +** viac VIA-driver specific chip information +** +** Return: +** None. +*/ +void viaResetMMIO( KdCardInfo* card, ViaCardInfo* viac ) { + viaUnmapReg( card, viac ); +} + +/* +** Bool viaMapReg( KdCardInfo* card, ViaCardInfo* viac ) +** +** Description: +** Map the chip's registers into our address space. +** +** Arguments: +** card the card information +** viac the VIA-driver specific card information +** +** Return: +** TRUE the registers were succesfully mapped +** FALSE the registers could not be mapped +*/ +Bool +viaMapReg( KdCardInfo* card, ViaCardInfo* viac ) { + viac->mapBase = (VOL8*) KdMapDevice( VIA_REG_BASE( card ), + VIA_REG_SIZE( card ) ); + + if( !viac->mapBase ) { + ErrorF( "Couldn't allocate viac->mapBase\n" ); + return FALSE; + } + + KdSetMappedMode( VIA_REG_BASE( card ), VIA_REG_SIZE( card ), + KD_MAPPED_MODE_REGISTERS ); + + /* + ** Enable extended IO space + */ + VGAOUT8( 0x3C4, 0x10 ); + VGAOUT8( 0x3C5, 0x01 ); + + return TRUE; +} + +/* +** void viaUnmapReg( KdCardInfo* card, ViaCardInfo* viac ) +** +** Description: +** Unmap the the chip's registers. +** +** Arguments: +** card the card information +** viac the VIA-driver specific card information +** +** Return: +** None. +*/ +void +viaUnmapReg( KdCardInfo* card, ViaCardInfo* viac ) { + if( !viac->mapBase ) return; + + KdResetMappedMode( VIA_REG_BASE( card ), VIA_REG_SIZE( card ), + KD_MAPPED_MODE_REGISTERS ); + KdUnmapDevice( (void*) viac->mapBase, VIA_REG_SIZE( card ) ); + viac->mapBase = 0; +} + +KdCardFuncs viaFuncs = { + viaCardInit, /* cardinit */ + viaScreenInit, /* scrinit */ + viaInitScreen, /* initScreen */ + viaFinishInitScreen, /* finishInitScreen */ + viaCreateResources, /* createRes */ + viaPreserve, /* preserve */ + viaEnable, /* enable */ + vesaDPMS, /* dpms */ + viaDisable, /* disable */ + viaRestore, /* restore */ + viaScreenFini, /* scrfini */ + viaCardFini, /* cardfini */ + + 0, /* initCursor */ + 0, /* enableCursor */ + 0, /* disableCursor */ + 0, /* finiCursor */ + 0, /* recolorCursor */ + + viaDrawInit, /* initAccel */ + viaDrawEnable, /* enableAccel */ + viaDrawDisable, /* disableAccel */ + viaDrawFini, /* finiAccel */ + + vesaGetColors, /* getColors */ + vesaPutColors, /* putColors */ +}; + diff --git a/xorg-server/hw/kdrive/via/via.h b/xorg-server/hw/kdrive/via/via.h new file mode 100644 index 000000000..00f40bc04 --- /dev/null +++ b/xorg-server/hw/kdrive/via/via.h @@ -0,0 +1,129 @@ +/* + * Copyright © 2004 Ralph Thomas + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Ralph Thomas not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Ralph Thomas makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * RALPH THOMAS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL RALPH THOMAS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +/* +** VIA CLE266 driver +** Copyright 2004 (C) Ralph Thomas <ralpht@gmail.com> +** +** http://www.viatech.com.tw/ +*/ + +#ifndef _VIA_H_ +#define _VIA_H_ + +#include <vesa.h> +#include <klinux.h> + +/* +** Define DebugF so that we can spot debug statements easily. +*/ +#define DebugF ErrorF + +typedef volatile CARD8 VOL8; +typedef volatile CARD16 VOL16; +typedef volatile CARD32 VOL32; + +/* +** These macros provide access to data on the card. The VIA graphics chips +** are only available on IA-32 architecture, so PCI address space and CPU +** address space are always the same (hence accesses can be performed by +** dereferencing a pointer into PCI space). +*/ +#define MMIO_OUT32( mmio, a, v ) (*(VOL32 *)((mmio) + (a)) = (v)) +#define MMIO_IN32( mmio, a ) (*(VOL32 *)((mmio) + (a))) +#define MMIO_OUT16( mmio, a, v ) (*(VOL16 *)((mmio) + (a)) = (v)) +#define MMIO_IN16( mmio, a ) (*(VOL16 *)((mmio) + (a))) +#define MMIO_OUT8( mmio, a, v ) (*(VOL8 *)((mmio) + (a)) = (v)) +#define MMIO_IN8( mmio, a, v ) (*(VOL8 *)((mmio) + (a))) + +/* +** VGA regisers are offset 0x8000 from the beginning of the mmap'd register +** space. +*/ +#define VIA_MMIO_VGABASE 0x8000 + +/* +** The size of the register space, used when we mmap the registers. The +** argument "c" should be a KdCardInfo*. +*/ +#define VIA_REG_SIZE(c) (0x9000) + +/* +** The base of the register space, used when we mmap the registers. The +** argument "c" should be a KdCardInfo*. +*/ +#define VIA_REG_BASE(c) ((c)->attr.address[1]) + +/* +** Access to the mmap'd VGA registers. The VGA registers are offset from the +** beginning of the 16M pci space by 0x8000. These macros get used just like +** outb/inb would be used to access VGA. +*/ +#define VGAOUT32( addr, v ) MMIO_OUT32( viac->mapBase + VIA_MMIO_VGABASE, addr, v ) +#define VGAIN32( addr ) MMIO_IN32( viac->mapBase + VIA_MMIO_VGABASE, addr ) +#define VGAOUT16( addr, v ) MMIO_OUT16( viac->mapBase + VIA_MMIO_VGABASE, addr, v ) +#define VGAIN16( addr ) MIIO_IN16( viac->mapBase + VIA_MMIO_VGABASE, addr ) +#define VGAOUT8( addr, v ) MMIO_OUT8( viac->mapBase + VIA_MMIO_VGABASE, addr, v ) +#define VGAIN8( addr ) MMIO_IN8( viac->mapBase + VIA_MMIO_VGABASE, addr ) + +/* +** Access to any of the registers on the chip. +*/ +#define OUTREG32( addr, v ) MMIO_OUT32( viac->mapBase, addr, v ) +#define INREG32( addr ) MMIO_IN32( viac->mapBase, addr ) +#define OUTREG16( addr, v ) MMIO_OUT16( viac->mapBase, addr, v ) +#define INREG16( addr ) MMIO_IN16( viac->mapBase, addr ) + +/* +** We keep all of our chip specific data in a ViaCardInfo. +*/ +typedef struct _viaCardInfo { + VesaCardPrivRec vesa; /* card info for VESA driver */ + VOL8* mapBase; /* mmap'd registers */ + CARD32 savedCommand; /* command to issue to GE */ + CARD32 savedFgColor; /* color to issue to GE */ +} ViaCardInfo; + +/* +** We keep all of our screen specific data in a ViaScreenInfo. +*/ +typedef struct _viaScreenInfo { + VesaScreenPrivRec vesa; + KaaScreenInfoRec kaa; +} ViaScreenInfo; + +/* +** These function prototypes are for support functions. More infomation on each +** function is available at the place the function is implemented, in via.c. +*/ +Bool viaMapReg( KdCardInfo* card, ViaCardInfo* viac ); +void viaUnmapReg( KdCardInfo* card, ViaCardInfo* viac ); +void viaSetMMIO( KdCardInfo* card, ViaCardInfo* viac ); +void viaResetMMIO( KdCardInfo* card, ViaCardInfo* viac ); + +/* +** The viaFuncs structure gets filled with the addresses of the functions +** that we use to talk to the graphics chip. +*/ +extern KdCardFuncs viaFuncs; + +#endif + diff --git a/xorg-server/hw/kdrive/via/via_regs.h b/xorg-server/hw/kdrive/via/via_regs.h new file mode 100644 index 000000000..2d8195d5d --- /dev/null +++ b/xorg-server/hw/kdrive/via/via_regs.h @@ -0,0 +1,154 @@ +/* + * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. + * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/************************************************************************* + * + * File: via_regs.h + * Content: The defines of Via registers + * + ************************************************************************/ + +#ifndef _VIA_REGS_H_ +#define _VIA_REGS_H_ + +/* defines for VIA 2D registers */ +#define VIA_REG_GECMD 0x000 +#define VIA_REG_GEMODE 0x004 +#define VIA_REG_GESTATUS 0x004 /* as same as VIA_REG_GEMODE */ +#define VIA_REG_SRCPOS 0x008 +#define VIA_REG_DSTPOS 0x00C +#define VIA_REG_LINE_K1K2 0x008 +#define VIA_REG_LINE_XY 0x00C +#define VIA_REG_DIMENSION 0x010 /* width and height */ +#define VIA_REG_PATADDR 0x014 +#define VIA_REG_FGCOLOR 0x018 +#define VIA_REG_DSTCOLORKEY 0x018 /* as same as VIA_REG_FG */ +#define VIA_REG_BGCOLOR 0x01C +#define VIA_REG_SRCCOLORKEY 0x01C /* as same as VIA_REG_BG */ +#define VIA_REG_CLIPTL 0x020 /* top and left of clipping */ +#define VIA_REG_CLIPBR 0x024 /* bottom and right of clipping */ +#define VIA_REG_OFFSET 0x028 +#define VIA_REG_LINE_ERROR 0x028 +#define VIA_REG_KEYCONTROL 0x02C /* color key control */ +#define VIA_REG_SRCBASE 0x030 +#define VIA_REG_DSTBASE 0x034 +#define VIA_REG_PITCH 0x038 /* pitch of src and dst */ +#define VIA_REG_MONOPAT0 0x03C +#define VIA_REG_MONOPAT1 0x040 +#define VIA_REG_COLORPAT 0x100 /* from 0x100 to 0x1ff */ + + + +/* defines for VIA video registers */ +#define VIA_REG_INTERRUPT 0x200 +#define VIA_REG_CRTCSTART 0x214 + + +/* defines for VIA HW cursor registers */ +#define VIA_REG_CURSOR_MODE 0x2D0 +#define VIA_REG_CURSOR_POS 0x2D4 +#define VIA_REG_CURSOR_ORG 0x2D8 +#define VIA_REG_CURSOR_BG 0x2DC +#define VIA_REG_CURSOR_FG 0x2E0 + + +/* defines for VIA 3D registers */ +#define VIA_REG_STATUS 0x400 +#define VIA_REG_TRANSET 0x43C +#define VIA_REG_TRANSPACE 0x440 + +/* VIA_REG_STATUS(0x400): Engine Status */ +#define VIA_CMD_RGTR_BUSY 0x00000080 /* Command Regulator is busy */ +#define VIA_2D_ENG_BUSY 0x00000001 /* 2D Engine is busy */ +#define VIA_3D_ENG_BUSY 0x00000002 /* 3D Engine is busy */ +#define VIA_VR_QUEUE_BUSY 0x00020000 /* Virtual Queue is busy */ +#define VIA_BUSY (VIA_CMD_RGTR_BUSY|VIA_2D_ENG_BUSY|VIA_3D_ENG_BUSY) + + +/* VIA_REG_GECMD(0x00): 2D Engine Command */ +#define VIA_GEC_NOOP 0x00000000 +#define VIA_GEC_BLT 0x00000001 +#define VIA_GEC_LINE 0x00000005 + +#define VIA_GEC_SRC_XY 0x00000000 +#define VIA_GEC_SRC_LINEAR 0x00000010 +#define VIA_GEC_DST_XY 0x00000000 +#define VIA_GEC_DST_LINRAT 0x00000020 + +#define VIA_GEC_SRC_FB 0x00000000 +#define VIA_GEC_SRC_SYS 0x00000040 +#define VIA_GEC_DST_FB 0x00000000 +#define VIA_GEC_DST_SYS 0x00000080 + +#define VIA_GEC_SRC_MONO 0x00000100 /* source is mono */ +#define VIA_GEC_PAT_MONO 0x00000200 /* pattern is mono */ + +#define VIA_GEC_MSRC_OPAQUE 0x00000000 /* mono src is opaque */ +#define VIA_GEC_MSRC_TRANS 0x00000400 /* mono src is transparent */ + +#define VIA_GEC_PAT_FB 0x00000000 /* pattern is in frame buffer */ +#define VIA_GEC_PAT_REG 0x00000800 /* pattern is from reg setting */ + +#define VIA_GEC_CLIP_DISABLE 0x00000000 +#define VIA_GEC_CLIP_ENABLE 0x00001000 + +#define VIA_GEC_FIXCOLOR_PAT 0x00002000 + +#define VIA_GEC_INCX 0x00000000 +#define VIA_GEC_DECY 0x00004000 +#define VIA_GEC_INCY 0x00000000 +#define VIA_GEC_DECX 0x00008000 + +#define VIA_GEC_MPAT_OPAQUE 0x00000000 /* mono pattern is opaque */ +#define VIA_GEC_MPAT_TRANS 0x00010000 /* mono pattern is transparent */ + +#define VIA_GEC_MONO_UNPACK 0x00000000 +#define VIA_GEC_MONO_PACK 0x00020000 +#define VIA_GEC_MONO_DWORD 0x00000000 +#define VIA_GEC_MONO_WORD 0x00040000 +#define VIA_GEC_MONO_BYTE 0x00080000 + +#define VIA_GEC_LASTPIXEL_ON 0x00000000 +#define VIA_GEC_LASTPIXEL_OFF 0x00100000 +#define VIA_GEC_X_MAJOR 0x00000000 +#define VIA_GEC_Y_MAJOR 0x00200000 +#define VIA_GEC_QUICK_START 0x00800000 + + +/* VIA_REG_GEMODE(0x04): GE mode */ +#define VIA_GEM_8bpp 0x00000000 +#define VIA_GEM_16bpp 0x00000100 +#define VIA_GEM_32bpp 0x00000300 + +#define VIA_GEM_640 0x00000000 /* 640*480 */ +#define VIA_GEM_800 0x00000400 /* 800*600 */ +#define VIA_GEM_1024 0x00000800 /* 1024*768 */ +#define VIA_GEM_1280 0x00000C00 /* 1280*1024 */ +#define VIA_GEM_1600 0x00001000 /* 1600*1200 */ +#define VIA_GEM_2048 0x00001400 /* 2048*1536 */ + +/* VIA_REG_PITCH(0x38): Pitch Setting */ +#define VIA_PITCH_ENABLE 0x80000000 + +#endif /* _VIA_REGS_H_ */ diff --git a/xorg-server/hw/kdrive/via/viadraw.c b/xorg-server/hw/kdrive/via/viadraw.c new file mode 100644 index 000000000..a6544ee36 --- /dev/null +++ b/xorg-server/hw/kdrive/via/viadraw.c @@ -0,0 +1,499 @@ +/* + * Copyright © 2004 Ralph Thomas + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Ralph Thomas not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Ralph Thomas makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * RALPH THOMAS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL RALPH THOMAS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +/* +** VIA CLE266 driver +** Copyright 2004 (C) Ralph Thomas <ralpht@gmail.com> +** +** http://www.viatech.com.tw/ +** +** This code is for accelerated drawing of solids and accelerated +** copies. Note that there is currently no software FIFO implemented, +** and no documentation on any hardware FIFO. +*/ + +#include "via.h" +#include "viadraw.h" +#include "via_regs.h" +#include <sched.h> +#include "kdrive.h" +#include "kaa.h" + +/* +** A global to contain card information between calls into this file. +** XXX: This is totally brain-damaged. Why don't I get the information +** I want in viaSolid/viaCopy/viaDoneXXX? +*/ +static ViaCardInfo* card; + +/* +** Translation table from GC raster operation values into ROP3 values +** that the VIA chip understands. +** +** viaPatternRop is used by viaPrepareSolid. +** viaCopyRop is used by viaPrepareCopy. +*/ +CARD8 viaPatternRop[16] = { + /* GXclear */ 0x00, /* ROP_0 0 */ + /* GXand */ 0xA0, /* ROP_DPa src AND dst */ + /* GXandReverse */ 0x50, /* ROP_PDna src AND NOT dst */ + /* GXcopy */ 0xF0, /* ROP_P src */ + /* GXandInverted*/ 0x0A, /* ROP_DPna NOT src AND dst */ + /* GXnoop */ 0xAA, /* ROP_D dst */ + /* GXxor */ 0x5A, /* ROP_DPx src XOR dst */ + /* GXor */ 0xFA, /* ROP_DPo src OR dst */ + /* GXnor */ 0x05, /* ROP_DPon NOT src AND NOT dst */ + /* GXequiv */ 0xA5, /* ROP_PDxn NOT src XOR dst */ + /* GXinvert */ 0x55, /* ROP_Dn NOT dst */ + /* GXorReverse */ 0xF5, /* ROP_PDno src OR NOT dst */ + /* GXcopyInverted*/ 0x0F, /* ROP_Pn NOT src */ + /* GXorInverted */ 0xAF, /* ROP_DPno NOT src OR dst */ + /* GXnand */ 0x5F, /* ROP_DPan NOT src OR NOT dst */ + /* GXset */ 0xFF, /* ROP_1 1 */ +}; + +CARD8 viaCopyRop[16] = { + /* GXclear */ 0x00, /* ROP_0 0 */ + /* GXand */ 0x88, /* ROP_DSa src AND dst */ + /* GXandReverse */ 0x44, /* ROP_SDna src AND NOT dst */ + /* GXcopy */ 0xCC, /* ROP_S src */ + /* GXandInverted*/ 0x22, /* ROP_DSna NOT src AND dst */ + /* GXnoop */ 0xAA, /* ROP_D dst */ + /* GXxor */ 0x66, /* ROP_DSx src XOR dst */ + /* GXor */ 0xEE, /* ROP_DSo src OR dst */ + /* GXnor */ 0x11, /* ROP_DSon NOT src AND NOT dst */ + /* GXequiv */ 0x99, /* ROP_DSxn NOT src XOR dst */ + /* GXinvert */ 0x55, /* ROP_Dn NOT dst */ + /* GXorReverse */ 0xDD, /* ROP_SDno src OR NOT dst */ + /* GXcopyInverted*/ 0x33, /* ROP_Sn NOT src */ + /* GXorInverted */ 0xBB, /* ROP_DSno NOT src OR dst */ + /* GXnand */ 0x77, /* ROP_DSan NOT src OR NOT dst */ + /* GXset */ 0xFF, /* ROP_1 1 */ +}; + +/* +** void viaWaitIdle( ViaCardInfo* viac ) +** +** Description: +** Block up the CPU while waiting for the last command sent to +** the chip to complete. As an experiment I'm going to try to +** yield my process to others instead of just tight looping. +** +** Arguments: +** viac VIA-driver specific chip information +** +** Return: +** None. +*/ +void +viaWaitIdle( ViaCardInfo* viac ) { + while( INREG32( VIA_REG_STATUS ) & VIA_BUSY ) + sched_yield(); +} + +/* +** void viaDrawSync( ScreenPtr pScreen, int marker ) +** +** Description: +** Block until the graphics chip has finished all outstanding drawing +** operations and the framebuffer contents is static. +** +** Arguments: +** pScreen Pointer to screen strucutre for the screen we're +** waiting for drawing to end on. +** +** Return: +** None. +*/ +static void +viaWaitMarker( ScreenPtr pScreen, int marker ) { + KdScreenPriv( pScreen ); + ViaCardInfo* viac = pScreenPriv->card->driver; + + viaWaitIdle( viac ); +} + + +/* +** Bool viaPrepareSolid( PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg ) +** +** Description: +** Decide if the specified solid fill operation can be accelerated or not, +** and if the fill can be accelerated, prepare the hardware for doing it. +** +** Arguments: +** pPixmap Pixmap to draw solid into. +** alu Raster operation to draw using, these are the same +** values which get set by XSetFunction(3X). See the +** Xlib PM p. 140 for a list of raster operations as +** well as descriptions. +** planemask This is the GC plane mask. We only copy bits which +** match the plane mask. +** fg The foreground pixel of the GC, the pixel to draw in. +** +** Return: +** TRUE This operation can be accelerated, call viaSolid to actually +** have it drawn. +** FALSE This operation cannot be accelerated, fall back to software. +** +** See Also: +** viaSolid - the function which actually draws the solid. +*/ +static Bool +viaPrepareSolid( PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg ) { + ScreenPtr pScreen = pPixmap->drawable.pScreen; + KdScreenPriv( pScreen ); + ViaCardInfo* viac = pScreenPriv->card->driver; + + /* + ** We don't accelerate when the plane mask is not everything. + */ + if( ~planeMask & FbFullMask( pPixmap->drawable.depth ) ) return FALSE; + + /* + ** Compose the command, then store the composed command and color + ** in the viac structure so that when viaSolid gets called we can + ** write them out. + */ + viac->savedCommand = VIA_GEC_BLT | VIA_GEC_FIXCOLOR_PAT | + (viaPatternRop[alu] << 24); + viac->savedFgColor = fg; + + /* + ** Store pointer to chip information, due to brain-damaged KAA. + */ + card = viac; + + return TRUE; +} + +/* +** void viaSolid( int x1, int y1, int x2, int y2 ) +** +** Description: +** Perform a solid fill, using the data that was stored by viaPrepareSolid. +** +** Arguments: +** x1 x-coordinate of fill origin +** y1 y-coordinate of fill origin +** x2 x-coordinate of fill end point +** y2 y-coordinate of fill end point +** +** Return: +** None. +** +** See Also: +** viaPrepareSolid - the function that composes the GE command and saves +** the color for us. +*/ +static void +viaSolid( int x1, int y1, int x2, int y2 ) { + ViaCardInfo* viac = card; + int w = x2 - x1; int h = y2 - y1; + + if( !viac ) return; + if( !w || !h ) return; + + /* + ** Wait for the card to finish the current draw. + */ + viaWaitIdle( viac ); + + /* + ** Do the draw. + */ + OUTREG32( VIA_REG_DSTPOS, ((y1 << 16) | x1) ); + OUTREG32( VIA_REG_DIMENSION, (((h - 1) << 16) | (w - 1)) ); + OUTREG32( VIA_REG_FGCOLOR, viac->savedFgColor ); + OUTREG32( VIA_REG_GECMD, viac->savedCommand ); +} + +/* +** void viaDoneSolid +** +** Description: +** Finish up drawing of the solid. +** +** Arguments: +** None. +** +** Return: +** None. +*/ +static void +viaDoneSolid(void) { +} + +/* +** Bool viaPrepareCopy( PixmapPtr pSrcPixmap, PixmapPtr pDestPixmap, int dx, +** int dy, int alu, Pixel planeMask ) +** +** Description: +** Set up the VIA chip for a BitBlt. +** +** Arguments: +** pSrcPixmap the source pixmap to copy from +** pDestPixmap the destination pixmap to copy to +** dx direction of copy in x +** dy direction of copy in y +** alu Raster operation to draw using, these are the same +** values which get set by XSetFunction(3X). See the +** Xlib PM p. 140 for a list of raster operations as +** well as descriptions. +** planeMask This is the GC plane mask. We only copy bits which +** match the plane mask. +** +** Return: +** TRUE the requested copy operation can be accelerated using hardware, +** call viaCopy next. +** FALSE the requested copy operation cannot be accelerated using +** hardware - fallback to software. +** +** See Also: +** viaCopy - the function which does the actual copy. +*/ +static Bool +viaPrepareCopy( PixmapPtr pSrcPixmap, PixmapPtr pDestPixmap, int dx, int dy, + int alu, Pixel planeMask ) { + ScreenPtr pScreen = pDestPixmap->drawable.pScreen; + KdScreenPriv( pScreen ); + ViaCardInfo* viac = pScreenPriv->card->driver; + + /* + ** Don't accelerate when the plane mask is set. + */ + if( ~planeMask & FbFullMask( pDestPixmap->drawable.depth ) ) return FALSE; + + viac->savedCommand = VIA_GEC_BLT | (viaCopyRop[alu] << 24); + + if( dx < 0 ) viac->savedCommand |= VIA_GEC_DECX; + if( dy < 0 ) viac->savedCommand |= VIA_GEC_DECY; + + /* + ** Store pointer to chip structure, due to brain-damaged KAA. + */ + card = viac; + + return TRUE; +} + +/* +** void viaCopy( int srcX, int srcY, int dstX, int dstY, int w, int h ) +** +** Description: +** Perform a BitBlt from one screen area to another. +** +** Arguments: +** srcX source x-coordinate +** srcY source y-coordinate +** dstX destination x-coordinate +** dstY destination y-coordinate +** w width of area to copy (pixels) +** h height of area to copy (pixels) +** +** Return: +** None. +** +** See Also: +** viaPrepareCopy - the function which sets up for the copy. +*/ +static void +viaCopy( int srcX, int srcY, int dstX, int dstY, int w, int h ) { + ViaCardInfo* viac = card; + + if( !viac ) return; + if( !w | !h ) return; + + /* + ** XXX: Check these two "if"s out. + */ + if( viac->savedCommand & VIA_GEC_DECX ) { + srcX += ( w - 1 ); + dstX += ( w - 1 ); + } + + if( viac->savedCommand & VIA_GEC_DECY ) { + srcY += ( h - 1 ); + dstY += ( h - 1 ); + } + + OUTREG32( VIA_REG_SRCPOS, ((srcY << 16) | srcX) ); + OUTREG32( VIA_REG_DSTPOS, ((dstY << 16) | dstX) ); + OUTREG32( VIA_REG_DIMENSION, (((h - 1) << 16) | (w - 1)) ); + OUTREG32( VIA_REG_GECMD, viac->savedCommand ); +} + +/* +** void viaDoneCopy() +** +** Description: +** Finish up the copy. +** +** Arguments: +** None. +** +** Return: +** None. +*/ +static void +viaDoneCopy(void) { +} + + +/* +** Bool viaDrawInit( ScreenPtr pScreen ) +** +** Description: +** Initialize the 2D acceleration hardware and register the KAA +** acceleration layer with the VIA acceleration functions (above). +** +** Arguments: +** pScreen Pointer to screen structure for the screen we're +** enabling acceleration on. +** +** Return: +** TRUE initialization and setup of KAA acceleration was successful. +** FALSE initialization and setup of KAA acceleration failed. +*/ +Bool +viaDrawInit( ScreenPtr pScreen ) { + KdScreenPriv( pScreen ); + ViaCardInfo* viac = pScreenPriv->card->driver; + ViaScreenInfo* vias = pScreenPriv->card->driver; + CARD32 geMode = 0; + + if( !viac ) return FALSE; + DebugF( "viac->mapBase = 0x%x\n", viac->mapBase ); + + /* + ** We reset the 2D engine to a known state by setting all of it's + ** registers to zero. + */ + OUTREG32( VIA_REG_GEMODE, 0x0 ); + OUTREG32( VIA_REG_SRCPOS, 0x0 ); + OUTREG32( VIA_REG_DSTPOS, 0x0 ); + OUTREG32( VIA_REG_DIMENSION, 0x0 ); + OUTREG32( VIA_REG_PATADDR, 0x0 ); + OUTREG32( VIA_REG_FGCOLOR, 0x0 ); + OUTREG32( VIA_REG_BGCOLOR, 0x0 ); + OUTREG32( VIA_REG_CLIPTL, 0x0 ); + OUTREG32( VIA_REG_CLIPBR, 0x0 ); + OUTREG32( VIA_REG_OFFSET, 0x0 ); + OUTREG32( VIA_REG_KEYCONTROL, 0x0 ); + OUTREG32( VIA_REG_SRCBASE, 0x0 ); + OUTREG32( VIA_REG_DSTBASE, 0x0 ); + OUTREG32( VIA_REG_PITCH, 0x0 ); + OUTREG32( VIA_REG_MONOPAT0, 0x0 ); + OUTREG32( VIA_REG_MONOPAT1, 0x0 ); + + /* + ** Set the GE mode up. + ** XXX: What happens in 24bpp mode? + */ + switch( pScreenPriv->screen->fb[0].bitsPerPixel ) { + case 16: + geMode = VIA_GEM_16bpp; + break; + case 32: + geMode = VIA_GEM_32bpp; + break; + default: + geMode = VIA_GEM_8bpp; + break; + } + + OUTREG32( VIA_REG_GEMODE, geMode ); + + /* + ** Set the source and destination base addresses, and set pitch. + */ + OUTREG32( VIA_REG_SRCBASE, 0x0 ); + OUTREG32( VIA_REG_DSTBASE, 0x0 ); + OUTREG32( VIA_REG_PITCH, VIA_PITCH_ENABLE | + ((pScreen->width * pScreenPriv->screen->fb[0].bitsPerPixel >> 3) >> 3) | + (((pScreen->width * pScreenPriv->screen->fb[0].bitsPerPixel >> 3) >> 3) << 16)); + + DebugF( "Initialized 2D engine!\n" ); + + memset(&vias->kaa, 0, sizeof(KaaScreenInfoRec)); + vias->kaa.waitMarker = viaWaitMarker; + vias->kaa.PrepareSolid = viaPrepareSolid; + vias->kaa.Solid = viaSolid; + vias->kaa.DoneSolid = viaDoneSolid; + vias->kaa.PrepareCopy = viaPrepareCopy; + vias->kaa.Copy = viaCopy; + vias->kaa.DoneCopy = viaDoneCopy; + + return kaaDrawInit( pScreen, &vias->kaa ); +} + +/* +** void viaDrawEnable( ScreenPtr pScreen ) +** +** Description: +** Enable accelerated drawing on the specified screen. +** +** Arguments: +** pScreen Pointer to screen structure for the screen we're +** enabling acceleration on. +** +** Return: +** None. +*/ +void +viaDrawEnable( ScreenPtr pScreen ) { + kaaMarkSync( pScreen ); +} + +/* +** void viaDrawDisable( ScreenPtr pScreen ) +** +** Description: +** Disable accelerated drawing to the specified screen. +** +** Arguments: +** pScreen Pointer to screen structure for the screen we're +** disabling acceleration on. +** +** Return: +** None +*/ +void +viaDrawDisable( ScreenPtr pScreen ) { +} + +/* +** void viaDrawFini( ScreenPtr pScreen ) +** +** Description: +** Shutdown accelerated drawing and free associated strucures and +** resources. +** +** Arguments: +** pScreen Pointer to screen structure for the screen we're +** disabling acceleration on. +** +** Return: +** None. +*/ +void +viaDrawFini( ScreenPtr pScreen ) { +} diff --git a/xorg-server/hw/kdrive/via/viadraw.h b/xorg-server/hw/kdrive/via/viadraw.h new file mode 100644 index 000000000..404923053 --- /dev/null +++ b/xorg-server/hw/kdrive/via/viadraw.h @@ -0,0 +1,45 @@ +/* + * Copyright © 2004 Ralph Thomas + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Ralph Thomas not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Ralph Thomas makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * RALPH THOMAS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL RALPH THOMAS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +/* +** VIA CLE266 driver +** Copyright 2004 (C) Ralph Thomas <ralpht@gmail.com> +** +** http://www.viatech.com.tw/ +** +** This header has some function prototypes for the hardware +** accelerated drawing code in viadraw.c. +*/ + +#ifndef _VIA_DRAW_H_ +#define _VIA_DRAW_H_ + +/* +** More information on these functions is in viadraw.c. +*/ +void viaWaitIdle( ViaCardInfo* card ); +Bool viaDrawInit( ScreenPtr pScreen ); +void viaDrawEnable( ScreenPtr pScreen ); +void viaDrawDisable( ScreenPtr pScreen ); +void viaDrawFini( ScreenPtr pScreen ); +void viaDrawSync( ScreenPtr pScreen ); + +#endif diff --git a/xorg-server/hw/kdrive/via/viastub.c b/xorg-server/hw/kdrive/via/viastub.c new file mode 100644 index 000000000..1439010a9 --- /dev/null +++ b/xorg-server/hw/kdrive/via/viastub.c @@ -0,0 +1,135 @@ +/* + * Copyright © 2004 Ralph Thomas + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Ralph Thomas not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Ralph Thomas makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * RALPH THOMAS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL RALPH THOMAS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +/* +** VIA CLE266 driver +** Copyright 2004 (C) Ralph Thomas <ralpht@gmail.com> +** +** http://www.viatech.com.tw/ +** +** This is the stub code which links the VIA drawing code into the kdrive +** framework. +*/ + +#include "via.h" +#include <klinux.h> + +/* +** void InitCard( char* name ) +** +** Description: +** Initialize the graphics chip. We find the chip on the PCI bus, +** register the functions to access the chip. +** +** Arguments: +** name XXX: unknown. +** +** Return: +** None. +*/ +void +InitCard( char* name ) { + KdCardAttr attr; + + if( LinuxFindPci( 0x1106, 0x3122, 0, &attr ) ) + KdCardInfoAdd( &viaFuncs, &attr, 0 ); +} + +/* +** void InitOutput( ScreenInfo* pScreenInfo, int argc, char** argv ) +** +** Description: +** Initialize I/O, or something. XXX: Or what? +** +** Arguments: +** pScreenInfo XXX +** argc command line argument count +** argv command line arguments +** +** Return: +** None. +*/ +void +InitOutput( ScreenInfo* pScreenInfo, int argc, char** argv ) { + KdInitOutput( pScreenInfo, argc, argv ); +} + +/* +** void InitInput( int argc, char** argv ) +** +** Description: +** Initialize keyboard and mouse input. +** +** Arguments: +** argc command line argument count +** argv command line arguments +** +** Return: +** None. +*/ +void +InitInput( int argc, char** argv ) { + KdOsAddInputDrivers(); + KdInitInput(); +} + +/* +** void ddxUseMsg() +** +** Description: +** Print the usage message for Xvia. +** +** Arguments: +** None. +** +** Return: +** None. +*/ +void +ddxUseMsg() { + KdUseMsg(); + vesaUseMsg(); +} + + +/* +** int ddxProcessArgument( int argc, char** argv, int i ) +** +** Description: +** Process a single command line argument. +** +** Arguments: +** argc command line argument count +** argv command line arguments +** i number of argument to process +** +** Return: +** some values. +*/ +int +ddxProcessArgument( int argc, char** argv, int i ) { + int ret; + + if( !( ret = vesaProcessArgument( argc, argv, i ) )) + ret = KdProcessArgument( argc, argv, i ); + return ret; +} + |