From 7fe60435bce6595a9c58a9bfd8244d74b5320e96 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Tue, 15 Jan 2013 08:46:13 +0100 Subject: Import DirectFB141_2k11R3_beta5 --- Source/DirectFB/gfxdrivers/cyber5k/Makefile.am | 41 + Source/DirectFB/gfxdrivers/cyber5k/Makefile.in | 607 +++++++++++++++ Source/DirectFB/gfxdrivers/cyber5k/cyber5k.c | 824 +++++++++++++++++++++ Source/DirectFB/gfxdrivers/cyber5k/cyber5k.h | 63 ++ Source/DirectFB/gfxdrivers/cyber5k/cyber5k_alpha.c | 260 +++++++ Source/DirectFB/gfxdrivers/cyber5k/cyber5k_alpha.h | 64 ++ .../DirectFB/gfxdrivers/cyber5k/cyber5k_overlay.c | 376 ++++++++++ .../DirectFB/gfxdrivers/cyber5k/cyber5k_overlay.h | 92 +++ .../DirectFB/gfxdrivers/cyber5k/cyber5k_underlay.c | 301 ++++++++ Source/DirectFB/gfxdrivers/cyber5k/mmio.h | 126 ++++ Source/DirectFB/gfxdrivers/cyber5k/regs.h | 387 ++++++++++ 11 files changed, 3141 insertions(+) create mode 100755 Source/DirectFB/gfxdrivers/cyber5k/Makefile.am create mode 100755 Source/DirectFB/gfxdrivers/cyber5k/Makefile.in create mode 100755 Source/DirectFB/gfxdrivers/cyber5k/cyber5k.c create mode 100755 Source/DirectFB/gfxdrivers/cyber5k/cyber5k.h create mode 100755 Source/DirectFB/gfxdrivers/cyber5k/cyber5k_alpha.c create mode 100755 Source/DirectFB/gfxdrivers/cyber5k/cyber5k_alpha.h create mode 100755 Source/DirectFB/gfxdrivers/cyber5k/cyber5k_overlay.c create mode 100755 Source/DirectFB/gfxdrivers/cyber5k/cyber5k_overlay.h create mode 100755 Source/DirectFB/gfxdrivers/cyber5k/cyber5k_underlay.c create mode 100755 Source/DirectFB/gfxdrivers/cyber5k/mmio.h create mode 100755 Source/DirectFB/gfxdrivers/cyber5k/regs.h (limited to 'Source/DirectFB/gfxdrivers/cyber5k') diff --git a/Source/DirectFB/gfxdrivers/cyber5k/Makefile.am b/Source/DirectFB/gfxdrivers/cyber5k/Makefile.am new file mode 100755 index 0000000..6112a8d --- /dev/null +++ b/Source/DirectFB/gfxdrivers/cyber5k/Makefile.am @@ -0,0 +1,41 @@ +## Makefile.am for DirectFB/gfxdrivers/cyber5k + +INCLUDES = \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/lib \ + -I$(top_srcdir)/lib \ + -I$(top_srcdir)/systems \ + -I$(top_srcdir)/src + +cyber5k_LTLIBRARIES = libdirectfb_cyber5k.la + +if BUILD_STATIC +cyber5k_DATA = $(cyber5k_LTLIBRARIES:.la=.o) +endif + +cyber5kdir = $(MODULEDIR)/gfxdrivers + +libdirectfb_cyber5k_la_SOURCES = \ + cyber5k.c \ + cyber5k.h \ + cyber5k_overlay.h \ + cyber5k_overlay.c \ + cyber5k_underlay.c \ + cyber5k_alpha.c \ + cyber5k_alpha.h \ + regs.h \ + mmio.h + +libdirectfb_cyber5k_la_LDFLAGS = \ + -module \ + -avoid-version \ + $(DFB_LDFLAGS) + +libdirectfb_cyber5k_la_LIBADD = \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/src/libdirectfb.la + + +include $(top_srcdir)/rules/libobject.make + diff --git a/Source/DirectFB/gfxdrivers/cyber5k/Makefile.in b/Source/DirectFB/gfxdrivers/cyber5k/Makefile.in new file mode 100755 index 0000000..9861ceb --- /dev/null +++ b/Source/DirectFB/gfxdrivers/cyber5k/Makefile.in @@ -0,0 +1,607 @@ +# 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@ +target_triplet = @target@ +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/rules/libobject.make +subdir = gfxdrivers/cyber5k +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/as-ac-expand.m4 \ + $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(cyber5kdir)" "$(DESTDIR)$(cyber5kdir)" +cyber5kLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(cyber5k_LTLIBRARIES) +libdirectfb_cyber5k_la_DEPENDENCIES = \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/src/libdirectfb.la +am_libdirectfb_cyber5k_la_OBJECTS = cyber5k.lo cyber5k_overlay.lo \ + cyber5k_underlay.lo cyber5k_alpha.lo +libdirectfb_cyber5k_la_OBJECTS = $(am_libdirectfb_cyber5k_la_OBJECTS) +libdirectfb_cyber5k_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libdirectfb_cyber5k_la_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +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 = $(libdirectfb_cyber5k_la_SOURCES) +DIST_SOURCES = $(libdirectfb_cyber5k_la_SOURCES) +cyber5kDATA_INSTALL = $(INSTALL_DATA) +DATA = $(cyber5k_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +ASFLAGS = @ASFLAGS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIR = @DATADIR@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DFB_CFLAGS_OMIT_FRAME_POINTER = @DFB_CFLAGS_OMIT_FRAME_POINTER@ +DFB_INTERNAL_CFLAGS = @DFB_INTERNAL_CFLAGS@ +DFB_LDFLAGS = @DFB_LDFLAGS@ +DFB_SMOOTH_SCALING = @DFB_SMOOTH_SCALING@ +DIRECTFB_BINARY_AGE = @DIRECTFB_BINARY_AGE@ +DIRECTFB_CSOURCE = @DIRECTFB_CSOURCE@ +DIRECTFB_INTERFACE_AGE = @DIRECTFB_INTERFACE_AGE@ +DIRECTFB_MAJOR_VERSION = @DIRECTFB_MAJOR_VERSION@ +DIRECTFB_MICRO_VERSION = @DIRECTFB_MICRO_VERSION@ +DIRECTFB_MINOR_VERSION = @DIRECTFB_MINOR_VERSION@ +DIRECTFB_VERSION = @DIRECTFB_VERSION@ +DIRECT_BUILD_DEBUG = @DIRECT_BUILD_DEBUG@ +DIRECT_BUILD_DEBUGS = @DIRECT_BUILD_DEBUGS@ +DIRECT_BUILD_GETTID = @DIRECT_BUILD_GETTID@ +DIRECT_BUILD_NETWORK = @DIRECT_BUILD_NETWORK@ +DIRECT_BUILD_STDBOOL = @DIRECT_BUILD_STDBOOL@ +DIRECT_BUILD_TEXT = @DIRECT_BUILD_TEXT@ +DIRECT_BUILD_TRACE = @DIRECT_BUILD_TRACE@ +DSYMUTIL = @DSYMUTIL@ +DYNLIB = @DYNLIB@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ +FREETYPE_LIBS = @FREETYPE_LIBS@ +FREETYPE_PROVIDER = @FREETYPE_PROVIDER@ +FUSION_BUILD_KERNEL = @FUSION_BUILD_KERNEL@ +FUSION_BUILD_MULTI = @FUSION_BUILD_MULTI@ +FUSION_MESSAGE_SIZE = @FUSION_MESSAGE_SIZE@ +GIF_PROVIDER = @GIF_PROVIDER@ +GREP = @GREP@ +HAVE_LINUX = @HAVE_LINUX@ +INCLUDEDIR = @INCLUDEDIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTERNALINCLUDEDIR = @INTERNALINCLUDEDIR@ +JPEG_PROVIDER = @JPEG_PROVIDER@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBJPEG = @LIBJPEG@ +LIBOBJS = @LIBOBJS@ +LIBPNG = @LIBPNG@ +LIBPNG_CONFIG = @LIBPNG_CONFIG@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_AGE = @LT_AGE@ +LT_BINARY = @LT_BINARY@ +LT_CURRENT = @LT_CURRENT@ +LT_RELEASE = @LT_RELEASE@ +LT_REVISION = @LT_REVISION@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MAN2HTML = @MAN2HTML@ +MKDIR_P = @MKDIR_P@ +MODULEDIR = @MODULEDIR@ +MODULEDIRNAME = @MODULEDIRNAME@ +NMEDIT = @NMEDIT@ +OBJEXT = @OBJEXT@ +OSX_LIBS = @OSX_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@ +PERL = @PERL@ +PKG_CONFIG = @PKG_CONFIG@ +PNG_PROVIDER = @PNG_PROVIDER@ +RANLIB = @RANLIB@ +RUNTIME_SYSROOT = @RUNTIME_SYSROOT@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOPATH = @SOPATH@ +STRIP = @STRIP@ +SYSCONFDIR = @SYSCONFDIR@ +SYSFS_LIBS = @SYSFS_LIBS@ +THREADFLAGS = @THREADFLAGS@ +THREADLIB = @THREADLIB@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +VERSION = @VERSION@ +VNC_CFLAGS = @VNC_CFLAGS@ +VNC_CONFIG = @VNC_CONFIG@ +VNC_LIBS = @VNC_LIBS@ +X11_CFLAGS = @X11_CFLAGS@ +X11_LIBS = @X11_LIBS@ +ZLIB_LIBS = @ZLIB_LIBS@ +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@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +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@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +INCLUDES = \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/lib \ + -I$(top_srcdir)/lib \ + -I$(top_srcdir)/systems \ + -I$(top_srcdir)/src + +cyber5k_LTLIBRARIES = libdirectfb_cyber5k.la +@BUILD_STATIC_TRUE@cyber5k_DATA = $(cyber5k_LTLIBRARIES:.la=.o) +cyber5kdir = $(MODULEDIR)/gfxdrivers +libdirectfb_cyber5k_la_SOURCES = \ + cyber5k.c \ + cyber5k.h \ + cyber5k_overlay.h \ + cyber5k_overlay.c \ + cyber5k_underlay.c \ + cyber5k_alpha.c \ + cyber5k_alpha.h \ + regs.h \ + mmio.h + +libdirectfb_cyber5k_la_LDFLAGS = \ + -module \ + -avoid-version \ + $(DFB_LDFLAGS) + +libdirectfb_cyber5k_la_LIBADD = \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/src/libdirectfb.la + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/rules/libobject.make $(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) --gnu gfxdrivers/cyber5k/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu gfxdrivers/cyber5k/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-cyber5kLTLIBRARIES: $(cyber5k_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(cyber5kdir)" || $(MKDIR_P) "$(DESTDIR)$(cyber5kdir)" + @list='$(cyber5k_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(cyber5kLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(cyber5kdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(cyber5kLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(cyber5kdir)/$$f"; \ + else :; fi; \ + done + +uninstall-cyber5kLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(cyber5k_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(cyber5kdir)/$$p'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(cyber5kdir)/$$p"; \ + done + +clean-cyber5kLTLIBRARIES: + -test -z "$(cyber5k_LTLIBRARIES)" || rm -f $(cyber5k_LTLIBRARIES) + @list='$(cyber5k_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libdirectfb_cyber5k.la: $(libdirectfb_cyber5k_la_OBJECTS) $(libdirectfb_cyber5k_la_DEPENDENCIES) + $(libdirectfb_cyber5k_la_LINK) -rpath $(cyber5kdir) $(libdirectfb_cyber5k_la_OBJECTS) $(libdirectfb_cyber5k_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cyber5k.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cyber5k_alpha.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cyber5k_overlay.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cyber5k_underlay.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-cyber5kDATA: $(cyber5k_DATA) + @$(NORMAL_INSTALL) + test -z "$(cyber5kdir)" || $(MKDIR_P) "$(DESTDIR)$(cyber5kdir)" + @list='$(cyber5k_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(cyber5kDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(cyber5kdir)/$$f'"; \ + $(cyber5kDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(cyber5kdir)/$$f"; \ + done + +uninstall-cyber5kDATA: + @$(NORMAL_UNINSTALL) + @list='$(cyber5k_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(cyber5kdir)/$$f'"; \ + rm -f "$(DESTDIR)$(cyber5kdir)/$$f"; \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(cyber5kdir)" "$(DESTDIR)$(cyber5kdir)"; 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-cyber5kLTLIBRARIES clean-generic clean-libtool \ + 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-cyber5kDATA install-cyber5kLTLIBRARIES + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-cyber5kDATA uninstall-cyber5kLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean \ + clean-cyber5kLTLIBRARIES clean-generic clean-libtool ctags \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-cyber5kDATA \ + install-cyber5kLTLIBRARIES 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-cyber5kDATA \ + uninstall-cyber5kLTLIBRARIES + +%.o: .libs/%.a %.la + rm -f $<.tmp/*.o + if test -d $<.tmp; then rmdir $<.tmp; fi + mkdir $<.tmp + (cd $<.tmp && $(AR) x ../../$<) + $(LD) -o $@ -r $<.tmp/*.o + rm -f $<.tmp/*.o && rmdir $<.tmp + +.PHONY: $(LTLIBRARIES:%.la=.libs/%.a) +# 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/Source/DirectFB/gfxdrivers/cyber5k/cyber5k.c b/Source/DirectFB/gfxdrivers/cyber5k/cyber5k.c new file mode 100755 index 0000000..e04ad28 --- /dev/null +++ b/Source/DirectFB/gfxdrivers/cyber5k/cyber5k.c @@ -0,0 +1,824 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include + +#include +#include +#include + +#include + +#include +#include +#include + +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include + +DFB_GRAPHICS_DRIVER( cyber5k ) + +#include "regs.h" +#include "mmio.h" +#include "cyber5k.h" +#include "cyber5k_alpha.h" + + +/* HACK */ +volatile u8 *cyber_mmio = NULL; + + +/* FIXME: support for destination color keying */ + +#define CYBER5K_DRAWING_FLAGS \ + (DSDRAW_NOFX) + +#define CYBER5K_DRAWING_FUNCTIONS \ + (DFXL_DRAWLINE | DFXL_DRAWRECTANGLE | DFXL_FILLRECTANGLE) + +#define CYBER5K_BLITTING_FLAGS \ + (DSBLIT_SRC_COLORKEY) + +#define CYBER5K_BLITTING_FUNCTIONS \ + (DFXL_BLIT) + +static bool cyber5kFillRectangle( void *drv, void *dev, DFBRectangle *rect ); +static bool cyber5kFillRectangle24( void *drv, void *dev, DFBRectangle *rect ); +static bool cyber5kDrawRectangle( void *drv, void *dev, DFBRectangle *rect ); +static bool cyber5kDrawRectangle24( void *drv, void *dev, DFBRectangle *rect ); +static bool cyber5kBlit( void *drv, void *dev, + DFBRectangle *rect, int dx, int dy ); +static bool cyber5kBlit24( void *drv, void *dev, + DFBRectangle *rect, int dx, int dy ); + +static DFBResult cyber5kEngineSync( void *drv, void *dev ) +{ + CyberDriverData *cdrv = (CyberDriverData*) drv; + CyberDeviceData *cdev = (CyberDeviceData*) dev; + + cyber_waitidle( cdrv, cdev ); + + return DFB_OK; +} + +static void cyber5kCheckState( void *drv, void *dev, + CardState *state, DFBAccelerationMask accel ) +{ + /* check destination format first */ + switch (state->destination->config.format) { + case DSPF_RGB16: + case DSPF_RGB24: + case DSPF_RGB32: + case DSPF_ARGB: + break; + default: + return; + } + + if (DFB_DRAWING_FUNCTION( accel )) { + /* if there are no other drawing flags than the supported */ + if (state->drawingflags & ~CYBER5K_DRAWING_FLAGS) + return; + + state->accel |= CYBER5K_DRAWING_FUNCTIONS; + + /* no line drawing in 24bit mode */ + if (state->destination->config.format == DSPF_RGB24) + state->accel &= ~DFXL_DRAWLINE; + } + else { + /* if there are no other blitting flags than the supported + and the source and destination formats are the same */ + if (state->blittingflags & ~CYBER5K_BLITTING_FLAGS) + return; + if (state->source->config.format != state->destination->config.format) + return; + + state->accel |= CYBER5K_BLITTING_FUNCTIONS; + } +} + +static inline void +cyber5k_validate_dst( CyberDriverData *cdrv, CyberDeviceData *cdev, + CardState *state, GraphicsDeviceFuncs *funcs ) +{ + CoreSurface *dest = state->destination; + + if (cdev->v_dst) + return; + + cdev->dst_pixeloffset = state->dst.offset / + DFB_BYTES_PER_PIXEL(dest->config.format); + cdev->dst_pixelpitch = state->dst.pitch / + DFB_BYTES_PER_PIXEL(dest->config.format); + + switch (dest->config.format) { + case DSPF_RGB16: + funcs->FillRectangle = cyber5kFillRectangle; + funcs->DrawRectangle = cyber5kDrawRectangle; + funcs->Blit = cyber5kBlit; + cyber_out16( cdrv->mmio_base, DSTWIDTH, cdev->dst_pixelpitch - 1 ); + cyber_out8( cdrv->mmio_base, COPFMT, 1 ); + break; + case DSPF_RGB24: + funcs->FillRectangle = cyber5kFillRectangle24; + funcs->DrawRectangle = cyber5kDrawRectangle24; + funcs->Blit = cyber5kBlit24; + cyber_out16( cdrv->mmio_base, DSTWIDTH, cdev->dst_pixelpitch*3 -1); + cyber_out8( cdrv->mmio_base, COPFMT, 2 ); + break; + case DSPF_RGB32: + case DSPF_ARGB: + funcs->FillRectangle = cyber5kFillRectangle; + funcs->DrawRectangle = cyber5kDrawRectangle; + funcs->Blit = cyber5kBlit; + cyber_out16( cdrv->mmio_base, DSTWIDTH, cdev->dst_pixelpitch - 1 ); + cyber_out8( cdrv->mmio_base, COPFMT, 3 ); + break; + default: + D_BUG( "unexpected pixelformat!" ); + break; + } + + cdev->v_dst = 1; +} + +static inline void +cyber5k_validate_src( CyberDriverData *cdrv, + CyberDeviceData *cdev, CardState *state ) +{ + CoreSurface *source = state->source; + + if (cdev->v_src) + return; + + cdev->src_pixeloffset = state->src.offset / + DFB_BYTES_PER_PIXEL(source->config.format); + cdev->src_pixelpitch = state->src.pitch / + DFB_BYTES_PER_PIXEL(source->config.format); + + cyber_out16( cdrv->mmio_base, SRC1WIDTH, + state->src.pitch /DFB_BYTES_PER_PIXEL(source->config.format) - 1); + + cdev->v_src = 1; +} + +static inline void +cyber5k_validate_color( CyberDriverData *cdrv, + CyberDeviceData *cdev, CardState *state ) +{ + u32 fill_color = 0; + + if (cdev->v_color) + return; + + switch (state->destination->config.format) { + case DSPF_RGB16: + fill_color = PIXEL_RGB16( state->color.r, + state->color.g, + state->color.b ); + break; + case DSPF_RGB24: + case DSPF_RGB32: + fill_color = PIXEL_RGB32( state->color.r, + state->color.g, + state->color.b ); + break; + case DSPF_ARGB: + fill_color = PIXEL_ARGB( state->color.a, + state->color.r, + state->color.g, + state->color.b ); + break; + default: + D_BUG( "unexpected pixelformat!" ); + break; + } + + cyber_out32( cdrv->mmio_base, FCOLOR, fill_color ); + + cdev->v_src_colorkey = 0; + + cdev->v_color = 1; +} + +static inline void +cyber5k_validate_src_colorkey( CyberDriverData *cdrv, + CyberDeviceData *cdev, CardState *state ) +{ + if (cdev->v_src_colorkey) + return; + + cyber_out32( cdrv->mmio_base, FCOLOR, state->src_colorkey ); + cyber_out32( cdrv->mmio_base, BCOLOR, state->src_colorkey ); + + cdev->v_color = 0; + + cdev->v_src_colorkey = 1; +} + +static inline void +cyber5k_validate_blitting_cmd( CyberDriverData *cdrv, + CyberDeviceData *cdev, CardState *state ) +{ + if (cdev->v_blitting_cmd) + return; + + cdev->blitting_cmd = COP_PXBLT | PAT_FIXFGD | FGD_IS_SRC1; + + if (state->blittingflags & DSBLIT_SRC_COLORKEY) + cdev->blitting_cmd |= TRANS_ENABLE | TRANS_IS_SRC1 | TRANS_INVERT; + + cdev->v_blitting_cmd = 1; +} + +static void cyber5kSetState( void *drv, void *dev, GraphicsDeviceFuncs *funcs, + CardState *state, DFBAccelerationMask accel ) +{ + CyberDriverData *cdrv = (CyberDriverData*) drv; + CyberDeviceData *cdev = (CyberDeviceData*) dev; + + if (state->mod_hw) { + if (state->mod_hw & SMF_DESTINATION) + cdev->v_dst = cdev->v_color = 0; + else if (state->mod_hw & SMF_COLOR) + cdev->v_color = 0; + + if (state->mod_hw & SMF_SOURCE) + cdev->v_src = cdev->v_src_colorkey = 0; + else if (state->mod_hw & SMF_SRC_COLORKEY) + cdev->v_src_colorkey = 0; + + if (state->mod_hw & SMF_BLITTING_FLAGS) + cdev->v_blitting_cmd = 0; + } + + cyber5k_validate_dst( cdrv, cdev, state, funcs ); + + switch (accel) { + case DFXL_DRAWLINE: + case DFXL_DRAWRECTANGLE: + case DFXL_FILLRECTANGLE: + cyber5k_validate_color( cdrv, cdev, state ); + + state->set = CYBER5K_DRAWING_FUNCTIONS; + break; + + case DFXL_BLIT: + cyber5k_validate_src( cdrv, cdev, state ); + cyber5k_validate_blitting_cmd( cdrv, cdev, state ); + + if (state->blittingflags & DSBLIT_SRC_COLORKEY) + cyber5k_validate_src_colorkey( cdrv, cdev, state ); + + state->set = CYBER5K_BLITTING_FUNCTIONS; + break; + + default: + D_BUG( "unexpected drawing/blitting function!" ); + break; + } + + state->mod_hw = 0; +} + +static bool cyber5kFillRectangle( void *drv, void *dev, DFBRectangle *rect ) +{ + CyberDriverData *cdrv = (CyberDriverData*) drv; + CyberDeviceData *cdev = (CyberDeviceData*) dev; + volatile u8 *mmio = cdrv->mmio_base; + + cyber_waitidle( cdrv, cdev ); + + cyber_out32( mmio, DSTPTR, cdev->dst_pixeloffset + + rect->y * cdev->dst_pixelpitch + + rect->x ); + + cyber_out32( mmio, HEIGHTWIDTH, ((rect->h-1) << 16) | (rect->w-1) ); + cyber_out32( mmio, PIXOP, COP_PXBLT | PAT_FIXFGD ); + + return true; +} + +static bool cyber5kFillRectangle24( void *drv, void *dev, DFBRectangle *rect ) +{ + CyberDriverData *cdrv = (CyberDriverData*) drv; + CyberDeviceData *cdev = (CyberDeviceData*) dev; + volatile u8 *mmio = cdrv->mmio_base; + + cyber_waitidle( cdrv, cdev ); + + cyber_out32( mmio, DSTPTR, (cdev->dst_pixeloffset + + rect->y * cdev->dst_pixelpitch + + rect->x) * 3 ); + cyber_out8( mmio, DSTXROT, rect->x & 7 ); + + cyber_out32( mmio, HEIGHTWIDTH, ((rect->h-1) << 16) | (rect->w-1) ); + cyber_out32( mmio, PIXOP, COP_PXBLT | PAT_FIXFGD ); + + return true; +} + +static bool cyber5kDrawRectangle( void *drv, void *dev, DFBRectangle *rect ) +{ + CyberDriverData *cdrv = (CyberDriverData*) drv; + CyberDeviceData *cdev = (CyberDeviceData*) dev; + volatile u8 *mmio = cdrv->mmio_base; + + u32 dst = cdev->dst_pixeloffset + + rect->y * cdev->dst_pixelpitch + rect->x; + + cyber_waitidle( cdrv, cdev ); + cyber_out32( mmio, DSTPTR, dst ); + cyber_out32( mmio, DIMW, 0 ); + cyber_out32( mmio, DIMH, rect->h - 1 ); + cyber_out32( mmio, PIXOP, COP_PXBLT | PAT_FIXFGD ); + + cyber_waitidle( cdrv, cdev ); + cyber_out32( mmio, DSTPTR, dst + rect->w - 1); + cyber_out32( mmio, PIXOP, COP_PXBLT | PAT_FIXFGD ); + + cyber_waitidle( cdrv, cdev ); + cyber_out32( mmio, DSTPTR, dst ); + cyber_out32( mmio, DIMW, rect->w - 1 ); + cyber_out32( mmio, DIMH, 0 ); + cyber_out32( mmio, PIXOP, COP_PXBLT | PAT_FIXFGD ); + + cyber_waitidle( cdrv, cdev ); + cyber_out32( mmio, DSTPTR, dst + cdev->dst_pixelpitch * (rect->h - 1) ); + cyber_out32( mmio, PIXOP, COP_PXBLT | PAT_FIXFGD ); + + return true; +} + +static bool cyber5kDrawRectangle24( void *drv, void *dev, DFBRectangle *rect ) +{ + CyberDriverData *cdrv = (CyberDriverData*) drv; + CyberDeviceData *cdev = (CyberDeviceData*) dev; + volatile u8 *mmio = cdrv->mmio_base; + + u32 dst = cdev->dst_pixeloffset + + (rect->y * cdev->dst_pixelpitch + rect->x) * 3; + + cyber_waitidle( cdrv, cdev ); + cyber_out8( mmio, DSTXROT, rect->x & 7 ); + cyber_out32( mmio, DSTPTR, dst ); + cyber_out32( mmio, DIMW, rect->w - 1 ); + cyber_out32( mmio, DIMH, 0 ); + cyber_out32( mmio, PIXOP, COP_PXBLT | PAT_FIXFGD ); + + cyber_waitidle( cdrv, cdev ); + cyber_out32( mmio, DSTPTR, dst + cdev->dst_pixelpitch * (rect->h-1) * 3 ); + cyber_out32( mmio, PIXOP, COP_PXBLT | PAT_FIXFGD ); + + cyber_waitidle( cdrv, cdev ); + cyber_out32( mmio, DSTPTR, dst ); + cyber_out32( mmio, DIMW, 0 ); + cyber_out32( mmio, DIMH, rect->h - 1 ); + cyber_out32( mmio, PIXOP, COP_PXBLT | PAT_FIXFGD ); + + cyber_waitidle( cdrv, cdev ); + cyber_out8( mmio, DSTXROT, (rect->x + rect->w - 1) & 7 ); + cyber_out32( mmio, DSTPTR, dst + (rect->w-1) * 3 ); + cyber_out32( mmio, PIXOP, COP_PXBLT | PAT_FIXFGD ); + + return true; +} + +static bool cyber5kDrawLine( void *drv, void *dev, DFBRegion *line ) +{ + CyberDriverData *cdrv = (CyberDriverData*) drv; + CyberDeviceData *cdev = (CyberDeviceData*) dev; + volatile u8 *mmio = cdrv->mmio_base; + + u32 cmd = COP_LINE_DRAW | PAT_FIXFGD; + + int dx; + int dy; + + dx = line->x2 - line->x1; + dy = line->y2 - line->y1; + + if (dx < 0) { + dx = -dx; + cmd |= DX_NEG; + } + if (dy < 0) { + dy = -dy; + cmd |= DY_NEG; + } + if (dx < dy) { + int tmp; + cmd |= YMAJOR; + tmp = dx; + dx = dy; + dy = tmp; + } + + cyber_waitidle( cdrv, cdev ); + cyber_out32( mmio, DSTPTR, + cdev->dst_pixeloffset + + line->y1 * cdev->dst_pixelpitch + line->x1); + + cyber_out16( mmio, DIMW , dx); + cyber_out16( mmio, K1 , 2*dy); + cyber_out16( mmio, ERRORTERM, 2*dy-dx); + cyber_out32( mmio, K2 ,2*(dy-dx)); + cyber_out32( mmio, PIXOP , cmd); + + return true; +} + +static bool cyber5kBlit( void *drv, void *dev, DFBRectangle *rect, int dx, int dy ) +{ + CyberDriverData *cdrv = (CyberDriverData*) drv; + CyberDeviceData *cdev = (CyberDeviceData*) dev; + volatile u8 *mmio = cdrv->mmio_base; + + u32 cmd = cdev->blitting_cmd; + + cyber_waitidle( cdrv, cdev ); + + if (rect->x < dx) { + cmd |= DEC_X; + + rect->x += rect->w - 1; + dx += rect->w - 1; + } + + if (rect->y < dy) { + cmd |= DEC_Y; + + rect->y += rect->h - 1; + dy += rect->h - 1; + } + + cyber_out32( mmio, DSTPTR, + cdev->dst_pixeloffset + dy * cdev->dst_pixelpitch + dx ); + cyber_out32( mmio, SRC1PTR, + cdev->src_pixeloffset + + rect->y * cdev->src_pixelpitch + rect->x ); + cyber_out32( mmio, HEIGHTWIDTH, ((rect->h-1) << 16) | (rect->w-1) ); + cyber_out32( mmio, PIXOP , cmd); + + return true; +} + +static bool cyber5kBlit24( void *drv, void *dev, DFBRectangle *rect, int dx, int dy ) +{ + CyberDriverData *cdrv = (CyberDriverData*) drv; + CyberDeviceData *cdev = (CyberDeviceData*) dev; + volatile u8 *mmio = cdrv->mmio_base; + + u32 cmd = cdev->blitting_cmd; + u32 src = 0; + u32 dst = 0; + + cyber_waitidle( cdrv, cdev ); + + if (rect->x < dx) { + cmd |= DEC_X; + + rect->x += rect->w - 1; + dx += rect->w - 1; + + src += 2; + dst += 2; + } + + if (rect->y < dy) { + cmd |= DEC_Y; + + rect->y += rect->h - 1; + dy += rect->h - 1; + } + + src += cdev->src_pixeloffset + rect->y * cdev->dst_pixelpitch + rect->x; + dst += cdev->dst_pixeloffset + dy * cdev->dst_pixelpitch + dx; + + cyber_out32( mmio, DSTPTR , src ); + cyber_out32( mmio, SRC1PTR , dst ); + cyber_out32( mmio, HEIGHTWIDTH, ((rect->h-1) << 16) | (rect->w-1) ); + cyber_out32( mmio, PIXOP , cmd ); + + return true; +} + +/* primary layer hooks */ + +#define OSD_OPTIONS (DLOP_ALPHACHANNEL | DLOP_SRC_COLORKEY | DLOP_OPACITY) + +DisplayLayerFuncs oldPrimaryFuncs; +void *oldPrimaryDriverData; + +static DFBResult +osdInitLayer( CoreLayer *layer, + void *driver_data, + void *layer_data, + DFBDisplayLayerDescription *description, + DFBDisplayLayerConfig *config, + DFBColorAdjustment *adjustment ) +{ + DFBResult ret; + + /* call the original initialization function first */ + ret = oldPrimaryFuncs.InitLayer( layer, + oldPrimaryDriverData, + layer_data, description, + config, adjustment ); + if (ret) + return ret; + + /* set name */ + snprintf(description->name, + DFB_DISPLAY_LAYER_DESC_NAME_LENGTH, "CyberPro OSD"); + + /* add support for options */ + config->flags |= DLCONF_OPTIONS; + + /* add some capabilities */ + description->caps |= DLCAPS_ALPHACHANNEL | + DLCAPS_OPACITY | DLCAPS_SRC_COLORKEY; + + return DFB_OK; +} + +static DFBResult +osdTestRegion( CoreLayer *layer, + void *driver_data, + void *layer_data, + CoreLayerRegionConfig *config, + CoreLayerRegionConfigFlags *failed ) +{ + DFBResult ret; + CoreLayerRegionConfigFlags fail = 0; + DFBDisplayLayerOptions options = config->options; + + /* remove options before calling the original function */ + config->options = DLOP_NONE; + + /* call the original function */ + ret = oldPrimaryFuncs.TestRegion( layer, oldPrimaryDriverData, + layer_data, config, &fail ); + + /* check options if specified */ + if (options) { + /* any unsupported option wanted? */ + if (options & ~OSD_OPTIONS) + fail |= CLRCF_OPTIONS; + + /* opacity and alpha channel cannot be used at once */ + if ((options & (DLOP_OPACITY | DLOP_ALPHACHANNEL)) == + (DLOP_OPACITY | DLOP_ALPHACHANNEL)) + { + fail |= CLRCF_OPTIONS; + } + } + + /* restore options */ + config->options = options; + + if (failed) + *failed = fail; + + if (fail) + return DFB_UNSUPPORTED; + + return ret; +} + +static DFBResult +osdSetRegion( CoreLayer *layer, + void *driver_data, + void *layer_data, + void *region_data, + CoreLayerRegionConfig *config, + CoreLayerRegionConfigFlags updated, + CoreSurface *surface, + CorePalette *palette, + CoreSurfaceBufferLock *lock ) +{ + DFBResult ret; + + /* call the original function */ + ret = oldPrimaryFuncs.SetRegion( layer, oldPrimaryDriverData, + layer_data, region_data, + config, updated, surface, + palette, lock ); + if (ret) + return ret; + + /* select pixel based or global alpha */ + if (config->options & DLOP_ALPHACHANNEL) + cyber_select_alpha_src( ALPHA_GRAPHICS ); + else + cyber_select_alpha_src( ALPHA_REGISTER ); + + cyber_set_alpha_reg( config->opacity, + config->opacity, + config->opacity ); + + /* source color keying */ + cyber_select_RAM_addr( RAM_CPU ); + cyber_set_alpha_RAM_reg( 0, 0x00, 0x00, 0x00 ); + cyber_select_magic_alpha_src( ALPHA_LOOKUP ); + cyber_enable_magic_alpha_blend( config->options & DLOP_SRC_COLORKEY ); + + /* FIXME: hardcoded black color key */ + cyber_set_magic_match_reg( 0, 0, 0 ); + + return DFB_OK; +} + +DisplayLayerFuncs newPrimaryFuncs = { + .InitLayer = osdInitLayer, + + .TestRegion = osdTestRegion, + .SetRegion = osdSetRegion, +}; + +/* exported symbols */ + +static int +driver_probe( CoreGraphicsDevice *device ) +{ + switch (dfb_gfxcard_get_accelerator( device )) { + case FB_ACCEL_IGS_CYBER2000: + case FB_ACCEL_IGS_CYBER2010: + case FB_ACCEL_IGS_CYBER5000: +#ifdef FB_ACCEL_IGS_CYBER5K + case FB_ACCEL_IGS_CYBER5K: /* CyberPro 5xxx */ +#endif + return 1; + } + + return 0; +} + +static void +driver_get_info( CoreGraphicsDevice *device, + GraphicsDriverInfo *info ) +{ + /* fill driver info structure */ + snprintf( info->name, + DFB_GRAPHICS_DRIVER_INFO_NAME_LENGTH, + "Cyber Pro Driver" ); + + snprintf( info->vendor, + DFB_GRAPHICS_DRIVER_INFO_VENDOR_LENGTH, + "directfb.org" ); + + info->version.major = 0; + info->version.minor = 4; + + info->driver_data_size = sizeof (CyberDriverData); + info->device_data_size = sizeof (CyberDeviceData); +} + +static DFBResult +driver_init_driver( CoreGraphicsDevice *device, + GraphicsDeviceFuncs *funcs, + void *driver_data, + void *device_data, + CoreDFB *core ) +{ + CyberDriverData *cdrv = (CyberDriverData*) driver_data; + + /* gain access to memory mapped registers */ + cdrv->mmio_base = (volatile u8*) dfb_gfxcard_map_mmio( device, 0, -1 ); + if (!cdrv->mmio_base) + return DFB_IO; + + /* HACK */ + cyber_mmio = cdrv->mmio_base; + + /* fill acceleration function table */ + funcs->EngineSync = cyber5kEngineSync; + funcs->CheckState = cyber5kCheckState; + funcs->SetState = cyber5kSetState; + + funcs->FillRectangle = cyber5kFillRectangle; + funcs->DrawRectangle = cyber5kDrawRectangle; + funcs->DrawLine = cyber5kDrawLine; + funcs->Blit = cyber5kBlit; + + /* install primary layer hooks */ + dfb_layers_hook_primary( device, driver_data, &newPrimaryFuncs, + &oldPrimaryFuncs, &oldPrimaryDriverData ); + + /* add the video underlay */ + switch (dfb_gfxcard_get_accelerator( device )) { + case FB_ACCEL_IGS_CYBER5000: +#ifdef FB_ACCEL_IGS_CYBER5K + case FB_ACCEL_IGS_CYBER5K: /* CyberPro 5xxx */ +#endif + dfb_layers_register( dfb_screens_at(DSCID_PRIMARY), + driver_data, &cyberUnderlayFuncs ); + } + + return DFB_OK; +} + +static DFBResult +driver_init_device( CoreGraphicsDevice *device, + GraphicsDeviceInfo *device_info, + void *driver_data, + void *device_data ) +{ + CyberDriverData *cdrv = (CyberDriverData*) driver_data; + volatile u8 *mmio = cdrv->mmio_base; + + /* fill device info */ + snprintf( device_info->name, + DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "Cyber Pro" ); + + snprintf( device_info->vendor, + DFB_GRAPHICS_DEVICE_INFO_VENDOR_LENGTH, "TVIA" ); + + + device_info->caps.flags = 0; + device_info->caps.accel = CYBER5K_DRAWING_FUNCTIONS | + CYBER5K_BLITTING_FUNCTIONS; + device_info->caps.drawing = CYBER5K_DRAWING_FLAGS; + device_info->caps.blitting = CYBER5K_BLITTING_FLAGS; + + device_info->limits.surface_byteoffset_alignment = 16; + device_info->limits.surface_pixelpitch_alignment = 4; + + + /* set fifo policy at startup */ + cyber_grphw(0x74, 0x1b); + cyber_grphw(0x75, 0x1e); + + cyber_grphw(0xD9, 0x0f); + cyber_grphw(0xDA, 0x1b); + cyber_grphw(0xDD, 0x00); + + cyber_seqw(0xD9, 0x0f); + cyber_seqw(0xDA, 0x1b); + cyber_seqw(0xDD, 0x00); + + + + cyber_out8 (mmio, COPFLAGS, 1); + cyber_out8 (mmio, FMIX , 0x03); + + return DFB_OK; +} + +static void +driver_close_device( CoreGraphicsDevice *device, + void *driver_data, + void *device_data ) +{ +} + +static void +driver_close_driver( CoreGraphicsDevice *device, + void *driver_data ) +{ + CyberDriverData *cdrv = (CyberDriverData*) driver_data; + + dfb_gfxcard_unmap_mmio( device, cdrv->mmio_base, -1 ); +} + diff --git a/Source/DirectFB/gfxdrivers/cyber5k/cyber5k.h b/Source/DirectFB/gfxdrivers/cyber5k/cyber5k.h new file mode 100755 index 0000000..82aaabf --- /dev/null +++ b/Source/DirectFB/gfxdrivers/cyber5k/cyber5k.h @@ -0,0 +1,63 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef ___CYBER5K_H__ +#define ___CYBER5K_H__ + +#include +#include + +/* HACK */ +extern volatile u8 *cyber_mmio; + + +typedef struct { + volatile u8 *mmio_base; +} CyberDriverData; + +typedef struct { + /* state validation */ + int v_dst; + int v_src; + int v_color; + int v_src_colorkey; + int v_blitting_cmd; + + /* stored values */ + u32 dst_pixeloffset; + u32 dst_pixelpitch; + u32 src_pixeloffset; + u32 src_pixelpitch; + + u32 blitting_cmd; +} CyberDeviceData; + + +extern DisplayLayerFuncs cyberUnderlayFuncs; + +#endif diff --git a/Source/DirectFB/gfxdrivers/cyber5k/cyber5k_alpha.c b/Source/DirectFB/gfxdrivers/cyber5k/cyber5k_alpha.c new file mode 100755 index 0000000..4862293 --- /dev/null +++ b/Source/DirectFB/gfxdrivers/cyber5k/cyber5k_alpha.c @@ -0,0 +1,260 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include "cyber5k.h" +#include "cyber5k_alpha.h" +#include "regs.h" + +void cyber_cleanup_alpha(void) +{ + int i; + + cyber_grphw(0xfa, 0); + for (i=0; i<16; i++) { + if (i == 0x0A) {/*Don't clean up SyncLock video path if there is one*/ + cyber_out8(cyber_mmio, SEQINDEX, 0x40 + i); + cyber_out8(cyber_mmio, SEQDATA, cyber_in8(cyber_mmio, SEQDATA) & 0x08); + } + else { + cyber_out8(cyber_mmio, SEQINDEX, 0x40 + i); + cyber_out8(cyber_mmio, SEQDATA, 0x00); + } + } + + cyber_grphw(0xfa, 8); + for (i=0; i<16; i++) { + if(i==0x0F) {/*Just in case there is a SyncLock video*/ + cyber_out8(cyber_mmio, SEQINDEX, 0x40 + i); + cyber_out8(cyber_mmio, SEQDATA, 0x00); + cyber_out8(cyber_mmio, SEQDATA, cyber_in8(cyber_mmio, SEQDATA) | 0xC0); + } + else { + cyber_out8(cyber_mmio, SEQINDEX, 0x40 + i); + cyber_out8(cyber_mmio, SEQDATA, 0x00); + } + } + + cyber_grphw(0xfa, 0x10); + for (i=0; i<16; i++) { + cyber_out8(cyber_mmio, SEQINDEX, 0x40 + i); + cyber_out8(cyber_mmio, SEQDATA, 0x00); + } + + cyber_grphw(0xfa, 0x18); + for (i=0; i<16; i++) { + cyber_out8(cyber_mmio, SEQINDEX, 0x40 + i); + cyber_out8(cyber_mmio, SEQDATA, 0x00); + } + + cyber_grphw(0xfa, 0x20); + for (i=0; i<16; i++) { + cyber_out8(cyber_mmio, SEQINDEX, 0x40 + i); + cyber_out8(cyber_mmio, SEQDATA, 0x00); + } + + cyber_out8(cyber_mmio, SEQINDEX, 0xA6); + /*for video capture*/ + cyber_out8(cyber_mmio, SEQDATA, cyber_in8(cyber_mmio, SEQDATA) & 0xF0); + +#if 0 + /*for 8-bit Index mode*/ + if(bEnabled8Bit) /*if we are in 8-bit alpha-blending mode, remember to disable it*/ + EnablePaletteMode(0); +#endif + + cyber_out8(cyber_mmio, GRAINDEX, 0xfa); + cyber_out8(cyber_mmio, GRADATA, 0x80); + cyber_out8(cyber_mmio, GRAINDEX, 0xe0); + cyber_out8(cyber_mmio, GRADATA, cyber_in8(cyber_mmio, 0x03cf) | 0x04); + cyber_out8(cyber_mmio, GRAINDEX, 0xfa); + cyber_out8(cyber_mmio, GRADATA, 0x00); +} + +void cyber_enable_alpha(int enable) +{ + cyber_grphw(0xfa, 0); + + cyber_out8(cyber_mmio, SEQINDEX, 0x4b); + if (enable) + cyber_out8(cyber_mmio, SEQDATA, (cyber_in8(cyber_mmio, SEQDATA) | 0x80)); + else + cyber_out8(cyber_mmio, SEQDATA, (cyber_in8(cyber_mmio, SEQDATA) & 0x7F)); +} + +void cyber_enable_fullscreen_alpha(int enable) +{ + cyber_grphw(0xfa, 0); + + cyber_out8(cyber_mmio, SEQINDEX, 0x4b); + if (enable) + cyber_out8(cyber_mmio, SEQDATA, (cyber_in8(cyber_mmio, SEQDATA) | 0x40)); + else + cyber_out8(cyber_mmio, SEQDATA, (cyber_in8(cyber_mmio, SEQDATA) & 0xBF)); +} + +void cyber_select_blend_src1(int src) +{ + cyber_grphw(0xfa, 0); + + cyber_out8(cyber_mmio, SEQINDEX, 0x49); + cyber_out8(cyber_mmio, SEQDATA, (cyber_in8(cyber_mmio, SEQDATA) & ~0x03) | src); +} + +void cyber_select_blend_src2(int src) +{ + cyber_grphw(0xfa, 0); + + cyber_out8(cyber_mmio, SEQINDEX, 0x4d); + cyber_out8(cyber_mmio, SEQDATA, (cyber_in8(cyber_mmio, SEQDATA) & ~0x30) | (src << 4)); + if(src == SRC2_OVERLAY1) { /*if source is Overlay one only, disable Overlay 2*/ + cyber_out8(cyber_mmio, GRAINDEX, 0xfa); + cyber_out8(cyber_mmio, GRADATA, 0x08); + cyber_out8(cyber_mmio, SEQINDEX, 0x4f); + cyber_out8(cyber_mmio, SEQDATA, cyber_in8(cyber_mmio, SEQDATA) | 0x08); + cyber_out8(cyber_mmio, GRADATA, 0x00); + } +} + +void cyber_select_alpha_src(int src) +{ + cyber_grphw(0xfa, 0); + + cyber_out8(cyber_mmio, SEQINDEX, 0x49); + cyber_out8(cyber_mmio, SEQDATA, (cyber_in8(cyber_mmio, SEQDATA) & ~0x60) | (src << 5)); + /*if alpha source comes form Overlay2, we need to disable Overlay2 color key function*/ + if(src == ALPHA_OVERLAY2) { + /*Disable Overlay 2 in Source B path*/ + cyber_out8(cyber_mmio, GRAINDEX, 0xfa); + cyber_out8(cyber_mmio, GRADATA, 0x08); + cyber_out8(cyber_mmio, SEQINDEX, 0x4f); + cyber_out8(cyber_mmio, SEQDATA, cyber_in8(cyber_mmio, SEQDATA) | 0x08); + /*Disable V2 generally */ + cyber_out8(cyber_mmio, GRADATA, 0x20); + cyber_out8(cyber_mmio, SEQINDEX, 0x47); + cyber_out8(cyber_mmio, SEQDATA, cyber_in8(cyber_mmio, SEQDATA) | 0x02); + cyber_out8(cyber_mmio, GRADATA, 0x00); + } +} + +void cyber_set_alpha_reg(unsigned char r, unsigned char g, unsigned char b) +{ + cyber_grphw(0xfa, 0); + + cyber_seqw(0x46, r); + cyber_seqw(0x47, g); + cyber_seqw(0x48, b); +} + + +void cyber_set_magic_match_reg( unsigned char bR, unsigned char bG, unsigned char bB ) +{ + cyber_out8(cyber_mmio, GRAINDEX, 0xfa); + cyber_out8(cyber_mmio, GRADATA, 8); + /*Disable range feature first*/ + cyber_out8(cyber_mmio, SEQINDEX, 0x46); + cyber_out8(cyber_mmio, SEQDATA, cyber_in8(cyber_mmio, SEQDATA) & 0x7F); + + cyber_out8(cyber_mmio, SEQINDEX, 0x40); + cyber_out8(cyber_mmio, SEQDATA, bR); + cyber_out8(cyber_mmio, SEQINDEX, 0x41); + cyber_out8(cyber_mmio, SEQDATA, bG); + cyber_out8(cyber_mmio, SEQINDEX, 0x42); + cyber_out8(cyber_mmio, SEQDATA, bB); +} + +void cyber_set_alpha_RAM_reg( unsigned char bIndex, unsigned char bR, unsigned char bG, unsigned char bB) +{ + unsigned char bData; + + cyber_out8(cyber_mmio, GRAINDEX, 0xfa); + cyber_out8(cyber_mmio, GRADATA, 0); + + cyber_out8(cyber_mmio, SEQINDEX, 0x49); + bData = cyber_in8(cyber_mmio, SEQDATA); + cyber_out8(cyber_mmio, SEQDATA, 0x18); /*select CPU to write*/ + + cyber_out8(cyber_mmio, SEQINDEX, 0x4e); /*enable index of alpha RAM R*/ + cyber_out8(cyber_mmio, SEQDATA, 0x20+bIndex); + + cyber_out8(cyber_mmio, SEQINDEX, 0x4f); /*RAM data port*/ + cyber_out8(cyber_mmio, SEQDATA, bR); + + cyber_out8(cyber_mmio, SEQINDEX, 0x4e); /*enable index of alpha RAM G*/ + cyber_out8(cyber_mmio, SEQDATA, 0x40+bIndex); + + cyber_out8(cyber_mmio, SEQINDEX, 0x4f); /*RAM data port*/ + cyber_out8(cyber_mmio, SEQDATA, bG); + + cyber_out8(cyber_mmio, SEQINDEX, 0x4e); /*enable index of alpha RAM B*/ + cyber_out8(cyber_mmio, SEQDATA, 0x80+bIndex); + + cyber_out8(cyber_mmio, SEQINDEX, 0x4f); /*RAM data port*/ + cyber_out8(cyber_mmio, SEQDATA, bB); + + cyber_out8(cyber_mmio, SEQINDEX, 0x49); + cyber_out8(cyber_mmio, SEQDATA, bData); + + cyber_out8(cyber_mmio, SEQINDEX, 0x4e); /*Set index of alpha RAM */ + cyber_out8(cyber_mmio, SEQDATA, bIndex); +} + +void cyber_select_RAM_addr( unsigned char bRAMAddrSel ) +{ + cyber_out8(cyber_mmio, GRAINDEX, 0xfa); + cyber_out8(cyber_mmio, GRADATA, 0); + + cyber_out8(cyber_mmio, SEQINDEX, 0x49); + cyber_out8(cyber_mmio, SEQDATA, (cyber_in8(cyber_mmio, SEQDATA) & ~0x18) | (bRAMAddrSel << 3)); +} + +void cyber_enable_magic_alpha_blend( unsigned char enable ) +{ + cyber_out8(cyber_mmio, GRAINDEX, 0xfa); + cyber_out8(cyber_mmio, GRADATA, 8); + + cyber_out8(cyber_mmio, SEQINDEX, 0x46); + if (enable) + cyber_out8(cyber_mmio, SEQDATA, (cyber_in8(cyber_mmio, SEQDATA) | 0x01)); + else + cyber_out8(cyber_mmio, SEQDATA, (cyber_in8(cyber_mmio, SEQDATA) & 0xFE)); + + cyber_out8(cyber_mmio, GRAINDEX, 0xfa); + cyber_out8(cyber_mmio, GRADATA, 0x20); + cyber_out8(cyber_mmio, SEQINDEX, 0x47); + cyber_out8(cyber_mmio, SEQDATA, cyber_in8(cyber_mmio, SEQDATA) & 0x7F); + cyber_out8(cyber_mmio, GRADATA, 0x00); +} + +void cyber_select_magic_alpha_src( unsigned char bAlphaSrc ) +{ + cyber_out8(cyber_mmio, GRAINDEX, 0xfa); + cyber_out8(cyber_mmio, GRADATA, 8); + + cyber_out8(cyber_mmio, SEQINDEX, 0x46); + cyber_out8(cyber_mmio, SEQDATA, (cyber_in8(cyber_mmio, SEQDATA) & ~0x0C) | (bAlphaSrc << 2)); +} diff --git a/Source/DirectFB/gfxdrivers/cyber5k/cyber5k_alpha.h b/Source/DirectFB/gfxdrivers/cyber5k/cyber5k_alpha.h new file mode 100755 index 0000000..f3f635c --- /dev/null +++ b/Source/DirectFB/gfxdrivers/cyber5k/cyber5k_alpha.h @@ -0,0 +1,64 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef CYBER5KFB_ALPHA_H +#define CYBER5KFB_ALPHA_H + +#include "mmio.h" + +#define SRC1_GRAPHICS 0 +#define SRC1_OVERLAY1 1 +#define SRC1_OVERLAY2 2 + +#define SRC2_OVERLAY1 0 +#define SRC2_OVERLAY2 1 +#define SRC2_GRAPHICS 2 + +#define ALPHA_GRAPHICS 0 +#define ALPHA_OVERLAY2 1 +#define ALPHA_LOOKUP 2 +#define ALPHA_REGISTER 3 + +#define RAM_CPU 3 + +void cyber_cleanup_alpha(void); +void cyber_enable_alpha(int enable); +void cyber_enable_fullscreen_alpha(int enable); +void cyber_cleanup_alpha(void); +void cyber_select_blend_src1(int src); +void cyber_select_blend_src2(int src); +void cyber_select_alpha_src(int src); +void cyber_set_alpha_reg(unsigned char r, unsigned char g, unsigned char b); + +void cyber_select_RAM_addr( unsigned char bRAMAddrSel ); +void cyber_set_alpha_RAM_reg( unsigned char bIndex, unsigned char bR, unsigned char bG, unsigned char bB); +void cyber_select_magic_alpha_src( unsigned char bAlphaSrc ); +void cyber_enable_magic_alpha_blend( unsigned char enable ); +void cyber_set_magic_match_reg( unsigned char bR, unsigned char bG, unsigned char bB ); + +#endif /* CYBER5KFB_ALPHA_H */ diff --git a/Source/DirectFB/gfxdrivers/cyber5k/cyber5k_overlay.c b/Source/DirectFB/gfxdrivers/cyber5k/cyber5k_overlay.c new file mode 100755 index 0000000..b4638df --- /dev/null +++ b/Source/DirectFB/gfxdrivers/cyber5k/cyber5k_overlay.c @@ -0,0 +1,376 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include + +#include + +#include "cyber5k.h" +#include "cyber5k_overlay.h" +#include "regs.h" +#include "mmio.h" + +static int overlay_byte_per_pixel = 2; +static int overlay_init = 0; + +static unsigned char savedReg74, savedReg75; /*FIFO control registers for 2D Graphics*/ +static unsigned char savedRegD9[2], savedRegDA[2], savedRegDD[2]; /*FIFO control registers for Overlay*/ +/*Following is our FIFO policy number, should be programmed to +0x3CE/0x74, 0x3CE/0x75, 0x3CE(0x3C4)/0xD9, 0x3CE(0x3C4)/0xDA, +0x3CE(0x3c4)/0xDD respectively in order to get a best memory bandwidth. +Current value is a group of experence value based on 70MHZ EDO/SG RAM.*/ +static unsigned char bFIFOPolicyNum[5] = {0x10, 0x10, 0x1C, 0x1C, 0x06}; + + +static void +cyber_videoreg_mask( unsigned char index, unsigned char value, unsigned char mask ) +{ + unsigned char tmp; + + cyber_out8( cyber_mmio, GRAINDEX, index ); + tmp = cyber_in8( cyber_mmio, GRADATA ); + tmp &= mask; + tmp |= value; + cyber_out8( cyber_mmio, GRADATA, tmp ); +} + +static void +cyber_seqreg_mask( unsigned char index, unsigned char value, unsigned char mask ) +{ + unsigned char tmp; + + cyber_out8( cyber_mmio, SEQINDEX, index ); + tmp = cyber_in8( cyber_mmio, SEQDATA ); + + tmp &= mask; + tmp |= value; + cyber_out8( cyber_mmio, SEQDATA, tmp ); +} + +static void +cyber_overlayreg_mask( unsigned char index, unsigned char value, unsigned char mask ) { + unsigned char tmp; + + cyber_out8( cyber_mmio, GRAINDEX, index ); + tmp = cyber_in8( cyber_mmio, GRADATA ); + + tmp &= mask; + tmp |= value; + cyber_out8(cyber_mmio, GRADATA, tmp); +} + +void cyber_cleanup_overlay(void) +{ + /*restore FIFO control regs*/ + cyber_seqreg_mask(0xA7, 0x0, ~0x5); + + + if (!overlay_init) + return; + overlay_init = 0; + + + cyber_grphw(0x74, savedReg74); + cyber_grphw(0x75, savedReg75); + + cyber_grphw(0xD9, savedRegD9[0]); + cyber_grphw(0xDA, savedRegDA[0]); + cyber_grphw(0xDD, savedRegDD[0]); + + cyber_seqw(0xD9, savedRegD9[1]); + cyber_seqw(0xDA, savedRegDA[1]); + cyber_seqw(0xDD, savedRegDD[1]); +} + +void cyber_init_overlay(void) +{ + /*Clear Overlay path first*/ + cyber_grphw(DISP_CTL_I, 0x00); + + /* Video Display Vertical Starting Line (may not need initiate here)*/ + cyber_grphw(DEST_RECT_TOP_L, 0x00); + cyber_grphw(DEST_RECT_TOP_H, 0x00); + + /* Overlay Vertical DDA Increment Value*/ + cyber_grphw(DDA_Y_INC_L, 0x00); + cyber_grphw(DDA_Y_INC_H, 0x10); + + /* Video Memory Starting Address*/ + cyber_grphw(MEMORY_START_L, 0x00); + cyber_grphw(MEMORY_START_M, 0x0f); + cyber_grphw(MEMORY_START_H, 0x03); /* Temporary fixed to 0x30f00 = 0xc3c00 >> 2*/ + /* 0x3c00 = 0x300*0x14 = 768*20*/ + + /* Video Display Horizontal Starting Pixel -- may not need init here*/ + cyber_grphw(DEST_RECT_LEFT_L, 0x20); + cyber_grphw(DEST_RECT_LEFT_H, 0x00); + + /* Video Display Horizontal Ending Pixel -- may not need init here*/ + cyber_grphw(DEST_RECT_RIGHT_L, 0x60); + cyber_grphw(DEST_RECT_RIGHT_H, 0x01); + + /* Video Display Vertical Ending Line -- may not need init here*/ + cyber_grphw(DEST_RECT_BOTTOM_L, 0xe0); + cyber_grphw(DEST_RECT_BOTTOM_H, 0x00); + + /* Video Color Compare Register*/ + cyber_grphw(COLOR_CMP_RED, 0x00); + cyber_grphw(COLOR_CMP_GREEN,0x00); + cyber_grphw(COLOR_CMP_BLUE, 0x00); + + /* Video Horizontal DDA Increment Value*/ + cyber_grphw(DDA_X_INC_L, 0x00); + cyber_grphw(DDA_X_INC_H, 0x10); + + /* Video Format Control*/ + cyber_grphw(VIDEO_FORMAT, 0x00); + + /* Video Misc Control*/ + cyber_grphw(MISC_CTL_I, 0x00); + + cyber_grphw(MISC_CTL_I, 0x01); /* Video Misc Control*/ + + /*default to colorkey*/ + cyber_grphw(DISP_CTL_I, 0x04 ); + +#ifdef NTSCTVOUT /*if your TV output mode is NTSC*/ + cyber_seqreg_mask(0xA6, 0x20, ~0x30); +#else /*if your TV output mode is PAL*/ + cyber_seqreg_mask(0xA6, 0x30, ~0x30); +#endif + + + if (overlay_init) + return; + overlay_init = 1; + + + +/* the following code is commented out, since saved values are not clean if */ +/* DirectFB crashed while underlay was enabled, hardcoded bootup */ +/* values instead (see below) */ + +/* + cyber_out8(cyber_mmio, GRAINDEX, 0x74); + savedReg74 = cyber_in8(cyber_mmio, GRADATA); + cyber_out8(cyber_mmio, GRAINDEX, 0x75); + savedReg75 = cyber_in8(cyber_mmio, GRADATA); + + cyber_out8(cyber_mmio, GRAINDEX, 0xD9); + savedRegD9[0] = cyber_in8(cyber_mmio, GRADATA); + cyber_out8(cyber_mmio, GRAINDEX, 0xDA); + savedRegDA[0] = cyber_in8(cyber_mmio, GRADATA); + cyber_out8(cyber_mmio, GRAINDEX, 0xDD); + savedRegDD[0] = cyber_in8(cyber_mmio, GRADATA); + + cyber_out8(cyber_mmio, SEQINDEX, 0xD9); + savedRegD9[1] = cyber_in8(cyber_mmio, SEQDATA); + cyber_out8(cyber_mmio, SEQINDEX, 0xDA); + savedRegDA[1] = cyber_in8(cyber_mmio, SEQDATA); + cyber_out8(cyber_mmio, SEQINDEX, 0xDD); + savedRegDD[1] = cyber_in8(cyber_mmio, SEQDATA); + */ + + + savedReg74 = 0x1b; + savedReg74 = 0x1e; + + savedRegD9[0] = 0x0f; + savedRegDA[0] = 0x1b; + savedRegDD[0] = 0x00; + + savedRegD9[1] = 0x0f; + savedRegDA[1] = 0x1b; + savedRegDD[1] = 0x00; +} + +void cyber_change_overlay_fifo(void) +{ + cyber_grphw(0x74, bFIFOPolicyNum[0]); + cyber_grphw(0x75, bFIFOPolicyNum[1]); + cyber_grphw(0xD9, bFIFOPolicyNum[2]); + cyber_grphw(0xDA, bFIFOPolicyNum[3]); + + cyber_videoreg_mask(0xA6, 0x08, ~0x08); + cyber_videoreg_mask(0xF1, 0x40, (unsigned char)(~0xC0)); + cyber_overlayreg_mask(FIFO_CTL_I, bFIFOPolicyNum[4] & 0x05, ~0x05); + cyber_overlayreg_mask(FIFO_CTL_I, 0x2, ~0x02); +} + +void cyber_set_overlay_format(int format) { + switch (format) { + case OVERLAY_YUV422: + cyber_overlayreg_mask( VIDEO_FORMAT, 0x00, 0xF8 ); + overlay_byte_per_pixel = 2; + break; + case OVERLAY_RGB555: + cyber_overlayreg_mask( VIDEO_FORMAT, 0x01, 0xF8 ); + overlay_byte_per_pixel = 2; + break; + case OVERLAY_RGB565: + cyber_overlayreg_mask( VIDEO_FORMAT, 0x02, 0xF8 ); + overlay_byte_per_pixel = 2; + break; + case OVERLAY_RGB888: + cyber_overlayreg_mask( VIDEO_FORMAT, 0x03, 0xF8 ); + overlay_byte_per_pixel = 3; + break; + case OVERLAY_RGB8888: + cyber_overlayreg_mask( VIDEO_FORMAT, 0x04, 0xF8 ); + overlay_byte_per_pixel = 4; + break; + case OVERLAY_RGB8: + cyber_overlayreg_mask( VIDEO_FORMAT, 0x05, 0xF8 ); + overlay_byte_per_pixel = 1; + break; + case OVERLAY_RGB4444: + cyber_overlayreg_mask( VIDEO_FORMAT, 0x06, 0xF8 ); + overlay_byte_per_pixel = 2; + break; + case OVERLAY_RGB8T: + cyber_overlayreg_mask( VIDEO_FORMAT, 0x07, 0xF8 ); + overlay_byte_per_pixel = 1; + break; + } +} + +void cyber_set_overlay_mode(int mode) +{ + switch (mode) { + case OVERLAY_COLORKEY: + cyber_overlayreg_mask( DISP_CTL_I, 0x00, 0xFD ); + break; + case OVERLAY_WINDOWKEY: + default: + cyber_overlayreg_mask( DISP_CTL_I, 0x02, 0xFD ); + break; + } +} + +void cyber_set_overlay_srcaddr(int addr, int x, int y, int width, int pitch) +{ + unsigned char bHigh; + int wByteFetch; + + addr += y * pitch + x * overlay_byte_per_pixel; + addr >>= 2; + + /*playback start addr*/ + cyber_grphw( MEMORY_START_L, (unsigned char)( addr & 0x0000FF) ); + cyber_grphw( MEMORY_START_M, (unsigned char)((addr & 0x00FF00) >> 8) ); + cyber_grphw( MEMORY_START_H, (unsigned char)((addr & 0xFF0000) >> 16) ); + + /* pitch is a multiple of 64 bits*/ + pitch >>= 3; /* 64 bit address field*/ + wByteFetch = (width * overlay_byte_per_pixel + 7) >> 3; + + bHigh = (unsigned char)(pitch >> 8) & 0x0F; + bHigh = bHigh | (((unsigned char)(wByteFetch >> 8)) << 4 ); + + cyber_grphw( MEMORY_PITCH_L, (unsigned char)(pitch) ); + cyber_grphw( MEMORY_PITCH_H, bHigh ); + + cyber_grphw( MEMORY_OFFSET_PHASE, (unsigned char)(wByteFetch) ); + + if (width > 720) /*Turn off interpolation*/ + cyber_overlayreg_mask( DISP_CTL_I, 0x20, 0xDF ); + else { /*Turn off interpolation*/ + if (width > 360) { /* Y Only*/ + cyber_seqreg_mask(0xA6, 0x40, ~0x40); + } + else { + cyber_seqreg_mask(0xA6, 0x00, ~0x40); + } + + cyber_overlayreg_mask( DISP_CTL_I, 0x00, 0xDF ); + } +} + +void cyber_set_overlay_window(int left, int top, int right, int bottom) +{ + cyber_grphw( DEST_RECT_LEFT_L, (unsigned char)(left ) ); + cyber_grphw( DEST_RECT_LEFT_H, (unsigned char)(left >> 8) ); + cyber_grphw( DEST_RECT_RIGHT_L, (unsigned char)(right ) ); + cyber_grphw( DEST_RECT_RIGHT_H, (unsigned char)(right >> 8) ); + + cyber_grphw( DEST_RECT_TOP_L, (unsigned char)(top ) ); + cyber_grphw( DEST_RECT_TOP_H, (unsigned char)(top >> 8) ); + cyber_grphw( DEST_RECT_BOTTOM_L, (unsigned char)(bottom ) ); + cyber_grphw( DEST_RECT_BOTTOM_H, (unsigned char)(bottom >> 8) ); +} + +void cyber_set_overlay_scale( unsigned char bEnableBob, int wSrcXExt, int wDstXExt, int wSrcYExt, int wDstYExt ) +{ + int dwScale; + + cyber_grphw( DDA_X_INIT_L, 0x0 ); /* set to 0x800;*/ + cyber_grphw( DDA_X_INIT_H, 0x8 ); + if ( wSrcXExt == wDstXExt ) + dwScale = 0x1000; + else + dwScale = ( wSrcXExt * 0x1000 ) / wDstXExt; + cyber_grphw( DDA_X_INC_L, (unsigned char)( dwScale & 0x00FF) ); + cyber_grphw( DDA_X_INC_H, (unsigned char)((dwScale & 0xFF00) >> 8) ); + + cyber_grphw( DDA_Y_INIT_L, 0x0 ); /* set to 0x800;*/ + cyber_grphw( DDA_Y_INIT_H, 0x8 ); + + if ( wSrcYExt == wDstYExt ) + dwScale = 0x1000; + else + dwScale = ( wSrcYExt * 0x1000 ) / wDstYExt; + + + if (bEnableBob == 0) {/*Disable Bob mode*/ + cyber_seqreg_mask(0xA7, 0x0, ~0x5); /*Bob/Weave disable*/ + } + else {/*Enable Bob mode*/ + wSrcYExt = wSrcYExt / 2; + if (wSrcYExt == wDstYExt) + dwScale = 0x1000; + else + dwScale = ( wSrcYExt * 0x1000 ) / wDstYExt; + if (dwScale <= 0x815 && dwScale >= 0x7eb) { + cyber_seqreg_mask(0xA7, 0x5, ~0x5); /*Bob/Weave enable*/ + } + else { + cyber_seqreg_mask(0xA7, 0x4, ~0x5); /*Bob/Weave enable*/ + } + } + + cyber_grphw( DDA_Y_INC_L, (unsigned char)( dwScale & 0x00FF) ); + cyber_grphw( DDA_Y_INC_H, (unsigned char)((dwScale & 0xFF00) >> 8) ); +} + +void cyber_enable_overlay(int enable) +{ + if (enable) + cyber_overlayreg_mask( DISP_CTL_I, 0x84, (unsigned char)(~0x84) ); + else + cyber_overlayreg_mask( DISP_CTL_I, 0x00, 0x7F ); /* Disable Vafc !!!*/ +} diff --git a/Source/DirectFB/gfxdrivers/cyber5k/cyber5k_overlay.h b/Source/DirectFB/gfxdrivers/cyber5k/cyber5k_overlay.h new file mode 100755 index 0000000..bb24499 --- /dev/null +++ b/Source/DirectFB/gfxdrivers/cyber5k/cyber5k_overlay.h @@ -0,0 +1,92 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef CYBER5KFB_OVERLAY_H +#define CYBER5KFB_OVERLAY_H + +#include "regs.h" + +#define OVERLAY_YUV422 0 /*captured data is YUV 422 format*/ +#define OVERLAY_RGB555 1 +#define OVERLAY_RGB565 2 +#define OVERLAY_RGB888 3 +#define OVERLAY_RGB8888 4 +#define OVERLAY_RGB8 5 +#define OVERLAY_RGB4444 6 +#define OVERLAY_RGB8T 7 + +#define OVERLAY_COLORKEY 0 /*Overlayed window is of color keying*/ +#define OVERLAY_WINDOWKEY 1 /*Overlayed window is of window keying*/ + +#define OVERLAY_WEAVEMODE 0 +#define OVERLAY_BOBMODE 1 + + +#define MEMORY_START_L 0xC0 +#define MEMORY_START_M 0xC1 +#define MEMORY_START_H 0xC2 +#define MEMORY_PITCH_L 0xC3 +#define MEMORY_PITCH_H 0xC4 +#define DEST_RECT_LEFT_L 0xC5 +#define DEST_RECT_LEFT_H 0xC6 +#define DEST_RECT_RIGHT_L 0xC7 +#define DEST_RECT_RIGHT_H 0xC8 +#define DEST_RECT_TOP_L 0xC9 +#define DEST_RECT_TOP_H 0xCA +#define DEST_RECT_BOTTOM_L 0xCB +#define DEST_RECT_BOTTOM_H 0xCC +#define MEMORY_OFFSET_PHASE 0xCD +#define COLOR_CMP_RED 0xCE +#define COLOR_CMP_GREEN 0xCF +#define COLOR_CMP_BLUE 0xD0 +#define DDA_X_INIT_L 0xD1 +#define DDA_X_INIT_H 0xD2 +#define DDA_X_INC_L 0xD3 +#define DDA_X_INC_H 0xD4 +#define DDA_Y_INIT_L 0xD5 +#define DDA_Y_INIT_H 0xD6 +#define DDA_Y_INC_L 0xD7 +#define DDA_Y_INC_H 0xD8 +#define FIFO_TIMING_CTL_L 0xD9 +#define FIFO_TIMING_CTL_H 0xDA +#define VIDEO_FORMAT 0xDB +#define DISP_CTL_I 0xDC +#define FIFO_CTL_I 0xDD +#define MISC_CTL_I 0xDE + +void cyber_cleanup_overlay(void); +void cyber_init_overlay(void); +void cyber_enable_overlay(int enable); +void cyber_change_overlay_fifo(void); +void cyber_set_overlay_format(int format); +void cyber_set_overlay_mode(int mode); +void cyber_set_overlay_srcaddr(int addr, int x, int y, int width, int pitch); +void cyber_set_overlay_window(int left, int top, int right, int bottom); +void cyber_set_overlay_scale( unsigned char bEnableBob, int wSrcXExt, int wDstXExt, int wSrcYExt, int wDstYExt ); + +#endif /* CYBER5KFB_OVERLAY_H */ diff --git a/Source/DirectFB/gfxdrivers/cyber5k/cyber5k_underlay.c b/Source/DirectFB/gfxdrivers/cyber5k/cyber5k_underlay.c new file mode 100755 index 0000000..588f111 --- /dev/null +++ b/Source/DirectFB/gfxdrivers/cyber5k/cyber5k_underlay.c @@ -0,0 +1,301 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include + +#include + +#include +#include +#include + +#include "cyber5k.h" +#include "cyber5k_alpha.h" +#include "cyber5k_overlay.h" + +typedef struct { + CoreLayerRegionConfig config; +} CyberUnderlayLayerData; + +static void udl_set_all ( CyberDriverData *cdrv, + CyberUnderlayLayerData *cudl, + CoreLayerRegionConfig *config, + CoreSurface *surface, + CoreSurfaceBufferLock *lock ); +static void udl_set_location( CyberDriverData *cdrv, + CyberUnderlayLayerData *cudl, + CoreLayerRegionConfig *config, + CoreSurface *surface ); + +#define CYBER_UNDERLAY_SUPPORTED_OPTIONS (DLOP_NONE) + +/**********************/ + +static int +udlLayerDataSize( void ) +{ + return sizeof(CyberUnderlayLayerData); +} + +static DFBResult +udlInitLayer( CoreLayer *layer, + void *driver_data, + void *layer_data, + DFBDisplayLayerDescription *description, + DFBDisplayLayerConfig *default_config, + DFBColorAdjustment *default_adj ) +{ + /* set capabilities and type */ + description->caps = DLCAPS_SURFACE | DLCAPS_ALPHACHANNEL | + DLCAPS_OPACITY | DLCAPS_SRC_COLORKEY | + DLCAPS_SCREEN_LOCATION; + description->type = DLTF_GRAPHICS | DLTF_VIDEO | DLTF_STILL_PICTURE | + DLTF_BACKGROUND; + + /* set name */ + snprintf( description->name, + DFB_DISPLAY_LAYER_DESC_NAME_LENGTH, "CyberPro Underlay" ); + + /* fill out the default configuration */ + default_config->flags = DLCONF_WIDTH | DLCONF_HEIGHT | + DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE | + DLCONF_OPTIONS; + default_config->width = 768; + default_config->height = 576; + default_config->pixelformat = DSPF_RGB16; + default_config->buffermode = DLBM_FRONTONLY; + default_config->options = DLOP_NONE; + + /* initialize registers */ + cyber_init_overlay(); + + /* workaround */ + cyber_change_overlay_fifo(); + cyber_cleanup_overlay(); + cyber_init_overlay(); + + return DFB_OK; +} + +static DFBResult +udlTestRegion( CoreLayer *layer, + void *driver_data, + void *layer_data, + CoreLayerRegionConfig *config, + CoreLayerRegionConfigFlags *failed ) +{ + CoreLayerRegionConfigFlags fail = 0; + + /* check for unsupported options */ + if (config->options & ~CYBER_UNDERLAY_SUPPORTED_OPTIONS) + fail |= CLRCF_OPTIONS; + + /* check pixel format */ + switch (config->format) { + case DSPF_RGB332: + case DSPF_ARGB1555: + case DSPF_RGB16: + case DSPF_RGB24: + case DSPF_RGB32: + case DSPF_ARGB: + case DSPF_YUY2: + break; + + default: + fail |= CLRCF_FORMAT; + } + + /* check width */ + if (config->width > 1024 || config->width < 4) + fail |= CLRCF_WIDTH; + + /* check height */ + if (config->height > 1024 || config->height < 1) + fail |= CLRCF_HEIGHT; + + /* write back failing fields */ + if (failed) + *failed = fail; + + /* return failure if any field failed */ + if (fail) + return DFB_UNSUPPORTED; + + return DFB_OK; +} + +static DFBResult +udlSetRegion( CoreLayer *layer, + void *driver_data, + void *layer_data, + void *region_data, + CoreLayerRegionConfig *config, + CoreLayerRegionConfigFlags updated, + CoreSurface *surface, + CorePalette *palette, + CoreSurfaceBufferLock *lock ) +{ + CyberDriverData *cdrv = (CyberDriverData*) driver_data; + CyberUnderlayLayerData *cudl = (CyberUnderlayLayerData*) layer_data; + + /* remember configuration */ + cudl->config = *config; + + /* set up layer */ + udl_set_all( cdrv, cudl, config, surface, lock ); + + return DFB_OK; +} + +static DFBResult +udlRemoveRegion( CoreLayer *layer, + void *driver_data, + void *layer_data, + void *region_data ) +{ + /* disable and clean up */ + cyber_enable_overlay(0); + cyber_cleanup_alpha(); + cyber_cleanup_overlay(); + + return DFB_OK; +} + +static DFBResult +udlFlipRegion( CoreLayer *layer, + void *driver_data, + void *layer_data, + void *region_data, + CoreSurface *surface, + DFBSurfaceFlipFlags flags, + CoreSurfaceBufferLock *lock ) +{ + CyberDriverData *cdrv = (CyberDriverData*) driver_data; + CyberUnderlayLayerData *cudl = (CyberUnderlayLayerData*) layer_data; + + dfb_surface_flip( surface, false ); + + udl_set_all( cdrv, cudl, &cudl->config, surface, lock ); + + return DFB_OK; +} + + +DisplayLayerFuncs cyberUnderlayFuncs = { + .LayerDataSize = udlLayerDataSize, + .InitLayer = udlInitLayer, + + .TestRegion = udlTestRegion, + .SetRegion = udlSetRegion, + .RemoveRegion = udlRemoveRegion, + .FlipRegion = udlFlipRegion, +}; + + +/* internal */ + +static void udl_set_all( CyberDriverData *cdrv, + CyberUnderlayLayerData *cudl, + CoreLayerRegionConfig *config, + CoreSurface *surface, + CoreSurfaceBufferLock *lock ) +{ + /* set the pixel format */ + switch (surface->config.format) { + case DSPF_RGB332: + cyber_set_overlay_format (OVERLAY_RGB8); + break; + + case DSPF_ARGB1555: + cyber_set_overlay_format (OVERLAY_RGB555); + break; + + case DSPF_RGB16: + cyber_set_overlay_format (OVERLAY_RGB565); + break; + + case DSPF_RGB24: + cyber_set_overlay_format (OVERLAY_RGB888); + break; + + case DSPF_ARGB: + case DSPF_RGB32: + cyber_set_overlay_format (OVERLAY_RGB8888); + break; + + case DSPF_YUY2: + cyber_set_overlay_format (OVERLAY_YUV422); + break; + + default: + D_BUG("unexpected pixelformat"); + break; + } + + cyber_set_overlay_mode( OVERLAY_WINDOWKEY ); + + /* set address */ + cyber_set_overlay_srcaddr( lock->offset, 0, 0, + surface->config.size.w, lock->pitch ); + + /* set location and scaling */ + udl_set_location( cdrv, cudl, config, surface ); + + /* tune fifo */ + cyber_change_overlay_fifo(); + + /* set up alpha blending */ + cyber_enable_alpha( 1 ); + cyber_enable_fullscreen_alpha( 1 ); + cyber_select_blend_src1( SRC1_GRAPHICS ); + cyber_select_blend_src2( SRC2_OVERLAY1 ); + + /* FIXME: find out why the opacity can't be set outside of this function */ + cyber_set_alpha_reg( 0xcc, 0xcc, 0xcc ); + + /* turn it on */ + cyber_enable_overlay(1); +} + +static void udl_set_location( CyberDriverData *cdrv, + CyberUnderlayLayerData *cudl, + CoreLayerRegionConfig *config, + CoreSurface *surface ) +{ + /* set location */ + cyber_set_overlay_window( config->dest.x, config->dest.y, + config->dest.x + config->dest.w - 1, + config->dest.y + config->dest.h - 1 ); + + /* set scaling */ + cyber_set_overlay_scale( surface->config.size.h == 576 ? /* HACK: support interlaced video */ + OVERLAY_BOBMODE : OVERLAY_WEAVEMODE, + surface->config.size.w, config->dest.w, + surface->config.size.h, config->dest.h ); +} + diff --git a/Source/DirectFB/gfxdrivers/cyber5k/mmio.h b/Source/DirectFB/gfxdrivers/cyber5k/mmio.h new file mode 100755 index 0000000..59f9a8d --- /dev/null +++ b/Source/DirectFB/gfxdrivers/cyber5k/mmio.h @@ -0,0 +1,126 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + Written by Denis Oliver Kropp , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef __CYBER5K_MMIO__ +#define __CYBER5K_MMIO__ + +#include +#include "cyber5k.h" +#include "regs.h" + +static inline void +cyber_out8(volatile u8 *mmioaddr, u32 reg, u8 value) +{ + *((volatile u8*)(mmioaddr+reg)) = value; +} + +static inline void +cyber_out16(volatile u8 *mmioaddr, u32 reg, u16 value) +{ + *((volatile u16*)(mmioaddr+reg)) = value; +} + +static inline void +cyber_out32(volatile u8 *mmioaddr, u32 reg, u32 value) +{ + *((volatile u32*)(mmioaddr+reg)) = value; +} + +static inline u8 +cyber_in8(volatile u8 *mmioaddr, u32 reg) +{ + return *((volatile u8*)(mmioaddr+reg)); +} + +static inline u16 +cyber_in16(volatile u8 *mmioaddr, u32 reg) +{ + return *((volatile u16*)(mmioaddr+reg)); +} + +static inline u32 +cyber_in32(volatile u8 *mmioaddr, u32 reg) +{ + return *((volatile u32*)(mmioaddr+reg)); +} + +/* Wait for idle accelerator */ +static inline void +cyber_waitidle( CyberDriverData *cdrv, CyberDeviceData *cdev ) +{ +/* while (cyber_in8(mmioaddr, COP_STAT) & (CMDFF_FULL | HOSTFF_NOTEMPTY)) { + grodis = 0; + }*/ + while ( cyber_in8(cdrv->mmio_base, COP_STAT) & (COP_BUSY|CMDFF_FULL|HOSTFF_NOTEMPTY) ); +} + +/* ------------------------------------------------------------------------ */ + +static inline void cyber_crtcw(int reg, int val) +{ + cyber_out8( cyber_mmio, CRTINDEX, reg ); + cyber_out8( cyber_mmio, CRTDATA, val ); +} + +static inline void cyber_grphw(int reg, int val) +{ + cyber_out8( cyber_mmio, GRAINDEX, reg ); + cyber_out8( cyber_mmio, GRADATA, val ); +} + +static inline unsigned int cyber_grphr(int reg) +{ + cyber_out8( cyber_mmio, GRAINDEX, reg ); + return cyber_in8( cyber_mmio, GRADATA ); +} + +static inline void cyber_attrw(int reg, int val) +{ + cyber_in8( cyber_mmio, ATTRRESET ); + cyber_out8( cyber_mmio, ATTRINDEX, reg ); + cyber_in8( cyber_mmio, ATTRDATAR ); + cyber_out8( cyber_mmio, ATTRDATAW, val ); +} + +static inline void cyber_seqw(int reg, int val) +{ + cyber_out8( cyber_mmio, SEQINDEX, reg ); + cyber_out8( cyber_mmio, SEQDATA, val ); +} + +static inline void cyber_tvw(int reg, int val) +{ + cyber_out8( cyber_mmio, 0xb0000 + reg, val ); +} + +static inline unsigned int cyber_tvr(int reg) +{ + return cyber_in8( cyber_mmio, 0xb0000 + reg ); +} + +#endif diff --git a/Source/DirectFB/gfxdrivers/cyber5k/regs.h b/Source/DirectFB/gfxdrivers/cyber5k/regs.h new file mode 100755 index 0000000..7ae038a --- /dev/null +++ b/Source/DirectFB/gfxdrivers/cyber5k/regs.h @@ -0,0 +1,387 @@ +#ifndef REGS_H +#define REGS_H + +/* + * COP MMIO definition + * + */ + +#define OPAQUE 0 +#define TRANSPARENT 1 + +#define TRANSPARENT_SRC 1 +#define TRANSPARENT_DST 2 +#define SRC_FROM_SYS 4 +#define PAT_IS_MONO 8 + +#define R2_ZERO 0x00 +#define R2_S_AND_D 0x01 +#define R2_S_AND_ND 0x02 +#define R2_S 0x03 +#define R2_NS_AND_D 0x04 +#define R2_D 0x05 +#define R2_S_XOR_D 0x06 +#define R2_S_OR_D 0x07 +#define R2_NS_AND_ND 0x08 +#define R2_S_XOR_ND 0x09 +#define R2_ND 0x0A +#define R2_S_OR_ND 0x0B +#define R2_NS 0x0C +#define R2_NS_OR_D 0x0D +#define R2_NS_OR_ND 0x0E +#define R2_ONE 0x0F + +#define R3_S 0xF0 +#define R3_P 0xCC + + +#define COP_BASE 0xBF000 +#define COP_STAT 0x11 + COP_BASE + #define HBLTW_NOTREADY 0x01 + #define HOSTFF_NOTEMPTY 0x02 + #define CMDFF_FULL 0x04 + #define SUSPEND_COP 0x08 + #define COP_STOPPED 0x10 + #define TERMINATE_COP 0x20 + #define HBLT_NOTACKZ 0x40 + #define COP_BUSY 0x80 + +#define SRC1WIDTH 0x18 + COP_BASE +#define COPFMT 0x1C + COP_BASE +#define ERRORTERM 0x20 + COP_BASE +#define K1 0x24 + COP_BASE +#define K2 0x28 + COP_BASE +#define FMIX 0x48 + COP_BASE +#define BMIX 0x49 + COP_BASE +#define FCOLOR 0x58 + COP_BASE +#define BCOLOR 0x5C + COP_BASE +#define HEIGHTWIDTH 0x60 + COP_BASE +#define DIMW 0x60 + COP_BASE +#define DIMH 0x62 + COP_BASE +#define SRC1BASE 0x70 + COP_BASE +#define DSTXROT 0x78 + COP_BASE +#define DSTYROT 0x7A + COP_BASE +#define PATYROT 0x7A + COP_BASE +#define PIXOP 0x7C + COP_BASE +#define PIXOP_LO 0x7C + COP_BASE +#define PIXOP_HI 0x7E + COP_BASE + + /* Direction */ + #define YMAJOR 0x1 + #define DEC_Y 0x2 + #define DY_NEG 0x2 + #define DEC_X 0x4 + #define DX_NEG 0x4 + #define ERRORTERM_POS 0x8 + + /* Draw mode */ + #define DRAW_1ST_PIXEL_NULL 0x10 + #define DRAW_LAST_PIXEL_NULL 0x20 + #define DRAW_AREA_BOUND 0x30 + + /* transparent mode */ + #define TRANS_IS_SRC1 0x0000 + #define TRANS_IS_SRC2 0x0100 + #define TRANS_IS_DST 0x0200 + #define TRANS_INVERT 0x0400 + #define TRANS_ENABLE 0x0800 + + /* Cop Operation */ + #define PAT_OPAQUE_TEXTOUT 0x1000 + #define PAT_OPAQUE_TILE 0x2000 + #define PAT_OPAQUE_LINE 0x3000 + #define PAT_TRANS_TEXTOUT 0x5000 + #define PAT_TRANS_TILE 0x6000 + #define PAT_TRANS_LINE 0x7000 + #define PAT_FIXFGD 0x8000 + #define PAT_COLOR_TILE 0x9000 + + /* Host-Mem Direction */ + #define HOST_READ_SRC1 0x10000 + #define HOST_WRITE_SRC1 0x20000 + #define HOST_WRITE_SRC2 0x30000 + + /* Source2 Select */ + #define SRC2_IS_COLOR 0x000000 + #define SRC2_IS_OPAQUE_MONO 0x100000 + #define SRC2_IS_FGDCOLOR 0x200000 + #define SRC2_IS_TRANS_MONO 0x500000 + + /* Cop Command */ + #define COP_STEP_DRAW 0x4000000 + #define COP_LINE_DRAW 0x5000000 + #define COP_PXBLT 0x8000000 + #define COP_INVERT_PXBLT 0x9000000 + #define COP_PXBLT256 0xB000000 + + /* Fore&Back */ + #define FGD_IS_SRC1 0x20000000 + #define FGD_IS_COLOR 0x00000000 + #define BGD_IS_SRC1 0x80000000 + #define BGD_IS_COLOR 0x00000000 + +#define SRC2WIDTH 0x118 + COP_BASE +#define COPFLAGS 0x130 + COP_BASE + #define FMONO_ENABLE 0x10 + #define FMONO_DISABLE 0xEF + #define COP_1WS 0x4 + +#define FASTMONOSIZE 0x13C + COP_BASE +#define PATXROT 0x150 + COP_BASE +#define SRC1PTR 0x170 + COP_BASE +#define SRC2PTR 0x174 + COP_BASE +#define DSTPTR 0x178 + COP_BASE +#define DSTWIDTH 0x218 + COP_BASE + +/* ---------------------------------------------------------------------- */ + +#define PORT46E8 0x46E8 /* R */ +#define PORT102 0x102 /* R/W */ +#define MISCREAD 0x3CC /* R */ +#define MISCWRITE 0x3C2 /* W */ +#define SEQINDEX 0x3C4 /* R/W */ +#define SEQDATA 0x3C5 /* R/W */ +#define CRTINDEX 0x3D4 /* R/W */ +#define CRTDATA 0x3D5 /* R/W */ +#define ATTRRESET 0x3DA /* R/W */ +#define ATTRINDEX 0x3C0 /* R/W */ +#define ATTRDATAW 0x3C0 /* W, Attrib write data port */ +#define ATTRDATAR 0x3C1 /* R, Attrib read data port */ +#define GRAINDEX 0x3CE /* R/W */ +#define GRADATA 0x3CF /* R/W */ +#define RAMDACMASK 0x3C6 /* R/W, Mask register */ +#define RAMDACINDEXR 0x3C7 /* R/W, RAM read index port */ +#define RAMDACINDEXW 0x3C8 /* R/W, RAM write index port */ +#define RAMDACDATA 0x3C9 /* R/W, RAM Date port */ +#define IGS3CEINDEX 0x3CE /* R/W */ +#define IGS3CFDATA 0x3CF /* R/W */ +#define IGS3D4INDEX 0x3D4 /* R/W */ +#define IGS3D5DATA 0x3D5 /* R/W */ +#define IGS3C4INDEX 0x3C4 /* R/W */ +#define IGS3C5DATA 0x3C5 /* R/W */ + +#define SEQCOUNT 0x05 +#define MISCCOUNT 0x01 +#define CRTCOUNT 0x19 +#define ATTRCOUNT 0x15 +#define GRACOUNT 0x09 +#define EXTPARTIALCOUNT 8 /* define 8 extended regs for color depth change */ + +#define SREGCOUNT SEQCOUNT+MISCCOUNT+CRTCOUNT+ATTRCOUNT+GRACOUNT +#define EREGCOUNT EXTPARTIALCOUNT * 2 + 1 + + +#define PIXFORMAT_8BPP 0 +#define PIXFORMAT_16BPP 1 +#define PIXFORMAT_24BPP 2 + +#define VISUALID_256 1 +#define VISUALID_64K 2 +#define VISUALID_16M 4 +#define VISUALID_32K 6 + +#define FUNC_CTL 0x3c +#define FUNC_CTL_EXTREGENBL 0x80 /* enable access to 0xbcxxx */ + +#define BIU_BM_CONTROL 0x3e +#define BIU_BM_CONTROL_ENABLE 0x01 /* enable bus-master */ +#define BIU_BM_CONTROL_BURST 0x02 /* enable burst */ +#define BIU_BM_CONTROL_BACK2BACK 0x04 /* enable back to back */ + +#define X_V2_VID_MEM_START 0x40 +#define X_V2_VID_SRC_WIDTH 0x43 +#define X_V2_X_START 0x45 +#define X_V2_X_END 0x47 +#define X_V2_Y_START 0x49 +#define X_V2_Y_END 0x4b +#define X_V2_VID_SRC_WIN_WIDTH 0x4d + +#define Y_V2_DDA_X_INC 0x43 +#define Y_V2_DDA_Y_INC 0x47 +#define Y_V2_VID_FIFO_CTL 0x49 +#define Y_V2_VID_FMT 0x4b +#define Y_V2_VID_DISP_CTL1 0x4c +#define Y_V2_VID_FIFO_CTL1 0x4d + +#define J_X2_VID_MEM_START 0x40 +#define J_X2_VID_SRC_WIDTH 0x43 +#define J_X2_X_START 0x47 +#define J_X2_X_END 0x49 +#define J_X2_Y_START 0x4b +#define J_X2_Y_END 0x4d +#define J_X2_VID_SRC_WIN_WIDTH 0x4f + +#define K_X2_DDA_X_INIT 0x40 +#define K_X2_DDA_X_INC 0x42 +#define K_X2_DDA_Y_INIT 0x44 +#define K_X2_DDA_Y_INC 0x46 +#define K_X2_VID_FMT 0x48 +#define K_X2_VID_DISP_CTL1 0x49 + +#define K_CAP_X2_CTL1 0x49 + +#define CAP_X_START 0x60 +#define CAP_X_END 0x62 +#define CAP_Y_START 0x64 +#define CAP_Y_END 0x66 +#define CAP_DDA_X_INIT 0x68 +#define CAP_DDA_X_INC 0x6a +#define CAP_DDA_Y_INIT 0x6c +#define CAP_DDA_Y_INC 0x6e + +#define MEM_CTL2 0x72 +#define MEM_CTL2_SIZE_2MB 0x01 +#define MEM_CTL2_SIZE_4MB 0x02 +#define MEM_CTL2_SIZE_MASK 0x03 +#define MEM_CTL2_64BIT 0x04 + +#define EXT_FIFO_CTL 0x74 + +#define CAP_PIP_X_START 0x80 +#define CAP_PIP_X_END 0x82 +#define CAP_PIP_Y_START 0x84 +#define CAP_PIP_Y_END 0x86 + +#define CAP_NEW_CTL1 0x88 + +#define CAP_NEW_CTL2 0x89 + +#define BM_CTRL0 0x9c +#define BM_CTRL1 0x9d + +#define CAP_MODE1 0xa4 +#define CAP_MODE1_8BIT 0x01 /* enable 8bit capture mode */ +#define CAP_MODE1_CCIR656 0x02 /* CCIR656 mode */ +#define CAP_MODE1_IGNOREVGT 0x04 /* ignore VGT */ +#define CAP_MODE1_ALTFIFO 0x10 /* use alternate FIFO for capture */ +#define CAP_MODE1_SWAPUV 0x20 /* swap UV bytes */ +#define CAP_MODE1_MIRRORY 0x40 /* mirror vertically */ +#define CAP_MODE1_MIRRORX 0x80 /* mirror horizontally */ + +#define CAP_MODE2 0xa5 + +#define Y_TV_CTL 0xae + +#define EXT_MEM_START 0xc0 /* ext start address 21 bits */ +#define HOR_PHASE_SHIFT 0xc2 /* high 3 bits */ +#define EXT_SRC_WIDTH 0xc3 /* ext offset phase 10 bits */ +#define EXT_SRC_HEIGHT 0xc4 /* high 6 bits */ +#define EXT_X_START 0xc5 /* ext->screen, 16 bits */ +#define EXT_X_END 0xc7 /* ext->screen, 16 bits */ +#define EXT_Y_START 0xc9 /* ext->screen, 16 bits */ +#define EXT_Y_END 0xcb /* ext->screen, 16 bits */ +#define EXT_SRC_WIN_WIDTH 0xcd /* 8 bits */ +#define EXT_COLOUR_COMPARE 0xce /* 24 bits */ +#define EXT_DDA_X_INIT 0xd1 /* ext->screen 16 bits */ +#define EXT_DDA_X_INC 0xd3 /* ext->screen 16 bits */ +#define EXT_DDA_Y_INIT 0xd5 /* ext->screen 16 bits */ +#define EXT_DDA_Y_INC 0xd7 /* ext->screen 16 bits */ + +#define EXT_VID_FIFO_CTL 0xd9 + +#define EXT_VID_FMT 0xdb +#define EXT_VID_FMT_YUV422 0x00 /* formats - does this cause conversion? */ +#define EXT_VID_FMT_RGB555 0x01 +#define EXT_VID_FMT_RGB565 0x02 +#define EXT_VID_FMT_RGB888_24 0x03 +#define EXT_VID_FMT_RGB888_32 0x04 +#define EXT_VID_FMT_DUP_PIX_ZOON 0x08 /* duplicate pixel zoom */ +#define EXT_VID_FMT_MOD_3RD_PIX 0x20 /* modify 3rd duplicated pixel */ +#define EXT_VID_FMT_DBL_H_PIX 0x40 /* double horiz pixels */ +#define EXT_VID_FMT_UV128 0x80 /* UV data offset by 128 */ + +#define EXT_VID_DISP_CTL1 0xdc +#define EXT_VID_DISP_CTL1_INTRAM 0x01 /* video pixels go to internal RAM */ +#define EXT_VID_DISP_CTL1_IGNORE_CCOMP 0x02 /* ignore colour compare registers */ +#define EXT_VID_DISP_CTL1_NOCLIP 0x04 /* do not clip to 16235,16240 */ +#define EXT_VID_DISP_CTL1_UV_AVG 0x08 /* U/V data is averaged */ +#define EXT_VID_DISP_CTL1_Y128 0x10 /* Y data offset by 128 */ +#define EXT_VID_DISP_CTL1_VINTERPOL_OFF 0x20 /* vertical interpolation off */ +#define EXT_VID_DISP_CTL1_FULL_WIN 0x40 /* video out window full */ +#define EXT_VID_DISP_CTL1_ENABLE_WINDOW 0x80 /* enable video window */ + +#define EXT_VID_FIFO_CTL1 0xdd + +#define VFAC_CTL1 0xe8 +#define VFAC_CTL1_CAPTURE 0x01 /* capture enable */ +#define VFAC_CTL1_VFAC_ENABLE 0x02 /* vfac enable */ +#define VFAC_CTL1_FREEZE_CAPTURE 0x04 /* freeze capture */ +#define VFAC_CTL1_FREEZE_CAPTURE_SYNC 0x08 /* sync freeze capture */ +#define VFAC_CTL1_VALIDFRAME_SRC 0x10 /* select valid frame source */ +#define VFAC_CTL1_PHILIPS 0x40 /* select Philips mode */ +#define VFAC_CTL1_MODVINTERPOLCLK 0x80 /* modify vertical interpolation clocl */ + +#define VFAC_CTL2 0xe9 +#define VFAC_CTL2_INVERT_VIDDATAVALID 0x01 /* invert video data valid */ +#define VFAC_CTL2_INVERT_GRAPHREADY 0x02 /* invert graphic ready output sig */ +#define VFAC_CTL2_INVERT_DATACLK 0x04 /* invert data clock signal */ +#define VFAC_CTL2_INVERT_HSYNC 0x08 /* invert hsync input */ +#define VFAC_CTL2_INVERT_VSYNC 0x10 /* invert vsync input */ +#define VFAC_CTL2_INVERT_FRAME 0x20 /* invert frame odd/even input */ +#define VFAC_CTL2_INVERT_BLANK 0x40 /* invert blank output */ +#define VFAC_CTL2_INVERT_OVSYNC 0x80 /* invert other vsync input */ + +#define VFAC_CTL3 0xea +#define VFAC_CTL3_CAP_IRQ 0x40 /* enable capture interrupt */ + +#define CAP_MEM_START 0xeb /* 18 bits */ +#define CAP_MAP_WIDTH 0xed /* high 6 bits */ +#define CAP_PITCH 0xee /* 8 bits */ + +#define CAP_CTL_MISC 0xef +#define CAP_CTL_MISC_HDIV 0x01 +#define CAP_CTL_MISC_HDIV4 0x02 +#define CAP_CTL_MISC_ODDEVEN 0x04 +#define CAP_CTL_MISC_HSYNCDIV2 0x08 +#define CAP_CTL_MISC_SYNCTZHIGH 0x10 +#define CAP_CTL_MISC_SYNCTZOR 0x20 +#define CAP_CTL_MISC_DISPUSED 0x80 + +#define REG_BANK 0xfa +#define REG_BANK_X 0x00 +#define REG_BANK_Y 0x01 +#define REG_BANK_W 0x02 +#define REG_BANK_T 0x03 +#define REG_BANK_J 0x04 +#define REG_BANK_K 0x05 + +/* + * Bus-master + */ +#define BM_VID_ADDR_LOW 0xbc040 +#define BM_VID_ADDR_HIGH 0xbc044 +#define BM_ADDRESS_LOW 0xbc080 +#define BM_ADDRESS_HIGH 0xbc084 +#define BM_LENGTH 0xbc088 +#define BM_CONTROL 0xbc08c +#define BM_CONTROL_ENABLE 0x01 /* enable transfer */ +#define BM_CONTROL_IRQEN 0x02 /* enable IRQ at end of transfer */ +#define BM_CONTROL_INIT 0x04 /* initialise status & count */ +#define BM_COUNT 0xbc090 /* read-only */ + +/* + * Graphics Co-processor + */ +#define CO_CMD_L_PATTERN_FGCOL 0x8000 +#define CO_CMD_L_INC_LEFT 0x0004 +#define CO_CMD_L_INC_UP 0x0002 + +#define CO_CMD_H_SRC_PIXMAP 0x2000 +#define CO_CMD_H_BLITTER 0x0800 + +#define CO_REG_CONTROL 0xbf011 +#define CO_REG_SRC_WIDTH 0xbf018 +#define CO_REG_PIX_FORMAT 0xbf01c +#define CO_REG_FORE_MIX 0xbf048 +#define CO_REG_FOREGROUND 0xbf058 +#define CO_REG_WIDTH 0xbf060 +#define CO_REG_HEIGHT 0xbf062 +#define CO_REG_X_PHASE 0xbf078 +#define CO_REG_CMD_L 0xbf07c +#define CO_REG_CMD_H 0xbf07e +#define CO_REG_SRC_PTR 0xbf170 +#define CO_REG_DEST_PTR 0xbf178 +#define CO_REG_DEST_WIDTH 0xbf218 + +#endif + -- cgit