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/neomagic/Makefile.am | 35 ++ Source/DirectFB/gfxdrivers/neomagic/Makefile.in | 601 ++++++++++++++++++++++ Source/DirectFB/gfxdrivers/neomagic/neo2200.c | 570 ++++++++++++++++++++ Source/DirectFB/gfxdrivers/neomagic/neo_overlay.c | 349 +++++++++++++ Source/DirectFB/gfxdrivers/neomagic/neomagic.c | 223 ++++++++ Source/DirectFB/gfxdrivers/neomagic/neomagic.h | 147 ++++++ 6 files changed, 1925 insertions(+) create mode 100755 Source/DirectFB/gfxdrivers/neomagic/Makefile.am create mode 100755 Source/DirectFB/gfxdrivers/neomagic/Makefile.in create mode 100755 Source/DirectFB/gfxdrivers/neomagic/neo2200.c create mode 100755 Source/DirectFB/gfxdrivers/neomagic/neo_overlay.c create mode 100755 Source/DirectFB/gfxdrivers/neomagic/neomagic.c create mode 100755 Source/DirectFB/gfxdrivers/neomagic/neomagic.h (limited to 'Source/DirectFB/gfxdrivers/neomagic') diff --git a/Source/DirectFB/gfxdrivers/neomagic/Makefile.am b/Source/DirectFB/gfxdrivers/neomagic/Makefile.am new file mode 100755 index 0000000..24a850f --- /dev/null +++ b/Source/DirectFB/gfxdrivers/neomagic/Makefile.am @@ -0,0 +1,35 @@ +## Makefile.am for DirectFB/gfxdrivers/neomagic + +INCLUDES = \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/lib \ + -I$(top_srcdir)/lib \ + -I$(top_srcdir)/src + +neomagic_LTLIBRARIES = libdirectfb_neomagic.la + +if BUILD_STATIC +neomagic_DATA = $(neomagic_LTLIBRARIES:.la=.o) +endif + +neomagicdir = $(MODULEDIR)/gfxdrivers + +libdirectfb_neomagic_la_SOURCES = \ + neomagic.c \ + neomagic.h \ + neo_overlay.c \ + neo2200.c + +libdirectfb_neomagic_la_LDFLAGS = \ + -module \ + -avoid-version \ + $(DFB_LDFLAGS) + +libdirectfb_neomagic_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/neomagic/Makefile.in b/Source/DirectFB/gfxdrivers/neomagic/Makefile.in new file mode 100755 index 0000000..1613ab6 --- /dev/null +++ b/Source/DirectFB/gfxdrivers/neomagic/Makefile.in @@ -0,0 +1,601 @@ +# 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/neomagic +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)$(neomagicdir)" \ + "$(DESTDIR)$(neomagicdir)" +neomagicLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(neomagic_LTLIBRARIES) +libdirectfb_neomagic_la_DEPENDENCIES = \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/src/libdirectfb.la +am_libdirectfb_neomagic_la_OBJECTS = neomagic.lo neo_overlay.lo \ + neo2200.lo +libdirectfb_neomagic_la_OBJECTS = \ + $(am_libdirectfb_neomagic_la_OBJECTS) +libdirectfb_neomagic_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libdirectfb_neomagic_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_neomagic_la_SOURCES) +DIST_SOURCES = $(libdirectfb_neomagic_la_SOURCES) +neomagicDATA_INSTALL = $(INSTALL_DATA) +DATA = $(neomagic_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)/src + +neomagic_LTLIBRARIES = libdirectfb_neomagic.la +@BUILD_STATIC_TRUE@neomagic_DATA = $(neomagic_LTLIBRARIES:.la=.o) +neomagicdir = $(MODULEDIR)/gfxdrivers +libdirectfb_neomagic_la_SOURCES = \ + neomagic.c \ + neomagic.h \ + neo_overlay.c \ + neo2200.c + +libdirectfb_neomagic_la_LDFLAGS = \ + -module \ + -avoid-version \ + $(DFB_LDFLAGS) + +libdirectfb_neomagic_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/neomagic/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu gfxdrivers/neomagic/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-neomagicLTLIBRARIES: $(neomagic_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(neomagicdir)" || $(MKDIR_P) "$(DESTDIR)$(neomagicdir)" + @list='$(neomagic_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(neomagicLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(neomagicdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(neomagicLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(neomagicdir)/$$f"; \ + else :; fi; \ + done + +uninstall-neomagicLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(neomagic_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(neomagicdir)/$$p'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(neomagicdir)/$$p"; \ + done + +clean-neomagicLTLIBRARIES: + -test -z "$(neomagic_LTLIBRARIES)" || rm -f $(neomagic_LTLIBRARIES) + @list='$(neomagic_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_neomagic.la: $(libdirectfb_neomagic_la_OBJECTS) $(libdirectfb_neomagic_la_DEPENDENCIES) + $(libdirectfb_neomagic_la_LINK) -rpath $(neomagicdir) $(libdirectfb_neomagic_la_OBJECTS) $(libdirectfb_neomagic_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/neo2200.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/neo_overlay.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/neomagic.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-neomagicDATA: $(neomagic_DATA) + @$(NORMAL_INSTALL) + test -z "$(neomagicdir)" || $(MKDIR_P) "$(DESTDIR)$(neomagicdir)" + @list='$(neomagic_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(neomagicDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(neomagicdir)/$$f'"; \ + $(neomagicDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(neomagicdir)/$$f"; \ + done + +uninstall-neomagicDATA: + @$(NORMAL_UNINSTALL) + @list='$(neomagic_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(neomagicdir)/$$f'"; \ + rm -f "$(DESTDIR)$(neomagicdir)/$$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)$(neomagicdir)" "$(DESTDIR)$(neomagicdir)"; 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-generic clean-libtool clean-neomagicLTLIBRARIES \ + 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-neomagicDATA install-neomagicLTLIBRARIES + +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-neomagicDATA uninstall-neomagicLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-neomagicLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-neomagicDATA install-neomagicLTLIBRARIES 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-neomagicDATA \ + uninstall-neomagicLTLIBRARIES + +%.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/neomagic/neo2200.c b/Source/DirectFB/gfxdrivers/neomagic/neo2200.c new file mode 100755 index 0000000..4ac54ac --- /dev/null +++ b/Source/DirectFB/gfxdrivers/neomagic/neo2200.c @@ -0,0 +1,570 @@ +/* + (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 "neomagic.h" + +typedef volatile struct { + u32 bltStat; + u32 bltCntl; + u32 xpColor; + u32 fgColor; + u32 bgColor; + u32 pitch; + u32 clipLT; + u32 clipRB; + u32 srcBitOffset; + u32 srcStart; + u32 reserved0; + u32 dstStart; + u32 xyExt; + + u32 reserved1[19]; + + u32 pageCntl; + u32 pageBase; + u32 postBase; + u32 postPtr; + u32 dataPtr; +} Neo2200; + +typedef struct { + NeoDeviceData neo; + + int dstOrg; + int dstPitch; + int dstPixelWidth; + + int srcOrg; + int srcPitch; + int srcPixelWidth; + + u32 bltCntl; + + bool src_dst_equal; + + /* state validation */ + int n_bltMode_dst; + int n_src; + int n_fgColor; + int n_xpColor; +} Neo2200DeviceData; + +typedef struct { + NeoDriverData neo; + + Neo2200 *neo2200; +} Neo2200DriverData; + + +static inline void neo2200_waitidle( Neo2200DriverData *ndrv, + Neo2200DeviceData *ndev ) +{ + while (ndrv->neo2200->bltStat & 1) + ndev->neo.idle_waitcycles++; +} + +static inline void neo2200_waitfifo( Neo2200DriverData *ndrv, + Neo2200DeviceData *ndev, + int requested_fifo_space ) +{ + ndev->neo.waitfifo_calls++; + ndev->neo.waitfifo_sum += requested_fifo_space; + + /* FIXME: does not work + if (neo_fifo_space < requested_fifo_space) + { + neo_fifo_waitcycles++; + + while (1) + { + neo_fifo_space = (neo2200->bltStat >> 8); + if (neo_fifo_space >= requested_fifo_space) + break; + } + } + else + { + neo_fifo_cache_hits++; + } + + neo_fifo_space -= requested_fifo_space; + */ + + neo2200_waitidle( ndrv, ndev ); +} + + + +static inline void neo2200_validate_bltMode_dst( Neo2200DriverData *ndrv, + Neo2200DeviceData *ndev, + CoreSurface *dst, + CoreSurfaceBufferLock *lock ) +{ + int bltMode = 0; + + if (ndev->n_bltMode_dst) + return; + + switch (dst->config.format) + { + case DSPF_A8: + case DSPF_LUT8: + case DSPF_RGB332: + bltMode |= NEO_MODE1_DEPTH8; + break; + case DSPF_ARGB1555: + case DSPF_RGB16: + case DSPF_YUY2: + bltMode |= NEO_MODE1_DEPTH16; + break; + default: + D_BUG( "unexpected pixelformat!" ); + break; + } + + ndev->dstOrg = lock->offset; + ndev->dstPitch = lock->pitch; + ndev->dstPixelWidth = DFB_BYTES_PER_PIXEL(dst->config.format); + + + neo2200_waitfifo( ndrv, ndev, 2 ); + + ndrv->neo2200->bltStat = bltMode << 16; + ndrv->neo2200->pitch = (ndev->dstPitch << 16) | (ndev->srcPitch & 0xffff); + + + ndev->n_bltMode_dst = 1; +} + +static inline void neo2200_validate_src( Neo2200DriverData *ndrv, + Neo2200DeviceData *ndev, + CoreSurface *src, + CoreSurfaceBufferLock *lock ) +{ + if (ndev->n_src) + return; + + ndev->srcOrg = lock->offset; + ndev->srcPitch = lock->pitch; + ndev->srcPixelWidth = DFB_BYTES_PER_PIXEL(src->config.format); + + neo2200_waitfifo( ndrv, ndev, 1 ); + ndrv->neo2200->pitch = (ndev->dstPitch << 16) | (ndev->srcPitch & 0xffff); + + ndev->n_src = 1; +} + +static inline void neo2200_validate_fgColor( Neo2200DriverData *ndrv, + Neo2200DeviceData *ndev, + CardState *state ) +{ + if (ndev->n_fgColor) + return; + + neo2200_waitfifo( ndrv, ndev, 1 ); + + switch (state->destination->config.format) + { + case DSPF_A8: + ndrv->neo2200->fgColor = state->color.a; + break; + case DSPF_LUT8: + ndrv->neo2200->fgColor = state->color_index; + break; + case DSPF_RGB332: + ndrv->neo2200->fgColor = PIXEL_RGB332( state->color.r, + state->color.g, + state->color.b ); + break; + case DSPF_ARGB1555: + ndrv->neo2200->fgColor = PIXEL_ARGB1555( state->color.a, + state->color.r, + state->color.g, + state->color.b ); + break; + case DSPF_RGB16: + ndrv->neo2200->fgColor = PIXEL_RGB16( state->color.r, + state->color.g, + state->color.b ); + break; + default: + D_BUG( "unexpected pixelformat!" ); + break; + } + + ndev->n_fgColor = 1; +} + +static inline void neo2200_validate_xpColor( Neo2200DriverData *ndrv, + Neo2200DeviceData *ndev, + CardState *state ) +{ + if (ndev->n_xpColor) + return; + + neo2200_waitfifo( ndrv, ndev, 1 ); + + ndrv->neo2200->xpColor = state->src_colorkey; + + ndev->n_xpColor = 1; +} + + +/* required implementations */ + +static DFBResult neo2200EngineSync( void *drv, void *dev ) +{ + Neo2200DriverData *ndrv = (Neo2200DriverData*) drv; + Neo2200DeviceData *ndev = (Neo2200DeviceData*) dev; + + neo2200_waitidle( ndrv, ndev ); + + return DFB_OK; +} + +#define NEO_SUPPORTED_DRAWINGFLAGS \ + (DSDRAW_NOFX) + +#define NEO_SUPPORTED_DRAWINGFUNCTIONS \ + (DFXL_FILLRECTANGLE | DFXL_DRAWRECTANGLE) + +#define NEO_SUPPORTED_BLITTINGFLAGS \ + (DSBLIT_SRC_COLORKEY) + +#define NEO_SUPPORTED_BLITTINGFUNCTIONS \ + (DFXL_BLIT) + +static void neo2200CheckState( void *drv, void *dev, + CardState *state, DFBAccelerationMask accel ) +{ + switch (state->destination->config.format) + { + case DSPF_A8: + case DSPF_LUT8: + case DSPF_RGB332: + case DSPF_ARGB1555: + case DSPF_RGB16: + break; + case DSPF_YUY2: + if (accel == DFXL_BLIT) + break; + default: + return; + } + + if (DFB_DRAWING_FUNCTION(accel)) + { + /* if the function is supported and there are no other + drawing flags than the supported */ + if (!(accel & ~NEO_SUPPORTED_DRAWINGFUNCTIONS) && + !(state->drawingflags & ~NEO_SUPPORTED_DRAWINGFLAGS)) + state->accel |= accel; + } + else + { + /* if the function is supported, there are no other + blitting flags than the supported, the source and + destination formats are the same and the source and dest. + are different due to a blitting bug */ + if (!(accel & ~NEO_SUPPORTED_BLITTINGFUNCTIONS) && + !(state->blittingflags & ~NEO_SUPPORTED_BLITTINGFLAGS) && + state->source->config.format == state->destination->config.format) + state->accel |= accel; + } +} + +static void neo2200SetState( void *drv, void *dev, + GraphicsDeviceFuncs *funcs, + CardState *state, DFBAccelerationMask accel ) +{ + Neo2200DriverData *ndrv = (Neo2200DriverData*) drv; + Neo2200DeviceData *ndev = (Neo2200DeviceData*) dev; + + if (state->mod_hw & SMF_DESTINATION) + ndev->n_fgColor = ndev->n_bltMode_dst = 0; + else if (state->mod_hw & SMF_COLOR) + ndev->n_fgColor = 0; + + if (state->mod_hw & SMF_SOURCE) + ndev->n_src = 0; + + if (state->mod_hw & SMF_SRC_COLORKEY) + ndev->n_xpColor = 0; + + neo2200_validate_bltMode_dst( ndrv, ndev, state->destination, &state->dst ); + + switch (accel) { + case DFXL_BLIT: + neo2200_validate_src( ndrv, ndev, state->source, &state->src ); + + ndev->src_dst_equal = (state->src.buffer == + state->dst.buffer); + + if (state->blittingflags & DSBLIT_SRC_COLORKEY) { + ndev->bltCntl = NEO_BC0_SRC_TRANS; + neo2200_validate_xpColor( ndrv, ndev, state ); + } + else + ndev->bltCntl = 0; + + state->set |= DFXL_BLIT; + break; + + case DFXL_FILLRECTANGLE: + case DFXL_DRAWRECTANGLE: + neo2200_validate_fgColor( ndrv, ndev, state ); + + state->set |= DFXL_FILLRECTANGLE | DFXL_DRAWRECTANGLE; + break; + + default: + D_BUG( "unexpected drawing/blitting function!" ); + break; + } + + state->mod_hw = 0; +} + +static bool neo2200FillRectangle( void *drv, void *dev, DFBRectangle *rect ) +{ + Neo2200DriverData *ndrv = (Neo2200DriverData*) drv; + Neo2200DeviceData *ndev = (Neo2200DeviceData*) dev; + Neo2200 *neo2200 = ndrv->neo2200; + + neo2200_waitfifo( ndrv, ndev, 3 ); + + /* set blt control */ + neo2200->bltCntl = NEO_BC3_FIFO_EN | + NEO_BC0_SRC_IS_FG | + NEO_BC3_SKIP_MAPPING | 0x0c0000; + + neo2200->dstStart = ndev->dstOrg + + (rect->y * ndev->dstPitch) + + (rect->x * ndev->dstPixelWidth); + + neo2200->xyExt = (rect->h << 16) | (rect->w & 0xffff); + + return true; +} + +static bool neo2200DrawRectangle( void *drv, void *dev, DFBRectangle *rect ) +{ + Neo2200DriverData *ndrv = (Neo2200DriverData*) drv; + Neo2200DeviceData *ndev = (Neo2200DeviceData*) dev; + Neo2200 *neo2200 = ndrv->neo2200; + + u32 dst = ndev->dstOrg + + (rect->y * ndev->dstPitch) + + (rect->x * ndev->dstPixelWidth); + + neo2200_waitfifo( ndrv, ndev, 3 ); + + /* set blt control */ + neo2200->bltCntl = NEO_BC3_FIFO_EN | + NEO_BC0_SRC_IS_FG | + NEO_BC3_SKIP_MAPPING | 0x0c0000; + + neo2200->dstStart = dst; + neo2200->xyExt = (1 << 16) | (rect->w & 0xffff); + + + dst += (rect->h - 1) * ndev->dstPitch; + neo2200_waitfifo( ndrv, ndev, 2 ); + neo2200->dstStart = dst; + neo2200->xyExt = (1 << 16) | (rect->w & 0xffff); + + + dst -= (rect->h - 2) * ndev->dstPitch; + neo2200_waitfifo( ndrv, ndev, 2 ); + neo2200->dstStart = dst; + neo2200->xyExt = ((rect->h - 2) << 16) | 1; + + + dst += (rect->w - 1) * ndev->dstPixelWidth; + neo2200_waitfifo( ndrv, ndev, 2 ); + neo2200->dstStart = dst; + neo2200->xyExt = ((rect->h - 2) << 16) | 1; + + return true; +} + +static bool neo2200Blit( void *drv, void *dev, + DFBRectangle *rect, int dx, int dy ) +{ + Neo2200DriverData *ndrv = (Neo2200DriverData*) drv; + Neo2200DeviceData *ndev = (Neo2200DeviceData*) dev; + Neo2200 *neo2200 = ndrv->neo2200; + + u32 src_start, dst_start; + u32 bltCntl = ndev->bltCntl; + +// fprintf(stderr, "blit: %d, %d (%dx%d) -> %d, %d\n", +// rect->x, rect->y, rect->w, rect->h, dx, dy); + +/* if (rect->x < dx) { + //rect->x += rect->w - 1; + //dx += rect->w - 1; + + bltCntl |= NEO_BC0_X_DEC; + } + + if (rect->y < dy) { + //rect->y += rect->h - 1; + //dy += rect->h - 1; + + bltCntl |= NEO_BC0_DST_Y_DEC | NEO_BC0_SRC_Y_DEC; + } +*/ + /* ARGH, the above code for the blitting direction doesn't work. */ + if (ndev->src_dst_equal && (rect->x < dx || rect->y < dy)) + return false; + + src_start = rect->y * ndev->srcPitch + rect->x * ndev->srcPixelWidth; + dst_start = dy * ndev->dstPitch + dx * ndev->dstPixelWidth; + + neo2200_waitfifo( ndrv, ndev, 4 ); + + /* set blt control */ + neo2200->bltCntl = bltCntl | + NEO_BC3_FIFO_EN | + NEO_BC3_SKIP_MAPPING | 0x0c0000; + + /* set start addresses */ + neo2200->srcStart = ndev->srcOrg + src_start; + neo2200->dstStart = ndev->dstOrg + dst_start; + + /* set size */ + neo2200->xyExt = (rect->h << 16) | (rect->w & 0xffff); + + return true; +} + + + +void +neo2200_get_info( CoreGraphicsDevice *device, + GraphicsDriverInfo *info ) +{ + info->version.major = 0; + info->version.minor = 3; + + info->driver_data_size = sizeof (Neo2200DriverData); + info->device_data_size = sizeof (Neo2200DeviceData); +} + +DFBResult +neo2200_init_driver( CoreGraphicsDevice *device, + GraphicsDeviceFuncs *funcs, + void *driver_data ) +{ + Neo2200DriverData *ndrv = (Neo2200DriverData*) driver_data; + + ndrv->neo2200 = (Neo2200*) ndrv->neo.mmio_base; + + funcs->CheckState = neo2200CheckState; + funcs->SetState = neo2200SetState; + funcs->EngineSync = neo2200EngineSync; + + funcs->FillRectangle = neo2200FillRectangle; + funcs->DrawRectangle = neo2200DrawRectangle; + // funcs->DrawLine = neoDrawLine2D; + funcs->Blit = neo2200Blit; + // funcs->StretchBlit = neoStretchBlit; + + /* overlay support */ + dfb_layers_register( dfb_screens_at(DSCID_PRIMARY), + driver_data, &neoOverlayFuncs ); + return DFB_OK; +} + +DFBResult +neo2200_init_device( CoreGraphicsDevice *device, + GraphicsDeviceInfo *device_info, + void *driver_data, + void *device_data ) +{ + /* fill device info */ + snprintf( device_info->name, + DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "2200/2230/2360/2380" ); + + snprintf( device_info->vendor, + DFB_GRAPHICS_DEVICE_INFO_VENDOR_LENGTH, "NeoMagic" ); + + + device_info->caps.flags = 0; + device_info->caps.accel = NEO_SUPPORTED_DRAWINGFUNCTIONS | + NEO_SUPPORTED_BLITTINGFUNCTIONS; + device_info->caps.drawing = NEO_SUPPORTED_DRAWINGFLAGS; + device_info->caps.blitting = NEO_SUPPORTED_BLITTINGFLAGS; + + device_info->limits.surface_byteoffset_alignment = 32 * 4; + device_info->limits.surface_pixelpitch_alignment = 32; + + return DFB_OK; +} + +void +neo2200_close_device( CoreGraphicsDevice *device, + void *driver_data, + void *device_data ) +{ +} + +void +neo2200_close_driver( CoreGraphicsDevice *device, + void *driver_data ) +{ +} + diff --git a/Source/DirectFB/gfxdrivers/neomagic/neo_overlay.c b/Source/DirectFB/gfxdrivers/neomagic/neo_overlay.c new file mode 100755 index 0000000..b0d4c42 --- /dev/null +++ b/Source/DirectFB/gfxdrivers/neomagic/neo_overlay.c @@ -0,0 +1,349 @@ +/* + (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 "neomagic.h" + +typedef struct { + CoreLayerRegionConfig config; + + /* overlay registers */ + struct { + u32 OFFSET; + u16 PITCH; + u16 X1; + u16 X2; + u16 Y1; + u16 Y2; + u16 HSCALE; + u16 VSCALE; + u8 CONTROL; + } regs; +} NeoOverlayLayerData; + +static void ovl_set_regs ( NeoDriverData *ndrv, + NeoOverlayLayerData *novl ); +static void ovl_calc_regs( NeoDriverData *ndrv, + NeoOverlayLayerData *novl, + CoreLayerRegionConfig *config, + CoreSurface *surface, + CoreSurfaceBufferLock *lock ); + +#define NEO_OVERLAY_SUPPORTED_OPTIONS (DLOP_NONE) + +/**********************/ + +static int +ovlLayerDataSize( void ) +{ + return sizeof(NeoOverlayLayerData); +} + +static DFBResult +ovlInitLayer( CoreLayer *layer, + void *driver_data, + void *layer_data, + DFBDisplayLayerDescription *description, + DFBDisplayLayerConfig *default_config, + DFBColorAdjustment *default_adj ) +{ + /* set capabilities and type */ + description->caps = DLCAPS_SCREEN_LOCATION | DLCAPS_SURFACE | + DLCAPS_BRIGHTNESS; + description->type = DLTF_VIDEO | DLTF_STILL_PICTURE; + + /* set name */ + snprintf( description->name, + DFB_DISPLAY_LAYER_DESC_NAME_LENGTH, "NeoMagic Overlay" ); + + /* fill out the default configuration */ + default_config->flags = DLCONF_WIDTH | DLCONF_HEIGHT | + DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE | + DLCONF_OPTIONS; + default_config->width = 640; + default_config->height = 480; + default_config->pixelformat = DSPF_YUY2; + default_config->buffermode = DLBM_FRONTONLY; + default_config->options = DLOP_NONE; + + /* fill out default color adjustment, + only fields set in flags will be accepted from applications */ + default_adj->flags = DCAF_BRIGHTNESS; + default_adj->brightness = 0x8000; + + /* FIXME: use mmio */ + if (iopl(3) < 0) { + D_PERROR( "NeoMagic/Overlay: Could not change I/O permission level!\n" ); + return DFB_UNSUPPORTED; + } + + neo_unlock(); + + /* reset overlay */ + OUTGR(0xb0, 0x00); + + /* reset brightness */ + OUTGR(0xc4, 0x00); + + /* disable capture */ + OUTGR(0x0a, 0x21); + OUTSR(0x08, 0xa0); + OUTGR(0x0a, 0x01); + + neo_lock(); + + return DFB_OK; +} + + +static void +ovlOnOff( NeoDriverData *ndrv, + NeoOverlayLayerData *novl, + int on ) +{ + /* set/clear enable bit */ + if (on) + novl->regs.CONTROL = 0x01; + else + novl->regs.CONTROL = 0x00; + + /* FIXME: use mmio */ + if (iopl(3) < 0) { + D_PERROR( "NeoMagic/Overlay: Could not change I/O permission level!\n" ); + return; + } + + /* write back to card */ + neo_unlock(); + OUTGR(0xb0, novl->regs.CONTROL); + neo_lock(); +} + +static DFBResult +ovlTestRegion( CoreLayer *layer, + void *driver_data, + void *layer_data, + CoreLayerRegionConfig *config, + CoreLayerRegionConfigFlags *failed ) +{ + CoreLayerRegionConfigFlags fail = 0; + + /* check for unsupported options */ + if (config->options & ~NEO_OVERLAY_SUPPORTED_OPTIONS) + fail |= CLRCF_OPTIONS; + + /* check pixel format */ + switch (config->format) { + case DSPF_YUY2: + break; + + default: + fail |= CLRCF_FORMAT; + } + + /* check width */ + if (config->width > 1024 || config->width < 160) + 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 +ovlSetRegion( CoreLayer *layer, + void *driver_data, + void *layer_data, + void *region_data, + CoreLayerRegionConfig *config, + CoreLayerRegionConfigFlags updated, + CoreSurface *surface, + CorePalette *palette, + CoreSurfaceBufferLock *lock ) +{ + NeoDriverData *ndrv = (NeoDriverData*) driver_data; + NeoOverlayLayerData *novl = (NeoOverlayLayerData*) layer_data; + + /* remember configuration */ + novl->config = *config; + + ovl_calc_regs( ndrv, novl, config, surface, lock ); + ovl_set_regs( ndrv, novl ); + + /* enable overlay */ + ovlOnOff( ndrv, novl, config->opacity ); + + return DFB_OK; +} + +static DFBResult +ovlRemoveRegion( CoreLayer *layer, + void *driver_data, + void *layer_data, + void *region_data ) +{ + NeoDriverData *ndrv = (NeoDriverData*) driver_data; + NeoOverlayLayerData *novl = (NeoOverlayLayerData*) layer_data; + + /* disable overlay */ + ovlOnOff( ndrv, novl, 0 ); + + return DFB_OK; +} + +static DFBResult +ovlFlipRegion( CoreLayer *layer, + void *driver_data, + void *layer_data, + void *region_data, + CoreSurface *surface, + DFBSurfaceFlipFlags flags, + CoreSurfaceBufferLock *lock ) +{ + NeoDriverData *ndrv = (NeoDriverData*) driver_data; + NeoOverlayLayerData *novl = (NeoOverlayLayerData*) layer_data; +#if 0 + bool onsync = (flags & DSFLIP_WAITFORSYNC); + + if (onsync) + dfb_fbdev_wait_vsync(); +#endif + + dfb_surface_flip( surface, false ); + + ovl_calc_regs( ndrv, novl, &novl->config, surface, lock ); + ovl_set_regs( ndrv, novl ); + + return DFB_OK; +} + +static DFBResult +ovlSetColorAdjustment( CoreLayer *layer, + void *driver_data, + void *layer_data, + DFBColorAdjustment *adj ) +{ + /* FIXME: use mmio */ + if (iopl(3) < 0) { + D_PERROR( "NeoMagic/Overlay: Could not change I/O permission level!\n" ); + return DFB_UNSUPPORTED; + } + + neo_unlock(); + OUTGR(0xc4, (signed char)((adj->brightness >> 8) -128)); + neo_lock(); + + return DFB_OK; +} + + +DisplayLayerFuncs neoOverlayFuncs = { + .LayerDataSize = ovlLayerDataSize, + .InitLayer = ovlInitLayer, + .SetRegion = ovlSetRegion, + .RemoveRegion = ovlRemoveRegion, + .TestRegion = ovlTestRegion, + .FlipRegion = ovlFlipRegion, + .SetColorAdjustment = ovlSetColorAdjustment, +}; + + +/* internal */ + +static void ovl_set_regs( NeoDriverData *ndrv, NeoOverlayLayerData *novl ) +{ + /* FIXME: use mmio */ + if (iopl(3) < 0) { + D_PERROR( "NeoMagic/Overlay: Could not change I/O permission level!\n" ); + return; + } + + neo_unlock(); + + OUTGR(0xb1, ((novl->regs.X2 >> 4) & 0xf0) | (novl->regs.X1 >> 8)); + OUTGR(0xb2, novl->regs.X1); + OUTGR(0xb3, novl->regs.X2); + OUTGR(0xb4, ((novl->regs.Y2 >> 4) & 0xf0) | (novl->regs.Y1 >> 8)); + OUTGR(0xb5, novl->regs.Y1); + OUTGR(0xb6, novl->regs.Y2); + OUTGR(0xb7, novl->regs.OFFSET >> 16); + OUTGR(0xb8, novl->regs.OFFSET >> 8); + OUTGR(0xb9, novl->regs.OFFSET); + OUTGR(0xba, novl->regs.PITCH >> 8); + OUTGR(0xbb, novl->regs.PITCH); + OUTGR(0xbc, 0x2e); /* Neo2160: 0x4f */ + OUTGR(0xbd, 0x02); + OUTGR(0xbe, 0x00); + OUTGR(0xbf, 0x02); + + OUTGR(0xc0, novl->regs.HSCALE >> 8); + OUTGR(0xc1, novl->regs.HSCALE); + OUTGR(0xc2, novl->regs.VSCALE >> 8); + OUTGR(0xc3, novl->regs.VSCALE); + + neo_lock(); +} + +static void ovl_calc_regs( NeoDriverData *ndrv, + NeoOverlayLayerData *novl, + CoreLayerRegionConfig *config, + CoreSurface *surface, + CoreSurfaceBufferLock *lock ) +{ + /* fill register struct */ + novl->regs.X1 = config->dest.x; + novl->regs.X2 = config->dest.x + config->dest.w - 1; + + novl->regs.Y1 = config->dest.y; + novl->regs.Y2 = config->dest.y + config->dest.h - 1; + + novl->regs.OFFSET = lock->offset; + novl->regs.PITCH = lock->pitch; + + novl->regs.HSCALE = (surface->config.size.w << 12) / (config->dest.w + 1); + novl->regs.VSCALE = (surface->config.size.h << 12) / (config->dest.h + 1); +} + diff --git a/Source/DirectFB/gfxdrivers/neomagic/neomagic.c b/Source/DirectFB/gfxdrivers/neomagic/neomagic.c new file mode 100755 index 0000000..7eee15f --- /dev/null +++ b/Source/DirectFB/gfxdrivers/neomagic/neomagic.c @@ -0,0 +1,223 @@ +/* + (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( neomagic ) + +#include "neomagic.h" + +/* for fifo/performance monitoring */ +//unsigned int neo_fifo_space = 0; + + + +/* exported symbols */ + +static int +driver_probe( CoreGraphicsDevice *device ) +{ + switch (dfb_gfxcard_get_accelerator( device )) { + /* no support for other NeoMagic cards yet */ + case 95: /* NM2200 */ + case 96: /* NM2230 */ + case 97: /* NM2360 */ + case 98: /* NM2380 */ + 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, + "NeoMagic Driver" ); + + snprintf( info->vendor, + DFB_GRAPHICS_DRIVER_INFO_VENDOR_LENGTH, + "directfb.org" ); + + info->version.major = 0; + info->version.minor = 0; + + info->driver_data_size = sizeof (NeoDriverData); + info->device_data_size = sizeof (NeoDeviceData); + + switch (dfb_gfxcard_get_accelerator( device )) { + /* no support for other NeoMagic cards yet */ + case 95: /* NM2200 */ + case 96: /* NM2230 */ + case 97: /* NM2360 */ + case 98: /* NM2380 */ + neo2200_get_info( device, info ); + break; + } +} + + +static DFBResult +driver_init_driver( CoreGraphicsDevice *device, + GraphicsDeviceFuncs *funcs, + void *driver_data, + void *device_data, + CoreDFB *core ) +{ + NeoDriverData *ndrv = (NeoDriverData*) driver_data; + + ndrv->mmio_base = (volatile u8*) dfb_gfxcard_map_mmio( device, 0, -1 ); + if (!ndrv->mmio_base) + return DFB_IO; + + switch (dfb_gfxcard_get_accelerator( device )) { + /* no support for other NeoMagic cards yet */ + case 95: /* NM2200 */ + case 96: /* NM2230 */ + case 97: /* NM2360 */ + case 98: /* NM2380 */ + return neo2200_init_driver( device, funcs, driver_data ); + } + + return DFB_BUG; +} + +static DFBResult +driver_init_device( CoreGraphicsDevice *device, + GraphicsDeviceInfo *device_info, + void *driver_data, + void *device_data ) +{ + /* use polling for syncing, artefacts occur otherwise */ + dfb_config->pollvsync_after = 1; + + switch (dfb_gfxcard_get_accelerator( device )) { + /* no support for other NeoMagic cards yet */ + case 95: /* NM2200 */ + case 96: /* NM2230 */ + case 97: /* NM2360 */ + case 98: /* NM2380 */ + return neo2200_init_device( device, device_info, + driver_data, device_data ); + } + + return DFB_BUG; +} + +static void +driver_close_device( CoreGraphicsDevice *device, + void *driver_data, + void *device_data ) +{ + NeoDeviceData *ndev = (NeoDeviceData*) device_data; + + (void) ndev; + + switch (dfb_gfxcard_get_accelerator( device )) { + /* no support for other NeoMagic cards yet */ + case 95: /* NM2200 */ + case 96: /* NM2230 */ + case 97: /* NM2360 */ + case 98: /* NM2380 */ + neo2200_close_device( device, driver_data, device_data ); + } + + D_DEBUG( "DirectFB/NEO: FIFO Performance Monitoring:\n" ); + D_DEBUG( "DirectFB/NEO: %9d neo_waitfifo calls\n", + ndev->waitfifo_calls ); + D_DEBUG( "DirectFB/NEO: %9d register writes (neo_waitfifo sum)\n", + ndev->waitfifo_sum ); + D_DEBUG( "DirectFB/NEO: %9d FIFO wait cycles (depends on CPU)\n", + ndev->fifo_waitcycles ); + D_DEBUG( "DirectFB/NEO: %9d IDLE wait cycles (depends on CPU)\n", + ndev->idle_waitcycles ); + D_DEBUG( "DirectFB/NEO: %9d FIFO space cache hits(depends on CPU)\n", + ndev->fifo_cache_hits ); + D_DEBUG( "DirectFB/NEO: Conclusion:\n" ); + D_DEBUG( "DirectFB/NEO: Average register writes/neo_waitfifo" + "call:%.2f\n", + ndev->waitfifo_sum/(float)(ndev->waitfifo_calls) ); + D_DEBUG( "DirectFB/NEO: Average wait cycles/neo_waitfifo call:" + " %.2f\n", + ndev->fifo_waitcycles/(float)(ndev->waitfifo_calls) ); + D_DEBUG( "DirectFB/NEO: Average fifo space cache hits: %02d%%\n", + (int)(100 * ndev->fifo_cache_hits/ + (float)(ndev->waitfifo_calls)) ); +} + +static void +driver_close_driver( CoreGraphicsDevice *device, + void *driver_data ) +{ + NeoDriverData *ndrv = (NeoDriverData*) driver_data; + + switch (dfb_gfxcard_get_accelerator( device )) { + /* no support for other NeoMagic cards yet */ + case 95: /* NM2200 */ + case 96: /* NM2230 */ + case 97: /* NM2360 */ + case 98: /* NM2380 */ + neo2200_close_driver( device, driver_data ); + } + + dfb_gfxcard_unmap_mmio( device, ndrv->mmio_base, -1 ); +} + diff --git a/Source/DirectFB/gfxdrivers/neomagic/neomagic.h b/Source/DirectFB/gfxdrivers/neomagic/neomagic.h new file mode 100755 index 0000000..d388faf --- /dev/null +++ b/Source/DirectFB/gfxdrivers/neomagic/neomagic.h @@ -0,0 +1,147 @@ +/* + (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 __NEOMAGIC_H__ +#define __NEOMAGIC_H__ + +#include +#include + +#include +#include + +typedef struct { + unsigned int waitfifo_sum; + unsigned int waitfifo_calls; + unsigned int fifo_waitcycles; + unsigned int idle_waitcycles; + unsigned int fifo_cache_hits; +} NeoDeviceData; + +typedef struct { + volatile u8 *mmio_base; +} NeoDriverData; + +extern DisplayLayerFuncs neoOverlayFuncs; + +void +neo2200_get_info( CoreGraphicsDevice *device, + GraphicsDriverInfo *info ); + +DFBResult +neo2200_init_driver( CoreGraphicsDevice *device, + GraphicsDeviceFuncs *funcs, + void *driver_data ); + +DFBResult +neo2200_init_device( CoreGraphicsDevice *device, + GraphicsDeviceInfo *device_info, + void *driver_data, + void *device_data ); + +void +neo2200_close_device( CoreGraphicsDevice *device, + void *driver_data, + void *device_data ); + +void +neo2200_close_driver( CoreGraphicsDevice *device, + void *driver_data ); + + +#define NEO_BS0_BLT_BUSY 0x00000001 +#define NEO_BS0_FIFO_AVAIL 0x00000002 +#define NEO_BS0_FIFO_PEND 0x00000004 + +#define NEO_BC0_DST_Y_DEC 0x00000001 +#define NEO_BC0_X_DEC 0x00000002 +#define NEO_BC0_SRC_TRANS 0x00000004 +#define NEO_BC0_SRC_IS_FG 0x00000008 +#define NEO_BC0_SRC_Y_DEC 0x00000010 +#define NEO_BC0_FILL_PAT 0x00000020 +#define NEO_BC0_SRC_MONO 0x00000040 +#define NEO_BC0_SYS_TO_VID 0x00000080 + +#define NEO_BC1_DEPTH8 0x00000100 +#define NEO_BC1_DEPTH16 0x00000200 +#define NEO_BC1_X_320 0x00000400 +#define NEO_BC1_X_640 0x00000800 +#define NEO_BC1_X_800 0x00000c00 +#define NEO_BC1_X_1024 0x00001000 +#define NEO_BC1_X_1152 0x00001400 +#define NEO_BC1_X_1280 0x00001800 +#define NEO_BC1_X_1600 0x00001c00 +#define NEO_BC1_DST_TRANS 0x00002000 +#define NEO_BC1_MSTR_BLT 0x00004000 +#define NEO_BC1_FILTER_Z 0x00008000 + +#define NEO_BC2_WR_TR_DST 0x00800000 + +#define NEO_BC3_SRC_XY_ADDR 0x01000000 +#define NEO_BC3_DST_XY_ADDR 0x02000000 +#define NEO_BC3_CLIP_ON 0x04000000 +#define NEO_BC3_FIFO_EN 0x08000000 +#define NEO_BC3_BLT_ON_ADDR 0x10000000 +#define NEO_BC3_SKIP_MAPPING 0x80000000 + +#define NEO_MODE1_DEPTH8 0x0100 +#define NEO_MODE1_DEPTH16 0x0200 +#define NEO_MODE1_DEPTH24 0x0300 +#define NEO_MODE1_X_320 0x0400 +#define NEO_MODE1_X_640 0x0800 +#define NEO_MODE1_X_800 0x0c00 +#define NEO_MODE1_X_1024 0x1000 +#define NEO_MODE1_X_1152 0x1400 +#define NEO_MODE1_X_1280 0x1800 +#define NEO_MODE1_X_1600 0x1c00 +#define NEO_MODE1_BLT_ON_ADDR 0x2000 + + +static inline void OUTGR (u8 index, u8 data) +{ + outb (index, 0x3ce); + outb (data, 0x3cf); +} + +static inline void OUTSR (u8 index, u8 data) +{ + outb (index, 0x3c4); + outb (data, 0x3c5); +} + +static inline void neo_lock( void ) +{ + OUTGR(0x09, 0x00); +} + +static inline void neo_unlock( void ) +{ + OUTGR(0x09, 0x26); +} + +#endif -- cgit