diff options
Diffstat (limited to 'xorg-server/hw/kdrive/mach64')
-rw-r--r-- | xorg-server/hw/kdrive/mach64/Makefile.am | 43 | ||||
-rw-r--r-- | xorg-server/hw/kdrive/mach64/Makefile.in | 719 | ||||
-rw-r--r-- | xorg-server/hw/kdrive/mach64/mach64.c | 433 | ||||
-rw-r--r-- | xorg-server/hw/kdrive/mach64/mach64.h | 653 | ||||
-rw-r--r-- | xorg-server/hw/kdrive/mach64/mach64draw.c | 590 | ||||
-rw-r--r-- | xorg-server/hw/kdrive/mach64/mach64draw.h | 69 | ||||
-rw-r--r-- | xorg-server/hw/kdrive/mach64/mach64stub.c | 75 | ||||
-rw-r--r-- | xorg-server/hw/kdrive/mach64/mach64video.c | 994 |
8 files changed, 3576 insertions, 0 deletions
diff --git a/xorg-server/hw/kdrive/mach64/Makefile.am b/xorg-server/hw/kdrive/mach64/Makefile.am new file mode 100644 index 000000000..6ca376ab2 --- /dev/null +++ b/xorg-server/hw/kdrive/mach64/Makefile.am @@ -0,0 +1,43 @@ +INCLUDES = \ + @KDRIVE_INCS@ \ + -I$(top_srcdir)/hw/kdrive/vesa \ + @KDRIVE_CFLAGS@ + +bin_PROGRAMS = Xmach64 + +if TSLIB +TSLIB_FLAG = -lts +endif + + +noinst_LIBRARIES = libmach64.a + +libmach64_a_SOURCES = \ + mach64.c \ + mach64draw.c \ + mach64video.c \ + mach64.h \ + mach64draw.h + +Xmach64_SOURCES = \ + mach64stub.c + +MACH64_LIBS = \ + libmach64.a \ + $(top_builddir)/hw/kdrive/vesa/libvesa.a + + +if GLX +Xmach64_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) +endif + +Xmach64_LDADD = \ + $(MACH64_LIBS) \ + @KDRIVE_LIBS@ + +Xmach64_DEPENDENCIES = \ + libmach64.a \ + @KDRIVE_LOCAL_LIBS@ + +relink: + rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS) diff --git a/xorg-server/hw/kdrive/mach64/Makefile.in b/xorg-server/hw/kdrive/mach64/Makefile.in new file mode 100644 index 000000000..f1dc13650 --- /dev/null +++ b/xorg-server/hw/kdrive/mach64/Makefile.in @@ -0,0 +1,719 @@ +# 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 = Xmach64$(EXEEXT) +subdir = hw/kdrive/mach64 +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 +libmach64_a_AR = $(AR) $(ARFLAGS) +libmach64_a_LIBADD = +am_libmach64_a_OBJECTS = mach64.$(OBJEXT) mach64draw.$(OBJEXT) \ + mach64video.$(OBJEXT) +libmach64_a_OBJECTS = $(am_libmach64_a_OBJECTS) +am__installdirs = "$(DESTDIR)$(bindir)" +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) +am_Xmach64_OBJECTS = mach64stub.$(OBJEXT) +Xmach64_OBJECTS = $(am_Xmach64_OBJECTS) +Xmach64_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(Xmach64_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 = $(libmach64_a_SOURCES) $(Xmach64_SOURCES) +DIST_SOURCES = $(libmach64_a_SOURCES) $(Xmach64_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@ + +@TSLIB_TRUE@TSLIB_FLAG = -lts +noinst_LIBRARIES = libmach64.a +libmach64_a_SOURCES = \ + mach64.c \ + mach64draw.c \ + mach64video.c \ + mach64.h \ + mach64draw.h + +Xmach64_SOURCES = \ + mach64stub.c + +MACH64_LIBS = \ + libmach64.a \ + $(top_builddir)/hw/kdrive/vesa/libvesa.a + +@GLX_TRUE@Xmach64_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) +Xmach64_LDADD = \ + $(MACH64_LIBS) \ + @KDRIVE_LIBS@ + +Xmach64_DEPENDENCIES = \ + libmach64.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/mach64/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign hw/kdrive/mach64/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) +libmach64.a: $(libmach64_a_OBJECTS) $(libmach64_a_DEPENDENCIES) + -rm -f libmach64.a + $(libmach64_a_AR) libmach64.a $(libmach64_a_OBJECTS) $(libmach64_a_LIBADD) + $(RANLIB) libmach64.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 +Xmach64$(EXEEXT): $(Xmach64_OBJECTS) $(Xmach64_DEPENDENCIES) + @rm -f Xmach64$(EXEEXT) + $(Xmach64_LINK) $(Xmach64_OBJECTS) $(Xmach64_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mach64.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mach64draw.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mach64stub.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mach64video.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/mach64/mach64.c b/xorg-server/hw/kdrive/mach64/mach64.c new file mode 100644 index 000000000..3c513ba17 --- /dev/null +++ b/xorg-server/hw/kdrive/mach64/mach64.c @@ -0,0 +1,433 @@ +/* + * Copyright © 2001 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +#include <kdrive-config.h> +#endif +#include "mach64.h" +#include "kaa.h" + +static Bool +mach64CardInit (KdCardInfo *card) +{ + Mach64CardInfo *mach64c; + + mach64c = (Mach64CardInfo *) xalloc (sizeof (Mach64CardInfo)); + if (!mach64c) + return FALSE; + + (void) mach64MapReg (card, mach64c); + mach64c->lcdEnabled = FALSE; + + if (!vesaInitialize (card, &mach64c->vesa)) + { + xfree (mach64c); + return FALSE; + } + + card->driver = mach64c; + + return TRUE; +} + +static Bool +mach64ScreenInit (KdScreenInfo *screen) +{ + Mach64CardInfo *mach64c = screen->card->driver; + Mach64ScreenInfo *mach64s; + + mach64s = (Mach64ScreenInfo *) xalloc (sizeof (Mach64ScreenInfo)); + if (!mach64s) + return FALSE; + memset (mach64s, '\0', sizeof (Mach64ScreenInfo)); + if (!vesaScreenInitialize (screen, &mach64s->vesa)) + { + xfree (mach64s); + return FALSE; + } + if (!mach64c->reg) + screen->dumb = TRUE; + if (mach64s->vesa.mapping != VESA_LINEAR) + screen->dumb = TRUE; + switch (screen->fb[0].depth) { + case 8: + mach64s->colorKey = 0xff; + break; + case 15: + case 16: + mach64s->colorKey = 0x001e; + break; + case 24: + mach64s->colorKey = 0x0000fe; + break; + default: + mach64s->colorKey = 1; + break; + } + screen->driver = mach64s; + return TRUE; +} + +static Bool +mach64InitScreen (ScreenPtr pScreen) +{ +#ifdef XV + mach64InitVideo(pScreen); +#endif + return vesaInitScreen (pScreen); +} + +#ifdef RANDR +static Bool +mach64RandRSetConfig (ScreenPtr pScreen, + Rotation rotation, + int rate, + RRScreenSizePtr pSize) +{ + kaaWaitSync (pScreen); + + if (!vesaRandRSetConfig (pScreen, rotation, rate, pSize)) + return FALSE; + + return TRUE; +} + +static void +mach64RandRInit (ScreenPtr pScreen) +{ + rrScrPriv(pScreen); + + pScrPriv->rrSetConfig = mach64RandRSetConfig; +} +#endif + +static Bool +mach64FinishInitScreen (ScreenPtr pScreen) +{ + Bool ret; + ret = vesaFinishInitScreen (pScreen); +#ifdef RANDR + mach64RandRInit (pScreen); +#endif + return ret; +} + +static Bool +mach64CreateResources (ScreenPtr pScreen) +{ + return vesaCreateResources (pScreen); +} + +CARD32 +mach64ReadLCD (Reg *reg, int id) +{ + CARD32 LCD_INDEX; + + LCD_INDEX = reg->LCD_INDEX & ~(0x3f); + reg->LCD_INDEX = (LCD_INDEX | id); + return reg->LCD_DATA; +} + +void +mach64WriteLCD (Reg *reg, int id, CARD32 data) +{ + CARD32 LCD_INDEX; + + LCD_INDEX = reg->LCD_INDEX & ~(0x3f); + reg->LCD_INDEX = (LCD_INDEX | id); + reg->LCD_DATA = data; +} + +void +mach64Preserve (KdCardInfo *card) +{ + Mach64CardInfo *mach64c = card->driver; + Reg *reg = mach64c->reg; + + vesaPreserve(card); + if (reg) + { + mach64c->save.LCD_GEN_CTRL = mach64ReadLCD (reg, 1); + } +} + +Bool +mach64MapReg (KdCardInfo *card, Mach64CardInfo *mach64c) +{ + mach64c->reg_base = (CARD8 *) KdMapDevice (MACH64_REG_BASE(card), + MACH64_REG_SIZE(card)); + + if (!mach64c->reg_base) + { + mach64c->reg = 0; + mach64c->media_reg = 0; + return FALSE; + } + + KdSetMappedMode (MACH64_REG_BASE(card), + MACH64_REG_SIZE(card), + KD_MAPPED_MODE_REGISTERS); + mach64c->reg = (Reg *) (mach64c->reg_base + MACH64_REG_OFF(card)); + mach64c->media_reg = (MediaReg *) (mach64c->reg_base + MACH64_MEDIA_REG_OFF(card)); + return TRUE; +} + +void +mach64UnmapReg (KdCardInfo *card, Mach64CardInfo *mach64c) +{ + if (mach64c->reg_base) + { + KdResetMappedMode (MACH64_REG_BASE(card), + MACH64_REG_SIZE(card), + KD_MAPPED_MODE_REGISTERS); + KdUnmapDevice ((void *) mach64c->reg_base, MACH64_REG_SIZE(card)); + mach64c->reg_base = 0; + mach64c->reg = 0; + mach64c->media_reg = 0; + } +} + +void +mach64SetMMIO (KdCardInfo *card, Mach64CardInfo *mach64c) +{ + if (!mach64c->reg_base) + mach64MapReg (card, mach64c); + if (mach64c->reg) + { + if (mach64c->reg->GUI_STAT == 0xffffffff) + FatalError ("Mach64 REG not visible\n"); + } +} + +void +mach64ResetMMIO (KdCardInfo *card, Mach64CardInfo *mach64c) +{ + mach64UnmapReg (card, mach64c); +} + +Bool +mach64Enable (ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + Mach64CardInfo *mach64c = pScreenPriv->card->driver; + + if (!vesaEnable (pScreen)) + return FALSE; + + mach64SetMMIO (pScreenPriv->card, mach64c); + mach64DPMS (pScreen, KD_DPMS_NORMAL); +#ifdef XV + KdXVEnable (pScreen); +#endif + return TRUE; +} + +void +mach64Disable (ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + Mach64CardInfo *mach64c = pScreenPriv->card->driver; + +#ifdef XV + KdXVDisable (pScreen); +#endif + mach64ResetMMIO (pScreenPriv->card, mach64c); + vesaDisable (pScreen); +} + +const CARD8 mach64DPMSModes[4] = { + 0x80, /* KD_DPMS_NORMAL */ + 0x8c, /* KD_DPMS_STANDBY */ + 0x8c, /* KD_DPMS_STANDBY */ + 0x8c, /* KD_DPMS_STANDBY */ +/* 0xb0, KD_DPMS_SUSPEND */ +/* 0xbc, KD_DPMS_POWERDOWN */ +}; + +#define PWR_MGT_ON (1 << 0) +#define PWR_MGT_MODE (3 << 1) +#define PWR_MGT_MODE_PIN (0 << 1) +#define PWR_MGT_MODE_REG (1 << 1) +#define PWR_MGT_MODE_TIMER (2 << 1) +#define PWR_MGR_MODE_PCI (3 << 1) +#define AUTO_PWRUP_EN (1 << 3) +#define ACTIVITY_PIN_ON (1 << 4) +#define STANDBY_POL (1 << 5) +#define SUSPEND_POL (1 << 6) +#define SELF_REFRESH (1 << 7) +#define ACTIVITY_PIN_EN (1 << 8) +#define KEYBD_SNOOP (1 << 9) +#define DONT_USE_F32KHZ (1 << 10) +#define TRISTATE_MEM_EN (1 << 11) +#define LCDENG_TEST_MODE (0xf << 12) +#define STANDBY_COUNT (0xf << 16) +#define SUSPEND_COUNT (0xf << 20) +#define BIASON (1 << 24) +#define BLON (1 << 25) +#define DIGON (1 << 26) +#define PM_D3_RST_ENB (1 << 27) +#define STANDBY_NOW (1 << 28) +#define SUSPEND_NOW (1 << 29) +#define PWR_MGT_STATUS (3 << 30) +#define PWR_MGT_STATUS_ON (0 << 30) +#define PWR_MGT_STATUS_STANDBY (1 << 30) +#define PWR_MGT_STATUS_SUSPEND (2 << 30) +#define PWR_MGT_STATUS_TRANSITION (3 << 30) + +Bool +mach64DPMS (ScreenPtr pScreen, int mode) +{ + KdScreenPriv(pScreen); + Mach64CardInfo *mach64c = pScreenPriv->card->driver; + int hsync_off = 0, vsync_off = 0, blank = 0; + CARD32 CRTC_GEN_CNTL; + CARD32 LCD_GEN_CTRL; + Reg *reg = mach64c->reg; + + if (!reg) + return FALSE; + + CRTC_GEN_CNTL = reg->CRTC_GEN_CNTL; + LCD_GEN_CTRL = mach64ReadLCD (reg, 1); + + switch (mode) { + case KD_DPMS_NORMAL: + hsync_off = 0; + vsync_off = 0; + blank = 0; + break; + case KD_DPMS_STANDBY: + hsync_off = 1; + vsync_off = 0; + blank = 1; + break; + case KD_DPMS_SUSPEND: + hsync_off = 0; + vsync_off = 1; + blank = 1; + break; + case KD_DPMS_POWERDOWN: + hsync_off = 1; + vsync_off = 1; + blank = 1; + } + + if (hsync_off) + CRTC_GEN_CNTL |= (1 << 2); + else + CRTC_GEN_CNTL &= ~(1 << 2); + if (vsync_off) + CRTC_GEN_CNTL |= (1 << 3); + else + CRTC_GEN_CNTL &= ~(1 << 3); + if (blank) + { + mach64c->lcdEnabled = (LCD_GEN_CTRL & (1 << 1)) != 0; + LCD_GEN_CTRL &= ~(1 << 1); + CRTC_GEN_CNTL |= (1 << 6); + + } + else + { + if (!(LCD_GEN_CTRL & 3) || mach64c->lcdEnabled) + LCD_GEN_CTRL |= (1 << 1); + CRTC_GEN_CNTL &= ~(1 << 6); + } + + kaaWaitSync (pScreen); + + mach64WriteLCD (reg, 1, LCD_GEN_CTRL); + + reg->CRTC_GEN_CNTL = CRTC_GEN_CNTL; + return TRUE; +} + +static void +mach64Restore (KdCardInfo *card) +{ + Mach64CardInfo *mach64c = card->driver; + Reg *reg = mach64c->reg; + + if (reg) + { + mach64WriteLCD (reg, 1, mach64c->save.LCD_GEN_CTRL); + } + mach64ResetMMIO (card, mach64c); + vesaRestore (card); +} + +static void +mach64ScreenFini (KdScreenInfo *screen) +{ + Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; +#ifdef XV + mach64FiniVideo(screen->pScreen); +#endif + vesaScreenFini (screen); + xfree (mach64s); + screen->driver = 0; +} + +static void +mach64CardFini (KdCardInfo *card) +{ + Mach64CardInfo *mach64c = card->driver; + + mach64UnmapReg (card, mach64c); + vesaCardFini (card); + xfree (mach64c); +} + +#define mach64CursorInit 0 /* initCursor */ +#define mach64CursorEnable 0 /* enableCursor */ +#define mach64CursorDisable 0 /* disableCursor */ +#define mach64CursorFini 0 /* finiCursor */ +#define mach64RecolorCursor 0 /* recolorCursor */ + +KdCardFuncs mach64Funcs = { + mach64CardInit, /* cardinit */ + mach64ScreenInit, /* scrinit */ + mach64InitScreen, /* initScreen */ + mach64FinishInitScreen, /* finishInitScreen */ + mach64CreateResources, /* createRes */ + mach64Preserve, /* preserve */ + mach64Enable, /* enable */ + mach64DPMS, /* dpms */ + mach64Disable, /* disable */ + mach64Restore, /* restore */ + mach64ScreenFini, /* scrfini */ + mach64CardFini, /* cardfini */ + + mach64CursorInit, /* initCursor */ + mach64CursorEnable, /* enableCursor */ + mach64CursorDisable, /* disableCursor */ + mach64CursorFini, /* finiCursor */ + mach64RecolorCursor, /* recolorCursor */ + + mach64DrawInit, /* initAccel */ + mach64DrawEnable, /* enableAccel */ + mach64DrawDisable, /* disableAccel */ + mach64DrawFini, /* finiAccel */ + + vesaGetColors, /* getColors */ + vesaPutColors, /* putColors */ +}; diff --git a/xorg-server/hw/kdrive/mach64/mach64.h b/xorg-server/hw/kdrive/mach64/mach64.h new file mode 100644 index 000000000..fbb10b2ba --- /dev/null +++ b/xorg-server/hw/kdrive/mach64/mach64.h @@ -0,0 +1,653 @@ +/* + * Copyright © 2001 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _MACH64_H_ +#define _MACH64_H_ +#include <vesa.h> +#include "kxv.h" + +/* + * offset from ioport beginning + */ + +#define MACH64_REG_BASE(c) ((c)->attr.address[1]) +#define MACH64_REG_SIZE(c) (4096) + +#define MACH64_REG_OFF(c) (1024) +#define MACH64_MEDIA_REG_OFF(c) (0) + +typedef volatile CARD8 VOL8; +typedef volatile CARD16 VOL16; +typedef volatile CARD32 VOL32; + +typedef struct _Reg { + VOL32 CRTC_H_TOTAL_DISP; /* 0x00 */ + VOL32 CRTC_H_SYNC_STRT_WID; /* 0x01 */ + VOL32 CRTC_V_TOTAL_DISP; /* 0x02 */ + VOL32 CRTC_V_SYNC_STRT_WID; /* 0x03 */ + VOL32 CRTC_VLINE_CRNT_VLINE; /* 0x04 */ + VOL32 CRTC_OFF_PITCH; /* 0x05 */ + VOL32 CRTC_INT_CNTL; /* 0x06 */ + VOL32 CRTC_GEN_CNTL; /* 0x07 */ + VOL32 DSP_CONFIG; /* 0x08 */ + VOL32 DSP_ON_OFF; /* 0x09 */ + VOL32 TIMER_CONFIG; /* 0x0a */ + VOL32 MEM_BUF_CNTL; /* 0x0b */ + VOL32 unused0; /* 0x0c */ + VOL32 MEM_ADDR_CONFIG; /* 0x0d */ + VOL32 CRT_TRAP; /* 0x0e */ + VOL32 I2C_CNTL_0; /* 0x0f */ + VOL32 OVR_CLR; /* 0x10 */ + VOL32 OVR_WID_LEFT_RIGHT; /* 0x11 */ + VOL32 OVR_WID_TOP_BOTTOM; /* 0x12 */ + VOL32 VGA_DSP_CONFIG; /* 0x13 */ + VOL32 VGA_DSP_ON_OFF; /* 0x14 */ + VOL32 DSP2_CONFIG; /* 0x15 */ + VOL32 DSP2_ON_OFF; /* 0x16 */ + VOL32 CRTC2_OFF_PITCH; /* 0x17 */ + VOL32 CUR_CLR0; /* 0x18 */ + VOL32 CUR_CLR1; /* 0x19 */ + VOL32 CUR_OFFSET; /* 0x1a */ + VOL32 CUR_HORZ_VERT_POSN; /* 0x1b */ + VOL32 CUR_HORZ_VERT_OFF; /* 0x1c */ + VOL32 TV_OUT_INDEX; /* 0x1d */ + VOL32 GP_IO; /* 0x1e */ + VOL32 HW_DEBUG; /* 0x1f */ + VOL32 SCRATCH_REG0; /* 0x20 */ + VOL32 SCRATCH_REG1; + VOL32 SCRATCH_REG2; + VOL32 SCRATCH_REG3; + VOL32 CLOCK_CNTL; + VOL32 CONFIG_STAT1; + VOL32 CONFIG_STAT2; + VOL32 TV_OUT_DATA; + VOL32 BUS_CNTL; /* 0x28 */ + VOL32 LCD_INDEX; /* 0x29 */ + VOL32 LCD_DATA; /* 0x2a */ + VOL32 EXT_MEM_CNTL; + VOL32 MEM_CNTL; + VOL32 MEM_VGA_WP_SEL; + VOL32 MEM_VGA_RP_SEL; + VOL32 I2C_CNTL_1; + VOL32 DAC_REGS; /* 0x30 */ + VOL32 DAC_CNTL; /* 0x31 */ + VOL32 unused_32; + VOL32 unused_33; + VOL32 GEN_TEST_CNTL; /* 0x34 */ + VOL32 CUSTOM_MACRO_CNTL; + VOL32 unused36; + VOL32 CONFIG_CNTL; + VOL32 CONFIG_CHIP_ID; + VOL32 CONFIG_STAT0; + VOL32 CRC_SIG; + VOL32 unused_3b; + VOL32 unused_3c; + VOL32 unused_3d; + VOL32 unused_3e; + VOL32 unused_3f; + VOL32 DST_OFF_PITCH; /* 0x40 */ + VOL32 DST_X; + VOL32 DST_Y; + VOL32 DST_Y_X; + VOL32 DST_WIDTH; + VOL32 DST_HEIGHT; + VOL32 DST_HEIGHT_WIDTH; + VOL32 DST_X_WIDTH; + VOL32 DST_BRES_LNTH; + VOL32 DST_BRES_ERR; + VOL32 DST_BRES_INC; + VOL32 DST_BRES_DEC; + VOL32 DST_CNTL; + VOL32 DST_Y_X_ALIAS; + VOL32 TRAIL_BRES_ERR; + VOL32 TRAIL_BRES_INC; + VOL32 TRAIL_BRES_DEC; + VOL32 LEAD_BRES_LNTH; + VOL32 Z_OFF_PITCH; + VOL32 Z_CNTL; + VOL32 ALPHA_TST_CNTL; + VOL32 unused55; + VOL32 SECONDARY_STW_EXP; + VOL32 SECONDARY_S_X_INC; + VOL32 SECONDARY_S_Y_INC; + VOL32 SECONDARY_S_START; + VOL32 SECONDARY_W_X_INC; + VOL32 SECONDARY_W_Y_INC; + VOL32 SECONDARY_W_START; + VOL32 SECONDARY_T_X_INC; + VOL32 SECONDARY_T_Y_INC; + VOL32 SECONDARY_T_START; + VOL32 SRC_OFF_PITCH; + VOL32 SRC_X; + VOL32 SRC_Y; + VOL32 SRC_Y_X; + VOL32 SRC_WIDTH1; + VOL32 SRC_HEIGHT1; + VOL32 SRC_HEIGHT1_WIDTH1; + VOL32 SRC_X_START; + VOL32 SRC_Y_START; + VOL32 SRC_Y_X_START; + VOL32 SRC_WIDTH2; + VOL32 SRC_HEIGHT2; + VOL32 SRC_HEIGHT2_WIDTH2; + VOL32 SRC_CNTL; + VOL32 unused6e; + VOL32 unused6f; + union { + struct { + VOL32 SCALE_OFF; /* 0x70 */ + VOL32 unused71; + VOL32 unused72; + VOL32 unused73; + VOL32 unused74; + VOL32 unused75; + VOL32 unused76; + VOL32 SCALE_WIDTH; + VOL32 SCALE_HEIGHT; + VOL32 unused79; + VOL32 unused7a; + VOL32 SCALE_PITCH; + VOL32 SCALE_X_INC; + VOL32 SCALE_Y_INC; + VOL32 SCALE_VACC; + VOL32 SCALE_3D_CNTL; /* 0x7f */ + } scaler; + struct { + VOL32 TEX_0_OFF; /* 0x70 */ + VOL32 TEX_1_OFF; + VOL32 TEX_2_OFF; + VOL32 TEX_3_OFF; + VOL32 TEX_4_OFF; + VOL32 TEX_5_OFF; + VOL32 TEX_6_OFF; + VOL32 TEX_7_OFF; + VOL32 TEX_8_OFF; + VOL32 TEX_9_OFF; + VOL32 TEX_10_OFF; + VOL32 S_Y_INC; + VOL32 RED_X_INC; + VOL32 GREEN_X_INC; /* 0x7d */ + VOL32 unused7e; + VOL32 unused7f; + } texture; + } u; + VOL32 HOST_DATA[16]; /* 0x80 */ + VOL32 HOST_CNTL; /* 0x90 */ + VOL32 BM_HOSTDATA; /* 0x91 */ + VOL32 BM_ADDR; /* 0x92 */ + VOL32 BM_GUI_TABLE_CMD; /* 0x93 */ + VOL32 unused94; /* 0x94 */ + VOL32 unused95; /* 0x95 */ + VOL32 unused96; /* 0x96 */ + VOL32 FOG_TABLE_INDEX; /* 0x97 */ + VOL32 FOG_TABLE_DATA[8]; /* 0x98 */ + VOL32 PAT_REG0; /* 0xa0 */ + VOL32 PAT_REG1; + VOL32 PAT_CNTL; + VOL32 unused_0a3; + VOL32 unused_0a4; + VOL32 unused_0a5; + VOL32 unused_0a6; + VOL32 unused_0a7; + VOL32 SC_LEFT; + VOL32 SC_RIGHT; + VOL32 SC_LEFT_RIGHT; + VOL32 SC_TOP; + VOL32 SC_BOTTOM; + VOL32 SC_TOP_BOTTOM; + VOL32 USR1_DST_OFF_PITCH; + VOL32 USR2_DST_OFF_PITCH; + VOL32 DP_BKGD_CLR; /* 0xb0 */ + VOL32 DP_FRGD_CLR; + VOL32 DP_WRITE_MSK; + VOL32 unused_0b3; + VOL32 DP_PIX_WIDTH; + VOL32 DP_MIX; + VOL32 DP_SRC; + VOL32 DP_FRGD_CLR_MIX; + VOL32 DP_FRGD_BKGD_CLR; + VOL32 unused_0b9; + VOL32 DST_X_Y; + VOL32 DST_WIDTH_HEIGHT; + VOL32 USR_DST_PITCH; + VOL32 unused_0bd; + VOL32 DP_SET_GUI_ENGINE2; + VOL32 DP_SET_GUI_ENGINE; + VOL32 CLR_CMP_CLR; /* 0xc0 */ + VOL32 CLR_CMP_MSK; + VOL32 CLR_CMP_CNTL; + VOL32 unused_0c3; + VOL32 FIFO_STAT; + VOL32 unused_0c5; + VOL32 unused_0c6; + VOL32 unused_0c7; + VOL32 unused_0c8; + VOL32 unused_0c9; + VOL32 unused_0ca; + VOL32 unused_0cb; + VOL32 GUI_TRAJ_CNTL; + VOL32 unused_0cd; + VOL32 GUI_STAT; + VOL32 unused_0cf; + VOL32 TEX_PALETTE_INDEX; + VOL32 STW_EXP; + VOL32 LOG_MAX_INC; + VOL32 S_X_INC; + VOL32 S_Y_INC_2_SCALE_PITCH; + VOL32 S_START; + VOL32 W_X_INC; + VOL32 W_Y_INC; + VOL32 W_START; + VOL32 T_X_INC; + VOL32 T_Y_INC_SECONDARY_SCALE_PITCH; + VOL32 T_START; + VOL32 TEX_SIZE_PITCH; + VOL32 TEX_CNTL; + VOL32 SECONDARY_TEX_OFFSET_SECONDARY_SCALE_OFF; + VOL32 TEX_PALETTE; + VOL32 SCALE_PITCH_BOTH; /* 0xe0 */ + VOL32 SECONDARY_SCALE_OFF_ACC; + VOL32 SCALE_OFF_ACC; + VOL32 SCALE_DST_Y_X; + VOL32 unused_0e4; + VOL32 unused_0e5; + VOL32 COMPOSITE_SHADOW_ID; + VOL32 SECONDARY_SCALE_X_INC_SPECULAR_RED_X_INC; + VOL32 SPECULAR_RED_Y_INC; + VOL32 SPECULAR_RED_START_SECONDARY_SCALE_HACC;; + VOL32 SPECULAR_GREEN_X_INC; + VOL32 SPECULAR_GREEN_Y_INC; + VOL32 SPECULAR_GREEN_START; + VOL32 SPECULAR_BLUE_X_INC; + VOL32 SPECULAR_BLUE_Y_INC; + VOL32 SPECULAR_BLUE_START; + VOL32 RED_X_INC_SCALE_X_INC; + VOL32 RED_Y_INC; + VOL32 RED_START_SCALE_HACC; + VOL32 GREEN_X_INC_SCALE_Y_INC; + VOL32 GREEN_Y_INC_SECONDARY_SCALE_Y_INC; + VOL32 GREEN_START_SECONDARY_SCALE_VACC; + VOL32 BLUE_X_INC; + VOL32 BLUE_Y_INC; + VOL32 BLUE_START; + VOL32 Z_X_INC; + VOL32 Z_Y_INC; + VOL32 Z_START; + VOL32 ALPHA_X_INC; + VOL32 FOG_X_INC; + VOL32 ALPHA_Y_INC; + VOL32 FOG_Y_INC; + VOL32 ALPHA_START; + VOL32 FOG_START; + VOL32 unused_0ff; +} Reg; /* 0x100 */ + +#define DST_X_DIR (1 << 0) +#define DST_Y_DIR (1 << 1) +#define DST_Y_MAJOR (1 << 2) +#define DST_X_TILE (1 << 3) +#define DST_Y_TILE (1 << 4) +#define DST_LAST_PEL (1 << 5) +#define DST_POLYGON_EN (1 << 6) +#define DST_24_ROT_EN (1 << 7) +#define DST_24_ROT(n) ((n) << 8) +#define DST_BRES_ZERO (1 << 11) +#define DST_POLYGON_RTEDGE_DIS (1 << 12) +#define TRAIL_X_DIR (1 << 13) +#define TRAP_FILL_DIR (1 << 14) +#define TRAIL_BRES_SIGN (1 << 15) +#define SRC_PATT_EN (1 << 16) +#define SRC_PATT_ROT_EN (1 << 17) +#define SRC_LINEAR_EN (1 << 18) +#define SRC_BYTE_ALIGN (1 << 19) +#define SRC_LINE_X_DIR (1 << 20) +#define SRC_8x8x8_BRUSH (1 << 21) +#define FAST_FILL_EN (1 << 22) +#define SRC_TRACK_DST (1 << 23) +#define PAT_MONO_EN (1 << 24) +#define PAT_CLR_4x2_EN (1 << 25) +#define PAT_CLR_8x1_EN (1 << 26) +#define HOST_BYTE_ALIGN (1 << 28) +#define HOST_BIG_ENDIAN_EN (1 << 29) + +/* BUS_CNTL bits */ +#define BUS_DBL_RESYNC (1 << 0) +#define BUS_MSTR_RESET (1 << 1) +#define BUS_FLUSH_BUF (1 << 2) +#define BUS_STOP_REQ_DIS (1 << 3) +#define BUS_APER_REG_DIS (1 << 4) +#define BUS_EXTRA_PIPE_DIS (1 << 5) +#define BUS_MASTER_DIS (1 << 6) +#define ROM_WRT_EN (1 << 7) +#define CHIP_HIDDEN_REV (3 << 8) +#define BUS_PCI_READ_RETRY_EN (1 << 13) +#define BUS_PCI_WRT_RETRY_EN (1 << 15) +#define BUS_RETRY_WS (0xf << 16) +#define BUS_MSTR_RD_MULT (1 << 20) +#define BUS_MSTR_RD_LINE (1 << 21) +#define BUS_SUSPEND (1 << 22) +#define LAT16X (1 << 23) +#define BUS_RD_DISCARD_EN (1 << 24) +#define BUS_RD_ABORT_EN (1 << 25) +#define BUS_MSTR_WS (1 << 26) +#define BUS_EXT_REG_EN (1 << 27) +#define BUS_MSTR_DISCONNECT_EN (1 << 28) +#define BUS_WRT_BURST (1 << 29) +#define BUS_READ_BURST (1 << 30) +#define BUS_RDY_READ_DLY (1 << 31) + +#define SCALE_PIX_EXPAND (1 << 0) +#define SCALE_Y2R_TEMP (1 << 1) +#define SCALE_HORZ_MODE (1 << 2) +#define SCALE_VERT_MODE (1 << 3) +#define SCALE_SIGNED_UV (1 << 4) +#define SCALE_GAMMA_SEL (3 << 5) +#define SCALE_GAMMA_BRIGHT (0 << 5) +#define SCALE_GAMMA_22 (1 << 5) +#define SCALE_GAMMA_18 (2 << 5) +#define SCALE_GAMMA_14 (3 << 5) +#define SCALE_DISP_SEL (1 << 7) +#define SCALE_BANDWIDTH (1 << 26) +#define SCALE_DIS_LIMIT (1 << 27) +#define SCALE_CLK_FORCE_ON (1 << 29) +#define SCALE_OVERLAY_EN (1 << 30) +#define SCALE_EN (1 << 31) + +#define VIDEO_IN_VYUY422 (0xb) +#define VIDEO_IN_YVYU422 (0xc) +#define SCALER_IN_15bpp (0x3 << 16) +#define SCALER_IN_16bpp (0x4 << 16) +#define SCALER_IN_32bpp (0x6 << 16) +#define SCALER_IN_YUV_9 (0x9 << 16) +#define SCALER_IN_YUV_12 (0xa << 16) +#define SCALER_IN_VYUY422 (0xb << 16) +#define SCALER_IN_YVYU422 (0xc << 16) + +#define CAP_INPUT_MODE (1 << 0) +#define CAP_BUF_MODE (1 << 2) +#define CAP_START_BUF (1 << 3) +#define CAP_BUF_TYPE_FIELD (0 << 4) +#define CAP_BUF_TYPE_ALTERNATING (1 << 4) +#define CAP_BUF_TYPE_FRAME (2 << 4) + +#define OVL_BUF_MODE (1 << 28) +#define OVL_BUF_NEXT (1 << 29) + +#define CAP_TRIGGER (3 << 0) +#define OVL_CUR_BUF (1 << 5) +#define OVL_BUF_STATUS (1 << 6) +#define CAP_BUF_STATUS (1 << 7) +#define CAPTURE_EN (1 << 31) + +typedef struct _MediaReg { + VOL32 OVERLAY_Y_X_START; /* 0x100 */ + VOL32 OVERLAY_Y_X_END; + VOL32 OVERLAY_VIDEO_KEY_CLR; + VOL32 OVERLAY_VIDEO_KEY_MSK; + VOL32 OVERLAY_GRAPHICS_KEY_CLR; + VOL32 OVERLAY_GRAPHICS_KEY_MSK; + VOL32 OVERLAY_KEY_CNTL; + VOL32 unused_107; + VOL32 OVERLAY_SCALE_INC; + VOL32 OVERLAY_SCALE_CNTL; + VOL32 SCALER_HEIGHT_WIDTH; + VOL32 SCALER_TEST; + VOL32 unused_10c; + VOL32 SCALER_BUF0_OFFSET; + VOL32 SCALER_BUF1_OFFSET; + VOL32 SCALER_BUF_PITCH; + VOL32 CAPTURE_START_END; /* 0x110 */ + VOL32 CAPTURE_X_WIDTH; + VOL32 VIDEO_FORMAT; + VOL32 VBI_START_END; + VOL32 CAPTURE_CONFIG; + VOL32 TRIG_CNTL; + VOL32 OVERLAY_EXCLUSIVE_HORZ; + VOL32 OVERLAY_EXCLUSIVE_VERT; + VOL32 VBI_WIDTH; + VOL32 CAPTURE_DEBUG; + VOL32 VIDEO_SYNC_TEST; + VOL32 unused_11b; + VOL32 SNAPSHOT_VH_COUNTS; + VOL32 SNAPSHOT_F_COUNT; + VOL32 N_VIF_COUNT; + VOL32 SNAPSHOT_VIF_COUNT; + VOL32 CAPTURE_BUF0_OFFSET; /* 0x120 */ + VOL32 CAPTURE_BUF1_OFFSET; + VOL32 ONESHOT_BUF_OFFSET; + VOL32 unused_123; + VOL32 unused_124; + VOL32 unused_125; + VOL32 unused_126; + VOL32 unused_127; + VOL32 unused_128; + VOL32 unused_129; + VOL32 unused_12a; + VOL32 unused_12b; + VOL32 SNAPSHOT2_VH_COUNTS; + VOL32 SNAPSHOT2_F_COUNT; + VOL32 N_VIF2_COUNT; + VOL32 SNAPSHOT2_VIF_COUNT; + VOL32 MPP_CONFIG; /* 0x130 */ + VOL32 MPP_STROBE_SEQ; + VOL32 MPP_ADDR; + VOL32 MPP_DATA; + VOL32 unused_134; + VOL32 unused_135; + VOL32 unused_136; + VOL32 unused_137; + VOL32 unused_138; + VOL32 unused_139; + VOL32 unused_13a; + VOL32 unused_13b; + VOL32 unused_13c; + VOL32 unused_13d; + VOL32 unused_13e; + VOL32 unused_13f; + VOL32 TVO_CNTL; /* 0x140 */ + VOL32 unused_141[15]; + VOL32 unused_150; /* 0x150 */ + VOL32 CRT_HORZ_VERT_LOAD; /* 0x151 */ + VOL32 AGP_BASE; /* 0x152 */ + VOL32 AGP_CNTL; /* 0x153 */ + VOL32 SCALER_COLOUR_CNTL; /* 0x154 */ + VOL32 SCALER_H_COEFF0; /* 0x155 */ + VOL32 SCALER_H_COEFF1; /* 0x156 */ + VOL32 SCALER_H_COEFF2; /* 0x157 */ + VOL32 SCALER_H_COEFF3; /* 0x158 */ + VOL32 SCALER_H_COEFF4; /* 0x159 */ + VOL32 unused_15a; + VOL32 unused_15b; + VOL32 GUI_CMDFIFO_DEBUG; + VOL32 GUI_CMDFIFO_DATA; + VOL32 GUI_CNTL; + VOL32 unused_15f; + VOL32 BM_FRAME_BUF_OFFSET; /* 0x160 */ + VOL32 BM_SYSTEM_MEM_ADDR; + VOL32 BM_COMMAND; + VOL32 BM_STATUS; + VOL32 unused_164[10]; + VOL32 BM_GUI_TABLE; + VOL32 BM_SYSTEM_TABLE; + VOL32 unused_170[5]; /* 0x170 */ + VOL32 SCALER_BUF0_OFFSET_U; + VOL32 SCALER_BUF0_OFFSET_V; + VOL32 SCALER_BUF1_OFFSET_U; + VOL32 SCALER_BUF1_OFFSET_V; + VOL32 unused_179[7]; + VOL32 unused_180[16]; /* 0x180 */ + VOL32 setup_engine[0x40]; /* 0x190 */ + VOL32 dvd_subpicture[0x30]; /* 0x1d0 */ +} MediaReg; + +#define MACH64_XY(x,y) (((x) & 0x7fff) | (((y) & 0x7fff) << 16)) +#define MACH64_YX(x,y) (((y) & 0x7fff) | (((x) & 0x7fff) << 16)) + +typedef struct _mach64Save { + CARD32 LCD_GEN_CTRL; +} Mach64Save; + +typedef struct _mach64CardInfo { + VesaCardPrivRec vesa; + CARD8 *reg_base; + Reg *reg; + MediaReg *media_reg; + Mach64Save save; + Bool lcdEnabled; +} Mach64CardInfo; + +#define getMach64CardInfo(kd) ((Mach64CardInfo *) ((kd)->card->driver)) +#define mach64CardInfo(kd) Mach64CardInfo *mach64c = getMach64CardInfo(kd) + +typedef struct _mach64Cursor { + int width, height; + int xhot, yhot; + Bool has_cursor; + CursorPtr pCursor; + Pixel source, mask; +} Mach64Cursor; + +#define MACH64_CURSOR_WIDTH 64 +#define MACH64_CURSOR_HEIGHT 64 + +/* + * Xv information, optional + */ +typedef struct _mach64PortPriv { + CARD32 YBuf0Offset; + + CARD32 YBuf1Offset; + + CARD8 currentBuf; + + int brightness; + int saturation; + + RegionRec clip; + CARD32 colorKey; + + Bool videoOn; + Time offTime; + Time freeTime; + CARD32 size; + CARD32 offset; + KdOffscreenArea *off_screen; +} Mach64PortPrivRec, *Mach64PortPrivPtr; + +Bool mach64InitVideo(ScreenPtr pScreen); +void mach64FiniVideo(ScreenPtr pScreen); + +/* + * These values are per-format, which is essentially per-depth/per-bpp. + * Because bpp is fixed for the screen by depth, they're computed + * per-screen per-depth. + */ + +typedef struct _mach64ScreenInfo { + VesaScreenPrivRec vesa; + Mach64Cursor cursor; + CARD32 colorKey; + KdVideoAdaptorPtr pAdaptor; + KaaScreenInfoRec kaa; +} Mach64ScreenInfo; + +#define getMach64ScreenInfo(kd) ((Mach64ScreenInfo *) ((kd)->screen->driver)) +#define mach64ScreenInfo(kd) Mach64ScreenInfo *mach64s = getMach64ScreenInfo(kd) + +CARD32 +mach64ReadLCD (Reg *reg, int id); + +void +mach64WriteLCD (Reg *reg, int id, CARD32 data); + +void +mach64Preserve (KdCardInfo *card); + +Bool +mach64MapReg (KdCardInfo *card, Mach64CardInfo *mach64c); + +void +mach64UnmapReg (KdCardInfo *card, Mach64CardInfo *mach64c); + +void +mach64SetMMIO (KdCardInfo *card, Mach64CardInfo *mach64c); + +void +mach64ResetMMIO (KdCardInfo *card, Mach64CardInfo *mach64c); + +Bool +mach64Enable (ScreenPtr pScreen); + +void +mach64Disable (ScreenPtr pScreen); + +Bool +mach64DPMS (ScreenPtr pScreen, int mode); + +void +mach64WaitAvail(Reg *reg, int n); + +void +mach64WaitIdle (Reg *reg); + +Bool +mach64DrawSetup (ScreenPtr pScreen); + +Bool +mach64DrawInit (ScreenPtr pScreen); + +void +mach64DrawReinit (ScreenPtr pScreen); + +void +mach64DrawEnable (ScreenPtr pScreen); + +void +mach64DrawDisable (ScreenPtr pScreen); + +void +mach64DrawFini (ScreenPtr pScreen); + +CARD8 +mach64ReadIndex (Mach64CardInfo *mach64c, CARD16 port, CARD8 index); + +void +mach64WriteIndex (Mach64CardInfo *mach64c, CARD16 port, CARD8 index, CARD8 value); + +Bool +mach64CursorInit (ScreenPtr pScreen); + +void +mach64CursorEnable (ScreenPtr pScreen); + +void +mach64CursorDisable (ScreenPtr pScreen); + +void +mach64CursorFini (ScreenPtr pScreen); + +void +mach64RecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef); + +extern KdCardFuncs mach64Funcs; + +#endif /* _MACH64_H_ */ diff --git a/xorg-server/hw/kdrive/mach64/mach64draw.c b/xorg-server/hw/kdrive/mach64/mach64draw.c new file mode 100644 index 000000000..15d4d417a --- /dev/null +++ b/xorg-server/hw/kdrive/mach64/mach64draw.c @@ -0,0 +1,590 @@ +/* + * Copyright © 1999 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +#include <kdrive-config.h> +#endif +#include "mach64.h" +#include "mach64draw.h" + +#include <X11/Xmd.h> +#include "gcstruct.h" +#include "scrnintstr.h" +#include "pixmapstr.h" +#include "regionstr.h" +#include "mistruct.h" +#include "dixfontstr.h" +#include "fb.h" +#include "migc.h" +#include "miline.h" +#include "picturestr.h" +#include "kaa.h" + +CARD8 mach64Rop[16] = { + /* GXclear */ 0x01, /* 0 */ + /* GXand */ 0x0c, /* src AND dst */ + /* GXandReverse */ 0x0d, /* src AND NOT dst */ + /* GXcopy */ 0x07, /* src */ + /* GXandInverted*/ 0x0e, /* NOT src AND dst */ + /* GXnoop */ 0x03, /* dst */ + /* GXxor */ 0x05, /* src XOR dst */ + /* GXor */ 0x0b, /* src OR dst */ + /* GXnor */ 0x0f, /* NOT src AND NOT dst */ + /* GXequiv */ 0x06, /* NOT src XOR dst */ + /* GXinvert */ 0x00, /* NOT dst */ + /* GXorReverse */ 0x0a, /* src OR NOT dst */ + /* GXcopyInverted*/ 0x04, /* NOT src */ + /* GXorInverted */ 0x09, /* NOT src OR dst */ + /* GXnand */ 0x08, /* NOT src OR NOT dst */ + /* GXset */ 0x02, /* 1 */ +}; + +#define MACH64_DRAW_COMBO_SOLID 0x1 +#define MACH64_DRAW_COMBO_COPY 0x8 + +#define SYNC_ALWAYS 0 +static Reg *reg; +static CARD32 avail; +static CARD32 triple; + +#define IDX(reg,n) (&(reg)->n - &(reg)->CRTC_H_TOTAL_DISP) + +void +mach64WaitAvail(Reg *reg, int n) +{ + if (avail < n) + { + while ((avail = ((reg->GUI_STAT) >> 16) & 0x3ff) < n) + ; + } + avail -= n; +} + +void +mach64WaitIdle (Reg *reg) +{ + while (reg->GUI_STAT & 1) + ; +} + +#define PIX_FORMAT_MONO 0 +#define PIX_FORMAT_PSEUDO_8 2 +#define PIX_FORMAT_TRUE_1555 3 +#define PIX_FORMAT_TRUE_565 4 +#define PIX_FORMAT_TRUE_8888 6 +#define PIX_FORMAT_TRUE_332 7 +#define PIX_FORMAT_GRAY_8 8 +#define PIX_FORMAT_YUV_422 0xb +#define PIX_FORMAT_YUV_444 0xe +#define PIX_FORMAT_TRUE_4444 0xf + +typedef struct _mach64AccelReg { + int depth; + int bitsPerPixel; + CARD32 DP_PIX_WIDTH; + CARD32 DP_SET_GUI_ENGINE; +} Mach64AccelReg; + +static const Mach64AccelReg mach64AccelReg[] = { + { 1, 1, + /* DP_PIX_WIDTH */ + ((PIX_FORMAT_MONO << 0) | /* DP_DST_PIX_WIDTH */ + (PIX_FORMAT_MONO << 4) | /* COMPOSITE_PIX_WIDTH */ + (PIX_FORMAT_MONO << 8) | /* DP_SRC_PIX_WIDTH */ + (0 << 13) | /* DP_HOST_TRIPLE_EN */ + (0 << 14) | /* DP_PALETTE_TYPE */ + (PIX_FORMAT_MONO << 16) | /* DP_HOST_PIX_WIDTH */ + (0 << 20) | /* DP_C14_RGB_INDEX */ + (0 << 24) | /* DP_BYTE_PIX_ORDER */ + (0 << 25) | /* DP_CONVERSION_TEMP */ + (0 << 26) | /* DP_C14_RGB_LOW_NIBBLE */ + (0 << 27) | /* DP_C14_RGB_HIGH_NIBBLE */ + (PIX_FORMAT_MONO << 28) | /* DP_SCALE_PIX_WIDTH */ + 0), + /* DP_SET_GUI_ENGINE */ + ((PIX_FORMAT_MONO << 3) | + (1 << 6) | /* SET_DP_SRC_PIX_WIDTH */ + (6 << 7) | /* SET_DST_OFFSET */ + (0 << 10) | /* SET_DST_PITCH */ + (0 << 14) | /* SET_DST_PITCH_BY_2 */ + (0 << 15) | /* SET_SRC_OFFPITCH_COPY */ + (0 << 16) | /* SET_SRC_HGTWID1_2 */ + (0 << 20) | /* SET_DRAWING_COMBO */ + (1 << 24) | /* SET_BUS_MASTER_OP */ + (0 << 26) | /* SET_BUS_MASTER_EN */ + (0 << 27) | /* SET_BUS_MASTER_SYNC */ + (0 << 28) | /* DP_HOST_TRIPLE_EN */ + (0 << 29) | /* FAST_FILL_EN */ + (0 << 30) | /* BLOCK_WRITE_EN */ + 0) + }, + { 8, 8, + /* DP_PIX_WIDTH */ + ((PIX_FORMAT_PSEUDO_8 << 0) | /* DP_DST_PIX_WIDTH */ + (PIX_FORMAT_PSEUDO_8 << 4) | /* COMPOSITE_PIX_WIDTH */ + (PIX_FORMAT_PSEUDO_8 << 8) | /* DP_SRC_PIX_WIDTH */ + (0 << 13) | /* DP_HOST_TRIPLE_EN */ + (0 << 14) | /* DP_PALETTE_TYPE */ + (PIX_FORMAT_PSEUDO_8 << 16) | /* DP_HOST_PIX_WIDTH */ + (0 << 20) | /* DP_C14_RGB_INDEX */ + (0 << 24) | /* DP_BYTE_PIX_ORDER */ + (0 << 25) | /* DP_CONVERSION_TEMP */ + (0 << 26) | /* DP_C14_RGB_LOW_NIBBLE */ + (0 << 27) | /* DP_C14_RGB_HIGH_NIBBLE */ + (PIX_FORMAT_PSEUDO_8 << 28) | /* DP_SCALE_PIX_WIDTH */ + 0), + /* DP_SET_GUI_ENGINE */ + ((PIX_FORMAT_PSEUDO_8 << 3) | + (1 << 6) | /* SET_DP_SRC_PIX_WIDTH */ + (6 << 7) | /* SET_DST_OFFSET */ + (0 << 10) | /* SET_DST_PITCH */ + (0 << 14) | /* SET_DST_PITCH_BY_2 */ + (0 << 15) | /* SET_SRC_OFFPITCH_COPY */ + (0 << 16) | /* SET_SRC_HGTWID1_2 */ + (0 << 20) | /* SET_DRAWING_COMBO */ + (1 << 24) | /* SET_BUS_MASTER_OP */ + (0 << 26) | /* SET_BUS_MASTER_EN */ + (0 << 27) | /* SET_BUS_MASTER_SYNC */ + (0 << 28) | /* DP_HOST_TRIPLE_EN */ + (0 << 29) | /* FAST_FILL_EN */ + (0 << 30) | /* BLOCK_WRITE_EN */ + 0) + }, + { 15, 16, + /* DP_PIX_WIDTH */ + ((PIX_FORMAT_TRUE_1555 << 0) | /* DP_DST_PIX_WIDTH */ + (PIX_FORMAT_TRUE_1555 << 4) | /* COMPOSITE_PIX_WIDTH */ + (PIX_FORMAT_TRUE_1555 << 8) | /* DP_SRC_PIX_WIDTH */ + (0 << 13) | /* DP_HOST_TRIPLE_EN */ + (0 << 14) | /* DP_PALETTE_TYPE */ + (PIX_FORMAT_TRUE_1555 << 16) | /* DP_HOST_PIX_WIDTH */ + (0 << 20) | /* DP_C14_RGB_INDEX */ + (0 << 24) | /* DP_BYTE_PIX_ORDER */ + (0 << 25) | /* DP_CONVERSION_TEMP */ + (0 << 26) | /* DP_C14_RGB_LOW_NIBBLE */ + (0 << 27) | /* DP_C14_RGB_HIGH_NIBBLE */ + (PIX_FORMAT_TRUE_1555 << 28) | /* DP_SCALE_PIX_WIDTH */ + 0), + /* DP_SET_GUI_ENGINE */ + ((PIX_FORMAT_TRUE_1555 << 3) | + (1 << 6) | /* SET_DP_SRC_PIX_WIDTH */ + (6 << 7) | /* SET_DST_OFFSET */ + (0 << 10) | /* SET_DST_PITCH */ + (0 << 14) | /* SET_DST_PITCH_BY_2 */ + (0 << 15) | /* SET_SRC_OFFPITCH_COPY */ + (0 << 16) | /* SET_SRC_HGTWID1_2 */ + (0 << 20) | /* SET_DRAWING_COMBO */ + (1 << 24) | /* SET_BUS_MASTER_OP */ + (0 << 26) | /* SET_BUS_MASTER_EN */ + (0 << 27) | /* SET_BUS_MASTER_SYNC */ + (0 << 28) | /* DP_HOST_TRIPLE_EN */ + (0 << 29) | /* FAST_FILL_EN */ + (0 << 30) | /* BLOCK_WRITE_EN */ + 0) + }, + { 16, 16, + /* DP_PIX_WIDTH */ + ((PIX_FORMAT_TRUE_565 << 0) | /* DP_DST_PIX_WIDTH */ + (PIX_FORMAT_TRUE_565 << 4) | /* COMPOSITE_PIX_WIDTH */ + (PIX_FORMAT_TRUE_565 << 8) | /* DP_SRC_PIX_WIDTH */ + (0 << 13) | /* DP_HOST_TRIPLE_EN */ + (0 << 14) | /* DP_PALETTE_TYPE */ + (PIX_FORMAT_TRUE_565 << 16) | /* DP_HOST_PIX_WIDTH */ + (0 << 20) | /* DP_C14_RGB_INDEX */ + (0 << 24) | /* DP_BYTE_PIX_ORDER */ + (0 << 25) | /* DP_CONVERSION_TEMP */ + (0 << 26) | /* DP_C14_RGB_LOW_NIBBLE */ + (0 << 27) | /* DP_C14_RGB_HIGH_NIBBLE */ + (PIX_FORMAT_TRUE_565 << 28) | /* DP_SCALE_PIX_WIDTH */ + 0), + /* DP_SET_GUI_ENGINE */ + ((PIX_FORMAT_TRUE_565 << 3) | + (1 << 6) | /* SET_DP_SRC_PIX_WIDTH */ + (6 << 7) | /* SET_DST_OFFSET */ + (0 << 10) | /* SET_DST_PITCH */ + (0 << 14) | /* SET_DST_PITCH_BY_2 */ + (0 << 15) | /* SET_SRC_OFFPITCH_COPY */ + (0 << 16) | /* SET_SRC_HGTWID1_2 */ + (0 << 20) | /* SET_DRAWING_COMBO */ + (1 << 24) | /* SET_BUS_MASTER_OP */ + (0 << 26) | /* SET_BUS_MASTER_EN */ + (0 << 27) | /* SET_BUS_MASTER_SYNC */ + (0 << 28) | /* DP_HOST_TRIPLE_EN */ + (0 << 29) | /* FAST_FILL_EN */ + (0 << 30) | /* BLOCK_WRITE_EN */ + 0) + }, + { 24, 24, + /* DP_PIX_WIDTH */ + ((PIX_FORMAT_PSEUDO_8 << 0) | /* DP_DST_PIX_WIDTH */ + (PIX_FORMAT_PSEUDO_8 << 4) | /* COMPOSITE_PIX_WIDTH */ + (PIX_FORMAT_PSEUDO_8 << 8) | /* DP_SRC_PIX_WIDTH */ + (0 << 13) | /* DP_HOST_TRIPLE_EN */ + (0 << 14) | /* DP_PALETTE_TYPE */ + (PIX_FORMAT_PSEUDO_8 << 16) | /* DP_HOST_PIX_WIDTH */ + (0 << 20) | /* DP_C14_RGB_INDEX */ + (0 << 24) | /* DP_BYTE_PIX_ORDER */ + (0 << 25) | /* DP_CONVERSION_TEMP */ + (0 << 26) | /* DP_C14_RGB_LOW_NIBBLE */ + (0 << 27) | /* DP_C14_RGB_HIGH_NIBBLE */ + (PIX_FORMAT_PSEUDO_8 << 28) | /* DP_SCALE_PIX_WIDTH */ + 0), + /* DP_SET_GUI_ENGINE */ + ((PIX_FORMAT_PSEUDO_8 << 3) | + (1 << 6) | /* SET_DP_SRC_PIX_WIDTH */ + (6 << 7) | /* SET_DST_OFFSET */ + (0 << 10) | /* SET_DST_PITCH */ + (0 << 14) | /* SET_DST_PITCH_BY_2 */ + (0 << 15) | /* SET_SRC_OFFPITCH_COPY */ + (0 << 16) | /* SET_SRC_HGTWID1_2 */ + (0 << 20) | /* SET_DRAWING_COMBO */ + (1 << 24) | /* SET_BUS_MASTER_OP */ + (0 << 26) | /* SET_BUS_MASTER_EN */ + (0 << 27) | /* SET_BUS_MASTER_SYNC */ + (0 << 28) | /* DP_HOST_TRIPLE_EN */ + (0 << 29) | /* FAST_FILL_EN */ + (0 << 30) | /* BLOCK_WRITE_EN */ + 0) + }, + { 24, 32, + /* DP_PIX_WIDTH */ + ((PIX_FORMAT_TRUE_8888 << 0) | /* DP_DST_PIX_WIDTH */ + (PIX_FORMAT_TRUE_8888 << 4) | /* COMPOSITE_PIX_WIDTH */ + (PIX_FORMAT_TRUE_8888 << 8) | /* DP_SRC_PIX_WIDTH */ + (0 << 13) | /* DP_HOST_TRIPLE_EN */ + (0 << 14) | /* DP_PALETTE_TYPE */ + (PIX_FORMAT_TRUE_8888 << 16) | /* DP_HOST_PIX_WIDTH */ + (0 << 20) | /* DP_C14_RGB_INDEX */ + (0 << 24) | /* DP_BYTE_PIX_ORDER */ + (0 << 25) | /* DP_CONVERSION_TEMP */ + (0 << 26) | /* DP_C14_RGB_LOW_NIBBLE */ + (0 << 27) | /* DP_C14_RGB_HIGH_NIBBLE */ + (PIX_FORMAT_TRUE_8888 << 28) | /* DP_SCALE_PIX_WIDTH */ + 0), + /* DP_SET_GUI_ENGINE */ + ((PIX_FORMAT_TRUE_8888 << 3) | + (1 << 6) | /* SET_DP_SRC_PIX_WIDTH */ + (6 << 7) | /* SET_DST_OFFSET */ + (0 << 10) | /* SET_DST_PITCH */ + (0 << 14) | /* SET_DST_PITCH_BY_2 */ + (0 << 15) | /* SET_SRC_OFFPITCH_COPY */ + (0 << 16) | /* SET_SRC_HGTWID1_2 */ + (0 << 20) | /* SET_DRAWING_COMBO */ + (1 << 24) | /* SET_BUS_MASTER_OP */ + (0 << 26) | /* SET_BUS_MASTER_EN */ + (0 << 27) | /* SET_BUS_MASTER_SYNC */ + (0 << 28) | /* DP_HOST_TRIPLE_EN */ + (0 << 29) | /* FAST_FILL_EN */ + (0 << 30) | /* BLOCK_WRITE_EN */ + 0) + }, + { 32, 32, + /* DP_PIX_WIDTH */ + ((PIX_FORMAT_TRUE_8888 << 0) | /* DP_DST_PIX_WIDTH */ + (PIX_FORMAT_TRUE_8888 << 4) | /* COMPOSITE_PIX_WIDTH */ + (PIX_FORMAT_TRUE_8888 << 8) | /* DP_SRC_PIX_WIDTH */ + (0 << 13) | /* DP_HOST_TRIPLE_EN */ + (0 << 14) | /* DP_PALETTE_TYPE */ + (PIX_FORMAT_TRUE_8888 << 16) | /* DP_HOST_PIX_WIDTH */ + (0 << 20) | /* DP_C14_RGB_INDEX */ + (0 << 24) | /* DP_BYTE_PIX_ORDER */ + (0 << 25) | /* DP_CONVERSION_TEMP */ + (0 << 26) | /* DP_C14_RGB_LOW_NIBBLE */ + (0 << 27) | /* DP_C14_RGB_HIGH_NIBBLE */ + (PIX_FORMAT_TRUE_8888 << 28) | /* DP_SCALE_PIX_WIDTH */ + 0), + /* DP_SET_GUI_ENGINE */ + ((PIX_FORMAT_TRUE_8888 << 3) | + (1 << 6) | /* SET_DP_SRC_PIX_WIDTH */ + (6 << 7) | /* SET_DST_OFFSET */ + (0 << 10) | /* SET_DST_PITCH */ + (0 << 14) | /* SET_DST_PITCH_BY_2 */ + (0 << 15) | /* SET_SRC_OFFPITCH_COPY */ + (0 << 16) | /* SET_SRC_HGTWID1_2 */ + (0 << 20) | /* SET_DRAWING_COMBO */ + (1 << 24) | /* SET_BUS_MASTER_OP */ + (0 << 26) | /* SET_BUS_MASTER_EN */ + (0 << 27) | /* SET_BUS_MASTER_SYNC */ + (0 << 28) | /* DP_HOST_TRIPLE_EN */ + (0 << 29) | /* FAST_FILL_EN */ + (0 << 30) | /* BLOCK_WRITE_EN */ + 0) + } +}; + +#define NACCELREG (sizeof mach64AccelReg / sizeof mach64AccelReg[0]) + +static void +mach64WaitMarker (ScreenPtr pScreen, int marker) +{ + KdScreenPriv(pScreen); + mach64CardInfo(pScreenPriv); + reg = mach64c->reg; + + mach64WaitIdle (reg); +} + +static Bool +mach64Setup (PixmapPtr pDst, PixmapPtr pSrc, CARD32 combo, int wait) +{ + ScreenPtr pScreen = pDst->drawable.pScreen; + KdScreenPriv(pScreen); + mach64CardInfo(pScreenPriv); + CARD32 DST_PITCH; + CARD32 DST_OFFSET; + CARD32 SRC_PITCH; + CARD32 SRC_OFFSET; + CARD32 DP_PIX_WIDTH; + CARD32 DP_SET_GUI_ENGINE; + int i; + + for (i = 0; i < NACCELREG; i++) + if (mach64AccelReg[i].depth == pDst->drawable.depth && + mach64AccelReg[i].bitsPerPixel == pDst->drawable.bitsPerPixel) + break; + if (i == NACCELREG) + return FALSE; + DP_PIX_WIDTH = mach64AccelReg[i].DP_PIX_WIDTH; + DP_SET_GUI_ENGINE = mach64AccelReg[i].DP_SET_GUI_ENGINE; + + reg = mach64c->reg; + if (!reg) + return FALSE; + + triple = (pDst->drawable.bitsPerPixel == 24); + + if (triple) + { + /* bytes / 8 = bytes >> 3 */ + DST_PITCH = pDst->devKind >> 3; + } + else + { + /* pixels / 8 = ((bytes * 8) / bpp) / 8 = bytes / bpp */ + DST_PITCH = pDst->devKind / pDst->drawable.bitsPerPixel; + } + + /* bytes / 8 */ + DST_OFFSET = ((CARD8 *) pDst->devPrivate.ptr - pScreenPriv->screen->memory_base) >> 3; + + mach64WaitAvail(reg, wait + (pSrc ? 5 : 4)); + reg->DP_SET_GUI_ENGINE = DP_SET_GUI_ENGINE | (combo << 20); + reg->DP_PIX_WIDTH = DP_PIX_WIDTH; + reg->DST_OFF_PITCH = ((DST_OFFSET << 0) | /* USR1_DST_OFFSET */ + (DST_PITCH << 22) | /* USR1_DST_PITCH */ + 0); + if (pSrc) + { + if (triple) + { + SRC_PITCH = pSrc->devKind >> 3; + } + else + { + /* pixels / 8 = ((bytes * 8) / bpp) / 8 = bytes / bpp */ + SRC_PITCH = pSrc->devKind / pSrc->drawable.bitsPerPixel; + } + /* bytes / 8 */ + SRC_OFFSET = ((CARD8 *) pSrc->devPrivate.ptr - pScreenPriv->screen->memory_base) >> 3; + + reg->SRC_OFF_PITCH = ((SRC_OFFSET << 0) | + (SRC_PITCH << 22) | + 0); + } + return TRUE; +} + +static Bool +mach64PrepareSolid (PixmapPtr pPixmap, + int alu, + Pixel pm, + Pixel fg) +{ + if (!mach64Setup (pPixmap, 0, 1, 3)) + return FALSE; + reg->DP_MIX = (mach64Rop[alu] << 16) | 0; + reg->DP_WRITE_MSK = pm; + reg->DP_FRGD_CLR = fg; + return TRUE; +} + +static void +mach64Solid (int x1, int y1, int x2, int y2) +{ + if (triple) + { + CARD32 traj; + + x1 *= 3; + x2 *= 3; + + traj = (DST_X_DIR | + DST_Y_DIR | + DST_24_ROT_EN | + DST_24_ROT((x1 / 4) % 6)); + mach64WaitAvail (reg, 1); + reg->GUI_TRAJ_CNTL = traj; + } + mach64WaitAvail(reg,2); + reg->DST_X_Y = MACH64_XY(x1,y1); + reg->DST_WIDTH_HEIGHT = MACH64_XY(x2-x1,y2-y1); +} + +static void +mach64DoneSolid (void) +{ +#if SYNC_ALWAYS + mach64WaitIdle (reg); +#endif +} + +static int copyDx; +static int copyDy; +static CARD32 copyCombo; + +static Bool +mach64PrepareCopy (PixmapPtr pSrcPixmap, + PixmapPtr pDstPixmap, + int dx, + int dy, + int alu, + Pixel pm) +{ + copyCombo = 8 | 2 | 1; + copyDx = dx; + copyDy = dy; + + /* + * Avoid going backwards when copying pixmaps to the screen. + * This should reduce tearing somewhat + */ + if (pSrcPixmap == pDstPixmap) + { + if (dx <= 0) + copyCombo &= ~1; + if (dy <= 0) + copyCombo &= ~2; + } + + if (!mach64Setup (pDstPixmap, pSrcPixmap, copyCombo, 2)) + return FALSE; + + reg->DP_MIX = (mach64Rop[alu] << 16) | 0; + reg->DP_WRITE_MSK = pm; + return TRUE; +} + +static void +mach64Copy (int srcX, + int srcY, + int dstX, + int dstY, + int w, + int h) +{ + if (triple) + { + CARD32 traj; + + srcX *= 3; + dstX *= 3; + w *= 3; + + traj = DST_24_ROT_EN | DST_24_ROT((dstX / 4) % 6); + + if (copyCombo & 1) + traj |= 1; + if (copyCombo & 2) + traj |= 2; + + mach64WaitAvail (reg, 1); + reg->GUI_TRAJ_CNTL = traj; + } + if ((copyCombo & 1) == 0) + { + srcX += w - 1; + dstX += w - 1; + } + if ((copyCombo & 2) == 0) + { + srcY += h - 1; + dstY += h - 1; + } + mach64WaitAvail (reg, 4); + reg->SRC_Y_X = MACH64_YX(srcX, srcY); + reg->SRC_WIDTH1 = w; + reg->DST_Y_X = MACH64_YX(dstX, dstY); + reg->DST_HEIGHT_WIDTH = MACH64_YX(w,h); +} + +static void +mach64DoneCopy (void) +{ +#if SYNC_ALWAYS + mach64WaitIdle (reg); +#endif +} + + +Bool +mach64DrawInit (ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + mach64ScreenInfo(pScreenPriv); + + memset(&mach64s->kaa, 0, sizeof(KaaScreenInfoRec)); + mach64s->kaa.waitMarker = mach64WaitMarker; + mach64s->kaa.PrepareSolid = mach64PrepareSolid; + mach64s->kaa.Solid = mach64Solid; + mach64s->kaa.DoneSolid = mach64DoneSolid; + mach64s->kaa.PrepareCopy = mach64PrepareCopy; + mach64s->kaa.Copy = mach64Copy; + mach64s->kaa.DoneCopy = mach64DoneCopy; + mach64s->kaa.offsetAlign = 64; + mach64s->kaa.pitchAlign = 64; + mach64s->kaa.flags = KAA_OFFSCREEN_PIXMAPS; + + if (pScreenPriv->screen->fb[0].depth == 4) + return FALSE; + + if (!kaaDrawInit (pScreen, &mach64s->kaa)) + return FALSE; + + return TRUE; +} + +void +mach64DrawEnable (ScreenPtr pScreen) +{ + kaaMarkSync (pScreen); +} + +void +mach64DrawDisable (ScreenPtr pScreen) +{ +} + +void +mach64DrawFini (ScreenPtr pScreen) +{ + kaaDrawFini (pScreen); +} diff --git a/xorg-server/hw/kdrive/mach64/mach64draw.h b/xorg-server/hw/kdrive/mach64/mach64draw.h new file mode 100644 index 000000000..bac11c2a6 --- /dev/null +++ b/xorg-server/hw/kdrive/mach64/mach64draw.h @@ -0,0 +1,69 @@ +/* + * Copyright © 1999 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _TRIDENTDRAW_H_ +#define _TRIDENTDRAW_H_ + +#define SetupTrident(s) KdScreenPriv(s); \ + tridentCardInfo(pScreenPriv); \ + Cop *cop = tridentc->cop + +#define TridentAlpha (COP_MULTI_ALPHA|COP_ALPHA_WRITE_ENABLE) + +#define _tridentInit(cop,tridentc) { \ + if ((cop)->status == 0xffffffff) tridentSetMMIO(tridentc); \ + (cop)->multi = (tridentc)->cop_depth; \ + (cop)->multi = (tridentc)->cop_stride; \ + (cop)->multi = TridentAlpha; \ +} \ + +#define _tridentSetSolidRect(cop,pix,alu,cmd) {\ + cop->multi = COP_MULTI_PATTERN; \ + cop->multi = COP_MULTI_ROP | tridentRop[alu]; \ + cop->fg = (pix); \ + cmd = COP_OP_BLT | COP_SCL_OPAQUE | COP_OP_ROP | COP_OP_FG; \ +} + +#define _tridentRect(cop,x1,y1,x2,y2,cmd) { \ + (cop)->dst_start_xy = TRI_XY (x1,y1); \ + (cop)->dst_end_xy = TRI_XY(x2,y2); \ + _tridentWaitDone(cop); \ + (cop)->command = (cmd); \ +} + +#define COP_STATUS_BUSY (COP_STATUS_BE_BUSY | \ + COP_STATUS_DPE_BUSY | \ + COP_STATUS_MI_BUSY) + +#define _tridentWaitDone(cop) { \ + int __q__ = 500000; \ + while (__q__-- && (cop)->status & COP_STATUS_BUSY) \ + ; \ + if (!__q__) \ + (cop)->status = 0; \ +} + +#define _tridentWaitIdleEmpty(cop) _tridentWaitDone(cop) + +#define sourceInvarient(alu) (((alu) & 3) == (((alu) >> 2) & 3)) + +#endif diff --git a/xorg-server/hw/kdrive/mach64/mach64stub.c b/xorg-server/hw/kdrive/mach64/mach64stub.c new file mode 100644 index 000000000..5895a3cb7 --- /dev/null +++ b/xorg-server/hw/kdrive/mach64/mach64stub.c @@ -0,0 +1,75 @@ +/* + * Copyright 1999 SuSE, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of SuSE not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. SuSE makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Keith Packard, SuSE, Inc. + */ + +#ifdef HAVE_CONFIG_H +#include <kdrive-config.h> +#endif +#include "mach64.h" +#include <klinux.h> + +void +InitCard (char *name) +{ + KdCardAttr attr; + + if (LinuxFindPci (0x1002, 0x4750, 0, &attr)) + KdCardInfoAdd (&mach64Funcs, &attr, 0); + else if (LinuxFindPci (0x1002, 0x4c42, 0, &attr)) + KdCardInfoAdd (&mach64Funcs, &attr, 0); + else if (LinuxFindPci (0x1002, 0x4c46, 0, &attr)) + KdCardInfoAdd (&mach64Funcs, &attr, 0); + else if (LinuxFindPci (0x1002, 0x4c49, 0, &attr)) + KdCardInfoAdd (&mach64Funcs, &attr, 0); + else if (LinuxFindPci (0x1002, 0x4c4d, 0, &attr)) + KdCardInfoAdd (&mach64Funcs, &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; +} diff --git a/xorg-server/hw/kdrive/mach64/mach64video.c b/xorg-server/hw/kdrive/mach64/mach64video.c new file mode 100644 index 000000000..38fcef7eb --- /dev/null +++ b/xorg-server/hw/kdrive/mach64/mach64video.c @@ -0,0 +1,994 @@ +/* + * Copyright © 2001 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +#ifdef HAVE_CONFIG_H +#include <kdrive-config.h> +#endif +#include "mach64.h" + +#include <X11/extensions/Xv.h> +#include "fourcc.h" + +#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) + +static Atom xvBrightness, xvSaturation, xvColorKey; + +#define IMAGE_MAX_WIDTH 720 +#define IMAGE_MAX_HEIGHT 576 + +static void +mach64StopVideo(KdScreenInfo *screen, pointer data, Bool exit) +{ + ScreenPtr pScreen = screen->pScreen; + KdScreenPriv(pScreen); + KdCardInfo *card = pScreenPriv->card; + Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; + Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver; + Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr; + Reg *reg = mach64c->reg; + MediaReg *media = mach64c->media_reg; + + REGION_EMPTY(screen->pScreen, &pPortPriv->clip); + + if (!media) + return; + + if(pPortPriv->videoOn) + { + mach64WaitIdle (reg); + /* wait for buffer to be displayed */ + while (((media->TRIG_CNTL >> 5) & 1) != pPortPriv->currentBuf) + ; + /* wait for buffer to be finished */ + while (((media->TRIG_CNTL >> 6) & 1) != 0) + ; + mach64WaitAvail (reg, 1); + media->OVERLAY_SCALE_CNTL = 0; + pPortPriv->videoOn = FALSE; + mach64WaitIdle (reg); + } + if (pPortPriv->off_screen) + { + KdOffscreenFree (pScreen, pPortPriv->off_screen); + pPortPriv->off_screen = 0; + } +} + +static int +mach64SetPortAttribute(KdScreenInfo *screen, + Atom attribute, + int value, + pointer data) +{ + Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; + Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr; + + if(attribute == xvBrightness) + { + if(value < -1000) + value = -1000; + if (value > 1000) + value = 1000; + pPortPriv->brightness = value; + } + else if(attribute == xvSaturation) + { + if (value < -1000) + value = -1000; + if (value > 1000) + value = 1000; + pPortPriv->saturation = value; + } + else if(attribute == xvColorKey) + { + if (pPortPriv->colorKey != value) + { + pPortPriv->colorKey = value; + REGION_EMPTY(screen->pScreen, &pPortPriv->clip); + } + } + else + return BadMatch; + + return Success; +} + +static int +mach64GetPortAttribute(KdScreenInfo *screen, + Atom attribute, + int *value, + pointer data) +{ + Mach64PortPrivPtr pPortPriv = (Mach64PortPrivPtr)data; + + if(attribute == xvBrightness) + *value = pPortPriv->brightness; + else if(attribute == xvSaturation) + *value = pPortPriv->saturation; + else if(attribute == xvColorKey) + *value = pPortPriv->colorKey; + else + return BadMatch; + + return Success; +} + +static void +mach64QueryBestSize(KdScreenInfo *screen, + Bool motion, + short vid_w, + short vid_h, + short drw_w, + short drw_h, + unsigned int *p_w, + unsigned int *p_h, + pointer data) +{ + *p_w = drw_w; + *p_h = drw_h; +} + + +static void +mach64CopyPackedData(KdScreenInfo *screen, + unsigned char *buf, + int randr, + int srcPitch, + int dstPitch, + int srcW, + int srcH, + int top, + int left, + int h, + int w) +{ + Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; + Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr; + CARD8 *src = buf, *dst; + int srcDown = srcPitch, srcRight = 2, srcNext; + int p; + + switch (randr & RR_Rotate_All) { + case RR_Rotate_0: + src = buf; + srcDown = srcPitch; + srcRight = 2; + break; + case RR_Rotate_90: + src = buf + (srcH - 1) * 2; + srcDown = -2; + srcRight = srcPitch; + break; + case RR_Rotate_180: + src = buf + srcPitch * (srcH - 1) + (srcW - 1) * 2; + srcDown = -srcPitch; + srcRight = -2; + break; + case RR_Rotate_270: + src = buf + srcPitch * (srcW - 1); + srcDown = 2; + srcRight = -srcPitch; + break; + } + + src = src + top*srcDown + left*srcRight; + + if (pPortPriv->currentBuf == 0) + dst = (CARD8 *) mach64s->vesa.fb + pPortPriv->YBuf0Offset; + else + dst = (CARD8 *) mach64s->vesa.fb + pPortPriv->YBuf1Offset; + + w >>= 1; + srcRight >>= 1; + srcNext = srcRight >> 1; + while(h--) + { + CARD16 *s = (CARD16 *) src; + CARD32 *d = (CARD32 *) dst; + p = w; + while (p--) + { + *d++ = s[0] | (s[srcNext] << 16); + s += srcRight; + } + src += srcPitch; + dst += dstPitch; + } +} + +static void +mach64CopyPlanarData(KdScreenInfo *screen, + unsigned char *buf, + int randr, + int srcPitch, + int srcPitch2, + int dstPitch, /* of chroma */ + int srcW, + int srcH, + int height, + int top, + int left, + int h, + int w, + int id) +{ + Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; + Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr; + int i, j; + CARD8 *src1, *src2, *src3, *dst1; + int srcDown = srcPitch, srcDown2 = srcPitch2; + int srcRight = 2, srcRight2 = 1, srcNext = 1; + + /* compute source data pointers */ + src1 = buf; + src2 = src1 + height * srcPitch; + src3 = src2 + (height >> 1) * srcPitch2; + switch (randr & RR_Rotate_All) { + case RR_Rotate_0: + srcDown = srcPitch; + srcDown2 = srcPitch2; + srcRight = 2; + srcRight2 = 1; + srcNext = 1; + break; + case RR_Rotate_90: + src1 = src1 + srcH - 1; + src2 = src2 + (srcH >> 1) - 1; + src3 = src3 + (srcH >> 1) - 1; + srcDown = -1; + srcDown2 = -1; + srcRight = srcPitch * 2; + srcRight2 = srcPitch2; + srcNext = srcPitch; + break; + case RR_Rotate_180: + src1 = src1 + srcPitch * (srcH - 1) + (srcW - 1); + src2 = src2 + srcPitch2 * ((srcH >> 1) - 1) + ((srcW >> 1) - 1); + src3 = src3 + srcPitch2 * ((srcH >> 1) - 1) + ((srcW >> 1) - 1); + srcDown = -srcPitch; + srcDown2 = -srcPitch2; + srcRight = -2; + srcRight2 = -1; + srcNext = -1; + break; + case RR_Rotate_270: + src1 = src1 + srcPitch * (srcW - 1); + src2 = src2 + srcPitch2 * ((srcW >> 1) - 1); + src3 = src3 + srcPitch2 * ((srcW >> 1) - 1); + srcDown = 1; + srcDown2 = 1; + srcRight = -srcPitch * 2; + srcRight2 = -srcPitch2; + srcNext = -srcPitch; + break; + } + + /* adjust for origin */ + src1 += top * srcDown + left * srcNext; + src2 += (top >> 1) * srcDown2 + (left >> 1) * srcRight2; + src3 += (top >> 1) * srcDown2 + (left >> 1) * srcRight2; + + if (id == FOURCC_I420) + { + CARD8 *srct = src2; + src2 = src3; + src3 = srct; + } + + if (pPortPriv->currentBuf == 0) + dst1 = (CARD8 *) mach64s->vesa.fb + pPortPriv->YBuf0Offset; + else + dst1 = (CARD8 *) mach64s->vesa.fb + pPortPriv->YBuf1Offset; + + w >>= 1; + for (j = 0; j < h; j++) + { + CARD32 *dst = (CARD32 *) dst1; + CARD8 *s1l = src1; + CARD8 *s1r = src1 + srcNext; + CARD8 *s2 = src2; + CARD8 *s3 = src3; + + for (i = 0; i < w; i++) + { + *dst++ = *s1l | (*s1r << 16) | (*s3 << 8) | (*s2 << 24); + s1l += srcRight; + s1r += srcRight; + s2 += srcRight2; + s3 += srcRight2; + } + src1 += srcDown; + dst1 += dstPitch; + if (j & 1) + { + src2 += srcDown2; + src3 += srcDown2; + } + } +} + + +/* Mach64ClipVideo - + + Takes the dst box in standard X BoxRec form (top and left + edges inclusive, bottom and right exclusive). The new dst + box is returned. The source boundaries are given (x1, y1 + inclusive, x2, y2 exclusive) and returned are the new source + boundaries in 16.16 fixed point. +*/ + +static void +Mach64ClipVideo(BoxPtr dst, + INT32 *x1, + INT32 *x2, + INT32 *y1, + INT32 *y2, + BoxPtr extents, /* extents of the clip region */ + INT32 width, + INT32 height) +{ + INT32 vscale, hscale, delta; + int diff; + + hscale = ((*x2 - *x1) << 16) / (dst->x2 - dst->x1); + vscale = ((*y2 - *y1) << 16) / (dst->y2 - dst->y1); + + *x1 <<= 16; *x2 <<= 16; + *y1 <<= 16; *y2 <<= 16; + + diff = extents->x1 - dst->x1; + if(diff > 0) { + dst->x1 = extents->x1; + *x1 += diff * hscale; + } + diff = dst->x2 - extents->x2; + if(diff > 0) { + dst->x2 = extents->x2; + *x2 -= diff * hscale; + } + diff = extents->y1 - dst->y1; + if(diff > 0) { + dst->y1 = extents->y1; + *y1 += diff * vscale; + } + diff = dst->y2 - extents->y2; + if(diff > 0) { + dst->y2 = extents->y2; + *y2 -= diff * vscale; + } + + if(*x1 < 0) { + diff = (- *x1 + hscale - 1)/ hscale; + dst->x1 += diff; + *x1 += diff * hscale; + } + delta = *x2 - (width << 16); + if(delta > 0) { + diff = (delta + hscale - 1)/ hscale; + dst->x2 -= diff; + *x2 -= diff * hscale; + } + if(*y1 < 0) { + diff = (- *y1 + vscale - 1)/ vscale; + dst->y1 += diff; + *y1 += diff * vscale; + } + delta = *y2 - (height << 16); + if(delta > 0) { + diff = (delta + vscale - 1)/ vscale; + dst->y2 -= diff; + *y2 -= diff * vscale; + } +} + +static void +mach64DisplayVideo(KdScreenInfo *screen, + int id, + int dstPitch, /* of chroma for 4:2:0 */ + int x1, + int y1, + int x2, + int y2, + int dst_x1, + int dst_y1, + int dst_x2, + int dst_y2, + short src_w, + short src_h, + short drw_w, + short drw_h) +{ + ScreenPtr pScreen = screen->pScreen; + KdScreenPriv(pScreen); + KdCardInfo *card = pScreenPriv->card; + Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; + Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver; + Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr; + Reg *reg = mach64c->reg; + MediaReg *media = mach64c->media_reg; + int HORZ_INC, VERT_INC; + CARD32 SCALER_IN; + int bright; + int sat; + + if (id == FOURCC_UYVY) + SCALER_IN = SCALER_IN_YVYU422; + else + SCALER_IN = SCALER_IN_VYUY422; + + mach64WaitAvail (reg, 4); + + media->VIDEO_FORMAT = SCALER_IN | VIDEO_IN_VYUY422; + + /* color key */ + media->OVERLAY_GRAPHICS_KEY_MSK = (1 << screen->fb[0].depth) - 1; + media->OVERLAY_GRAPHICS_KEY_CLR = pPortPriv->colorKey; + /* set key control to obey only graphics color key */ + media->OVERLAY_KEY_CNTL = 0x50; + + mach64WaitAvail (reg, 9); + media->CAPTURE_DEBUG = 0; + /* no exclusive video region */ + media->OVERLAY_EXCLUSIVE_HORZ = 0; + media->OVERLAY_EXCLUSIVE_VERT = 0; + /* scaling coefficients */ + media->SCALER_H_COEFF0 = 0x00002000; + media->SCALER_H_COEFF1 = 0x0D06200D; + media->SCALER_H_COEFF2 = 0x0D0A1C0D; + media->SCALER_H_COEFF3 = 0x0C0E1A0C; + media->SCALER_H_COEFF4 = 0x0C14140C; + media->SCALER_TEST = 0; + + mach64WaitAvail (reg, 2); + media->OVERLAY_SCALE_CNTL = (SCALE_PIX_EXPAND | + SCALE_GAMMA_BRIGHT | + SCALE_BANDWIDTH | + SCALE_OVERLAY_EN | + SCALE_EN); + + bright = (pPortPriv->brightness * 64 / 1000); + if (bright < -0x40) + bright = -0x40; + if (bright > 0x3f) + bright = 0x3f; + bright = bright & 0x7f; + sat = ((pPortPriv->saturation * 31 + 31000) / 2000); + if (sat > 0x1f) + sat = 0x1f; + if (sat < 0) + sat = 0; + + media->SCALER_COLOUR_CNTL = ((bright << 0) | /* BRIGHTNESS */ + (sat << 8) | /* SATURATION_U */ + (sat << 16) | /* SATURATION_V */ + (0 << 21) | /* SCALER_VERT_ADJ_UV */ + (0 << 28)); /* SCALER_HORZ_ADJ_UV */ + + VERT_INC = (src_h << 12) / drw_h; + HORZ_INC = (src_w << 12) / drw_w; + + mach64WaitAvail (reg, 13); + + /* lock registers to prevent non-atomic update */ + media->OVERLAY_Y_X_START = 0x80000000 | MACH64_YX (dst_x1, dst_y1); + /* ending screen coordinate */ + media->OVERLAY_Y_X_END = 0x80000000 | MACH64_YX (dst_x2, dst_y2); + + media->OVERLAY_SCALE_INC = MACH64_YX(HORZ_INC, VERT_INC); + + media->SCALER_BUF0_OFFSET = pPortPriv->YBuf0Offset; + media->SCALER_BUF1_OFFSET = pPortPriv->YBuf1Offset; + + media->SCALER_BUF0_OFFSET_U = pPortPriv->YBuf0Offset; + media->SCALER_BUF1_OFFSET_U = pPortPriv->YBuf1Offset; + + media->SCALER_BUF0_OFFSET_V = pPortPriv->YBuf0Offset; + media->SCALER_BUF1_OFFSET_V = pPortPriv->YBuf1Offset; + + media->SCALER_BUF_PITCH = dstPitch >> 1; + media->SCALER_HEIGHT_WIDTH = MACH64_YX(src_w - (x1 >> 16), src_h - (y1 >> 16)); + + media->CAPTURE_CONFIG = pPortPriv->currentBuf << 28; + + /* set XY location and unlock */ + media->OVERLAY_Y_X_START = MACH64_YX (dst_x1, dst_y1); +} + +static void +mach64VideoSave (ScreenPtr pScreen, KdOffscreenArea *area) +{ + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; + Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr; + + if (pPortPriv->off_screen == area) + pPortPriv->off_screen = 0; +} + +static int +mach64PutImage(KdScreenInfo *screen, + DrawablePtr pDraw, + short src_x, + short src_y, + short drw_x, + short drw_y, + short src_w, + short src_h, + short drw_w, + short drw_h, + int id, + unsigned char *buf, + short width, + short height, + Bool sync, + RegionPtr clipBoxes, + pointer data) +{ + KdCardInfo *card = screen->card; + Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; + Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver; + Mach64PortPrivPtr pPortPriv = (Mach64PortPrivPtr)data; + MediaReg *media = mach64c->media_reg; + INT32 x1, x2, y1, y2; + int randr = mach64s->vesa.randr; + int srcPitch, srcPitch2, dstPitch; + int top, left, npixels, nlines, size; + BoxRec dstBox; + int dst_width = width, dst_height = height; + int rot_x1, rot_y1, rot_x2, rot_y2; + int dst_x1, dst_y1, dst_x2, dst_y2; + int rot_src_w, rot_src_h, rot_drw_w, rot_drw_h; + + /* Clip */ + x1 = src_x; + x2 = src_x + src_w; + y1 = src_y; + y2 = src_y + src_h; + + dstBox.x1 = drw_x; + dstBox.x2 = drw_x + drw_w; + dstBox.y1 = drw_y; + dstBox.y2 = drw_y + drw_h; + + Mach64ClipVideo(&dstBox, &x1, &x2, &y1, &y2, + REGION_EXTENTS(pScreen, clipBoxes), width, height); + + if((x1 >= x2) || (y1 >= y2)) + return Success; + + if (!media) + return BadAlloc; + + if (randr & (RR_Rotate_0|RR_Rotate_180)) + { + dst_width = width; + dst_height = height; + rot_src_w = src_w; + rot_src_h = src_h; + rot_drw_w = drw_w; + rot_drw_h = drw_h; + } + else + { + dst_width = height; + dst_height = width; + rot_src_w = src_h; + rot_src_h = src_w; + rot_drw_w = drw_h; + rot_drw_h = drw_w; + } + + switch (randr & RR_Rotate_All) { + case RR_Rotate_0: + default: + dst_x1 = dstBox.x1; + dst_y1 = dstBox.y1; + dst_x2 = dstBox.x2; + dst_y2 = dstBox.y2; + rot_x1 = x1; + rot_y1 = y1; + rot_x2 = x2; + rot_y2 = y2; + break; + case RR_Rotate_90: + dst_x1 = dstBox.y1; + dst_y1 = screen->height - dstBox.x2; + dst_x2 = dstBox.y2; + dst_y2 = screen->height - dstBox.x1; + + rot_x1 = y1; + rot_y1 = (src_w << 16) - x2; + rot_x2 = y2; + rot_y2 = (src_w << 16) - x1; + break; + case RR_Rotate_180: + dst_x1 = screen->width - dstBox.x2; + dst_y1 = screen->height - dstBox.y2; + dst_x2 = screen->width - dstBox.x1; + dst_y2 = screen->height - dstBox.y1; + rot_x1 = (src_w << 16) - x2; + rot_y1 = (src_h << 16) - y2; + rot_x2 = (src_w << 16) - x1; + rot_y2 = (src_h << 16) - y1; + break; + case RR_Rotate_270: + dst_x1 = screen->width - dstBox.y2; + dst_y1 = dstBox.x1; + dst_x2 = screen->width - dstBox.y1; + dst_y2 = dstBox.x2; + rot_x1 = (src_h << 16) - y2; + rot_y1 = x1; + rot_x2 = (src_h << 16) - y1; + rot_y2 = x2; + break; + } + + switch(id) { + case FOURCC_YV12: + case FOURCC_I420: + dstPitch = ((dst_width << 1) + 15) & ~15; + srcPitch = (width + 3) & ~3; + srcPitch2 = ((width >> 1) + 3) & ~3; + size = dstPitch * (int) dst_height; + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + dstPitch = ((dst_width << 1) + 15) & ~15; + srcPitch = (width << 1); + srcPitch2 = 0; + size = dstPitch * (int) dst_height; + break; + } + + if (pPortPriv->off_screen && size != pPortPriv->size) + { + KdOffscreenFree (screen->pScreen, pPortPriv->off_screen); + pPortPriv->off_screen = 0; + } + + if (!pPortPriv->off_screen) + { + pPortPriv->off_screen = KdOffscreenAlloc (screen->pScreen, size * 2, 64, + TRUE, mach64VideoSave, + pPortPriv); + if (!pPortPriv->off_screen) + return BadAlloc; + } + + pPortPriv->offset = pPortPriv->off_screen->offset; + pPortPriv->size = size; + /* fixup pointers */ + + pPortPriv->YBuf0Offset = pPortPriv->offset; + pPortPriv->YBuf1Offset = pPortPriv->offset + size; + +#if 0 + mach64WaitIdle (reg); + + if (pPortPriv->videoOn) + { + /* wait for buffer to be displayed */ + while (((media->TRIG_CNTL >> 5) & 1) != pPortPriv->currentBuf) + ; + } +#endif + /* + * Use the other buffer + */ + pPortPriv->currentBuf = 1 - pPortPriv->currentBuf; + + /* copy data */ + top = rot_y1 >> 16; + left = (rot_x1 >> 16) & ~1; + npixels = ((((rot_x2 + 0xffff) >> 16) + 1) & ~1) - left; + + switch(id) { + case FOURCC_YV12: + case FOURCC_I420: + top &= ~1; + nlines = ((((rot_y2 + 0xffff) >> 16) + 1) & ~1) - top; + mach64CopyPlanarData(screen, buf, randr, + srcPitch, srcPitch2, dstPitch, + rot_src_w, rot_src_h, height, + top, left, nlines, npixels, id); + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + nlines = ((rot_y2 + 0xffff) >> 16) - top; + mach64CopyPackedData(screen, buf, randr, + srcPitch, dstPitch, + rot_src_w, rot_src_h, + top, left, nlines, + npixels); + break; + } + + mach64DisplayVideo(screen, id, dstPitch, + rot_x1, rot_y1, rot_x2, rot_y2, + dst_x1, dst_y1, + dst_x2, dst_y2, + rot_src_w, rot_src_h, rot_drw_w, rot_drw_h); + + /* update cliplist */ + if (!REGION_EQUAL (screen->pScreen, &pPortPriv->clip, clipBoxes)) + { + REGION_COPY (screen->pScreen, &pPortPriv->clip, clipBoxes); + KXVPaintRegion (pDraw, &pPortPriv->clip, pPortPriv->colorKey); + } + + pPortPriv->videoOn = TRUE; + + return Success; +} + +static int +mach64QueryImageAttributes(KdScreenInfo *screen, + int id, + unsigned short *w, + unsigned short *h, + int *pitches, + int *offsets) +{ + int size, tmp; + + if(*w > IMAGE_MAX_WIDTH) + *w = IMAGE_MAX_WIDTH; + if(*h > IMAGE_MAX_HEIGHT) + *h = IMAGE_MAX_HEIGHT; + + *w = (*w + 1) & ~1; + if(offsets) offsets[0] = 0; + + switch(id) { + case FOURCC_YV12: + case FOURCC_I420: + *h = (*h + 1) & ~1; + size = (*w + 3) & ~3; + if(pitches) + pitches[0] = size; + size *= *h; + if(offsets) + offsets[1] = size; + tmp = ((*w >> 1) + 3) & ~3; + if(pitches) + pitches[1] = pitches[2] = tmp; + tmp *= (*h >> 1); + size += tmp; + if(offsets) + offsets[2] = size; + size += tmp; + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + size = *w << 1; + if(pitches) + pitches[0] = size; + size *= *h; + break; + } + + return size; +} + + +/* client libraries expect an encoding */ +static KdVideoEncodingRec DummyEncoding[1] = +{ + { + 0, + "XV_IMAGE", + IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT, + {1, 1} + } +}; + +#define NUM_FORMATS 3 + +static KdVideoFormatRec Formats[NUM_FORMATS] = +{ + {15, TrueColor}, {16, TrueColor}, {24, TrueColor} +}; + +#define NUM_ATTRIBUTES 3 + +static KdAttributeRec Attributes[NUM_ATTRIBUTES] = +{ + {XvSettable | XvGettable, 0, ~0, "XV_COLORKEY"}, + {XvSettable | XvGettable, -1000, 1000, "XV_BRIGHTNESS"}, + {XvSettable | XvGettable, -1000, 1000, "XV_SATURATION"} +}; + +#define NUM_IMAGES 4 + +static KdImageRec Images[NUM_IMAGES] = +{ + XVIMAGE_YUY2, + XVIMAGE_YV12, + XVIMAGE_I420, + XVIMAGE_UYVY +}; + +static void mach64ResetVideo(KdScreenInfo *screen) +{ +} + +static int +mach64ReputImage (KdScreenInfo *screen, + DrawablePtr pDraw, + short drw_x, + short drw_y, + RegionPtr clipBoxes, + pointer data) +{ + Mach64PortPrivPtr pPortPriv = (Mach64PortPrivPtr)data; + BoxPtr pOldExtents = REGION_EXTENTS (screen->pScreen, &pPortPriv->clip); + BoxPtr pNewExtents = REGION_EXTENTS (screen->pScreen, clipBoxes); + + if (pOldExtents->x1 == pNewExtents->x1 && + pOldExtents->x2 == pNewExtents->x2 && + pOldExtents->y1 == pNewExtents->y1 && + pOldExtents->y2 == pNewExtents->y2) + { + /* update cliplist */ + if (!REGION_EQUAL (screen->pScreen, &pPortPriv->clip, clipBoxes)) + { + REGION_COPY (screen->pScreen, &pPortPriv->clip, clipBoxes); + KXVPaintRegion (pDraw, &pPortPriv->clip, pPortPriv->colorKey); + } + return Success; + } + return BadMatch; +} + +static KdVideoAdaptorPtr +mach64SetupImageVideo(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + mach64ScreenInfo(pScreenPriv); + KdScreenInfo *screen = pScreenPriv->screen; + KdVideoAdaptorPtr adapt; + Mach64PortPrivPtr pPortPriv; + + if(!(adapt = xcalloc(1, sizeof(KdVideoAdaptorRec) + + sizeof(Mach64PortPrivRec) + + sizeof(DevUnion)))) + return NULL; + + adapt->type = XvWindowMask | XvInputMask | XvImageMask; + adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; + adapt->name = "Mach64 Video Overlay"; + adapt->nEncodings = 1; + adapt->pEncodings = DummyEncoding; + adapt->nFormats = NUM_FORMATS; + adapt->pFormats = Formats; + adapt->nPorts = 1; + adapt->pPortPrivates = (DevUnion*)(&adapt[1]); + + pPortPriv = (Mach64PortPrivPtr)(&adapt->pPortPrivates[1]); + + adapt->pPortPrivates[0].ptr = (pointer)(pPortPriv); + adapt->pAttributes = Attributes; + adapt->nImages = NUM_IMAGES; + adapt->nAttributes = NUM_ATTRIBUTES; + adapt->pImages = Images; + adapt->PutVideo = NULL; + adapt->PutStill = NULL; + adapt->GetVideo = NULL; + adapt->GetStill = NULL; + adapt->StopVideo = mach64StopVideo; + adapt->SetPortAttribute = mach64SetPortAttribute; + adapt->GetPortAttribute = mach64GetPortAttribute; + adapt->QueryBestSize = mach64QueryBestSize; + adapt->PutImage = mach64PutImage; + adapt->ReputImage = mach64ReputImage; + adapt->QueryImageAttributes = mach64QueryImageAttributes; + + pPortPriv->colorKey = mach64s->colorKey; + pPortPriv->videoOn = FALSE; + pPortPriv->brightness = 0; + pPortPriv->saturation = 0; + pPortPriv->currentBuf = 0; + pPortPriv->off_screen = 0; + pPortPriv->size = 0; + pPortPriv->offset = 0; + + /* gotta uninit this someplace */ + REGION_INIT(pScreen, &pPortPriv->clip, NullBox, 0); + + mach64s->pAdaptor = adapt; + + xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); + xvSaturation = MAKE_ATOM("XV_SATURATION"); + xvColorKey = MAKE_ATOM("XV_COLORKEY"); + + mach64ResetVideo(screen); + + return adapt; +} + +Bool mach64InitVideo(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + KdVideoAdaptorPtr *adaptors, *newAdaptors = NULL; + KdVideoAdaptorPtr newAdaptor = NULL; + int num_adaptors; + KdCardInfo *card = pScreenPriv->card; + Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver; + Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; + + mach64s->pAdaptor = NULL; + + if (!mach64c->media_reg) + return FALSE; + + newAdaptor = mach64SetupImageVideo(pScreen); + + num_adaptors = KdXVListGenericAdaptors(screen, &adaptors); + + if(newAdaptor) + { + if(!num_adaptors) + { + num_adaptors = 1; + adaptors = &newAdaptor; + } + else + { + newAdaptors = xalloc((num_adaptors + 1) * + sizeof(KdVideoAdaptorPtr*)); + if(newAdaptors) + { + memcpy(newAdaptors, adaptors, + num_adaptors * sizeof(KdVideoAdaptorPtr)); + newAdaptors[num_adaptors] = newAdaptor; + adaptors = newAdaptors; + num_adaptors++; + } + } + } + + if(num_adaptors) + KdXVScreenInit(pScreen, adaptors, num_adaptors); + + if(newAdaptors) + xfree(newAdaptors); + return TRUE; +} + +void +mach64FiniVideo (ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + mach64ScreenInfo(pScreenPriv); + KdVideoAdaptorPtr adapt = mach64s->pAdaptor; + + if (adapt) + { + Mach64PortPrivPtr pPortPriv = (Mach64PortPrivPtr)(&adapt->pPortPrivates[1]); + REGION_UNINIT (pScreen, &pPortPriv->clip); + xfree (adapt); + } +} |