summaryrefslogtreecommitdiff
path: root/Source/DirectFB/gfxdrivers/i830
diff options
context:
space:
mode:
Diffstat (limited to 'Source/DirectFB/gfxdrivers/i830')
-rwxr-xr-xSource/DirectFB/gfxdrivers/i830/Makefile.am35
-rwxr-xr-xSource/DirectFB/gfxdrivers/i830/Makefile.in597
-rwxr-xr-xSource/DirectFB/gfxdrivers/i830/i830.c635
-rwxr-xr-xSource/DirectFB/gfxdrivers/i830/i830.h406
-rwxr-xr-xSource/DirectFB/gfxdrivers/i830/i830_overlay.c807
5 files changed, 2480 insertions, 0 deletions
diff --git a/Source/DirectFB/gfxdrivers/i830/Makefile.am b/Source/DirectFB/gfxdrivers/i830/Makefile.am
new file mode 100755
index 0000000..115f671
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/i830/Makefile.am
@@ -0,0 +1,35 @@
+## Makefile.am for DirectFB/src/core/gfxcards/i830
+
+INCLUDES = \
+ -I$(top_builddir)/include \
+ -I$(top_srcdir)/include \
+ -I$(top_builddir)/lib \
+ -I$(top_srcdir)/lib \
+ -I$(top_srcdir)/src \
+ -I$(top_srcdir)/systems
+
+i830_LTLIBRARIES = libdirectfb_i830.la
+
+if BUILD_STATIC
+i830_DATA = $(i830_LTLIBRARIES:.la=.o)
+endif
+
+i830dir = $(MODULEDIR)/gfxdrivers
+
+libdirectfb_i830_la_SOURCES = \
+ i830.c \
+ i830.h \
+ i830_overlay.c
+
+libdirectfb_i830_la_LDFLAGS = \
+ -module \
+ -avoid-version \
+ $(DFB_LDFLAGS)
+
+libdirectfb_i830_la_LIBADD = -lm \
+ $(top_builddir)/lib/direct/libdirect.la \
+ $(top_builddir)/src/libdirectfb.la
+
+
+include $(top_srcdir)/rules/libobject.make
+
diff --git a/Source/DirectFB/gfxdrivers/i830/Makefile.in b/Source/DirectFB/gfxdrivers/i830/Makefile.in
new file mode 100755
index 0000000..926c125
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/i830/Makefile.in
@@ -0,0 +1,597 @@
+# 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/i830
+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)$(i830dir)" "$(DESTDIR)$(i830dir)"
+i830LTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(i830_LTLIBRARIES)
+libdirectfb_i830_la_DEPENDENCIES = \
+ $(top_builddir)/lib/direct/libdirect.la \
+ $(top_builddir)/src/libdirectfb.la
+am_libdirectfb_i830_la_OBJECTS = i830.lo i830_overlay.lo
+libdirectfb_i830_la_OBJECTS = $(am_libdirectfb_i830_la_OBJECTS)
+libdirectfb_i830_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libdirectfb_i830_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_i830_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_i830_la_SOURCES)
+i830DATA_INSTALL = $(INSTALL_DATA)
+DATA = $(i830_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 \
+ -I$(top_srcdir)/systems
+
+i830_LTLIBRARIES = libdirectfb_i830.la
+@BUILD_STATIC_TRUE@i830_DATA = $(i830_LTLIBRARIES:.la=.o)
+i830dir = $(MODULEDIR)/gfxdrivers
+libdirectfb_i830_la_SOURCES = \
+ i830.c \
+ i830.h \
+ i830_overlay.c
+
+libdirectfb_i830_la_LDFLAGS = \
+ -module \
+ -avoid-version \
+ $(DFB_LDFLAGS)
+
+libdirectfb_i830_la_LIBADD = -lm \
+ $(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/i830/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu gfxdrivers/i830/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-i830LTLIBRARIES: $(i830_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(i830dir)" || $(MKDIR_P) "$(DESTDIR)$(i830dir)"
+ @list='$(i830_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(i830LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(i830dir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(i830LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(i830dir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-i830LTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(i830_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(i830dir)/$$p'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(i830dir)/$$p"; \
+ done
+
+clean-i830LTLIBRARIES:
+ -test -z "$(i830_LTLIBRARIES)" || rm -f $(i830_LTLIBRARIES)
+ @list='$(i830_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_i830.la: $(libdirectfb_i830_la_OBJECTS) $(libdirectfb_i830_la_DEPENDENCIES)
+ $(libdirectfb_i830_la_LINK) -rpath $(i830dir) $(libdirectfb_i830_la_OBJECTS) $(libdirectfb_i830_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i830.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i830_overlay.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-i830DATA: $(i830_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(i830dir)" || $(MKDIR_P) "$(DESTDIR)$(i830dir)"
+ @list='$(i830_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(i830DATA_INSTALL) '$$d$$p' '$(DESTDIR)$(i830dir)/$$f'"; \
+ $(i830DATA_INSTALL) "$$d$$p" "$(DESTDIR)$(i830dir)/$$f"; \
+ done
+
+uninstall-i830DATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(i830_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(i830dir)/$$f'"; \
+ rm -f "$(DESTDIR)$(i830dir)/$$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)$(i830dir)" "$(DESTDIR)$(i830dir)"; 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-i830LTLIBRARIES 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-i830DATA install-i830LTLIBRARIES
+
+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-i830DATA uninstall-i830LTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-i830LTLIBRARIES 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-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-i830DATA install-i830LTLIBRARIES \
+ 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-i830DATA \
+ uninstall-i830LTLIBRARIES
+
+%.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/i830/i830.c b/Source/DirectFB/gfxdrivers/i830/i830.c
new file mode 100755
index 0000000..895b16d
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/i830/i830.c
@@ -0,0 +1,635 @@
+/*
+ Intel i830 DirectFB graphics driver
+
+ (c) Copyright 2005 Servision Ltd.
+ http://www.servision.net/
+
+ All rights reserved.
+
+ Based on i810 driver written by Antonino Daplas <adaplas@pol.net>
+
+ 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 <config.h>
+
+#include <fbdev/fbdev.h> /* FIXME: Needs to be included before dfb_types.h to work around a type clash with asm/types.h */
+
+#include "i830.h"
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <sys/mman.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <malloc.h>
+
+#include <directfb.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/screens.h>
+
+#include <core/state.h>
+#include <core/gfxcard.h>
+#include <core/surface.h>
+
+/* need fb handle to get accel, MMIO programming in the i830 is useless */
+#include <fbdev/fbdev.h>
+#include <gfx/convert.h>
+#include <gfx/util.h>
+#include <misc/conf.h>
+#include <misc/util.h>
+
+#include <core/graphics_driver.h>
+
+DFB_GRAPHICS_DRIVER( i830 )
+
+
+/**************************************************************************************************/
+
+#define TIMER_LOOP 1000000000
+#define BUFFER_PADDING 2
+#define MMIO_SIZE 512 * 1024
+
+#define I830_SUPPORTED_DRAWINGFLAGS (DSDRAW_NOFX)
+
+#define I830_SUPPORTED_DRAWINGFUNCTIONS (DFXL_NONE)
+
+#define I830_SUPPORTED_BLITTINGFLAGS (DSBLIT_NOFX)
+
+#define I830_SUPPORTED_BLITTINGFUNCTIONS (DFXL_NONE)
+
+/**************************************************************************************************/
+
+static void
+i830_lring_enable( I830DriverData *idrv, u32 mode )
+{
+ u32 tmp;
+
+ D_DEBUG_AT( I830_Ring, "%s lp ring...\n", mode ? "Enabling" : "Disabling" );
+
+ tmp = i830_readl(idrv->mmio_base, LP_RING + RING_LEN);
+ tmp = (!mode) ? tmp & ~1 : tmp | 1;
+
+ i830_writel( idrv->mmio_base, LP_RING + RING_LEN, tmp );
+}
+
+
+static inline void
+i830_wait_for_blit_idle( I830DriverData *idrv,
+ I830DeviceData *idev )
+{
+ u32 count = 0;
+ u32 head , tail;
+
+ if (idev != NULL)
+ idev->idle_calls++;
+
+ head = i830_readl(idrv->mmio_base, LP_RING + RING_HEAD) & I830_HEAD_MASK;
+ tail = i830_readl(idrv->mmio_base, LP_RING + RING_TAIL) & I830_TAIL_MASK;
+ while ((head != tail) && (count++ < TIMER_LOOP)) {
+ if (idev != NULL)
+ idev->idle_waitcycles++;
+ head = i830_readl(idrv->mmio_base, LP_RING + RING_HEAD) & I830_HEAD_MASK;
+ tail = i830_readl(idrv->mmio_base, LP_RING + RING_TAIL) & I830_TAIL_MASK;
+ }
+
+ if (count >= TIMER_LOOP) {
+ if (idev != NULL)
+ idev->idle_timeoutsum++;
+ D_BUG("warning: idle timeout exceeded");
+ }
+}
+
+static void
+i830_init_ringbuffer( I830DriverData *idrv,
+ I830DeviceData *idev )
+{
+ u32 ring_enabled;
+
+ D_DEBUG_AT( I830_Ring, "Previous lp ring config: 0x%08x, 0x%08x, 0x%08x, 0x%08x\n",
+ i830_readl(idrv->mmio_base, LP_RING),
+ i830_readl(idrv->mmio_base, LP_RING + RING_HEAD),
+ i830_readl(idrv->mmio_base, LP_RING + RING_START),
+ i830_readl(idrv->mmio_base, LP_RING + RING_LEN) );
+
+ ring_enabled = i830_readl(idrv->mmio_base, LP_RING + RING_LEN) & 1;
+ if (ring_enabled)
+ i830_wait_for_blit_idle(idrv, idev);
+ i830_lring_enable(idrv, 0);
+
+ idev->lring1 = i830_readl(idrv->mmio_base, LP_RING);
+ idev->lring2 = i830_readl(idrv->mmio_base, LP_RING + RING_HEAD);
+ idev->lring3 = i830_readl(idrv->mmio_base, LP_RING + RING_START);
+ idev->lring4 = i830_readl(idrv->mmio_base, LP_RING + RING_LEN);
+
+ D_FLAGS_SET( idrv->flags, I830RES_STATE_SAVE );
+
+ i830_writel(idrv->mmio_base, LP_RING + RING_LEN, 0);
+ i830_writel(idrv->mmio_base, LP_RING + RING_HEAD, 0);
+ i830_writel(idrv->mmio_base, LP_RING + RING_TAIL, 0);
+ i830_writel(idrv->mmio_base, LP_RING + RING_START, 0);
+
+ D_DEBUG_AT( I830_Ring, "INST_DONE: 0x%04x\n", i830_readw(idrv->mmio_base, INST_DONE) );
+
+
+ idev->lp_ring.size = RINGBUFFER_SIZE;
+ idev->lp_ring.tail_mask = idev->lp_ring.size - 1;
+
+ i830_writel( idrv->mmio_base, LP_RING + RING_START,
+ (idev->lring_bind.pg_start * 4096) & I830_RING_START_MASK );
+
+ i830_writel( idrv->mmio_base, LP_RING + RING_LEN,
+ (idev->lp_ring.size - 4096) & I830_RING_NR_PAGES );
+
+ i830_lring_enable(idrv, 1);
+
+ D_DEBUG_AT( I830_Ring, "Wrote lp ring config: 0x%08x, 0x%08x, 0x%08x, 0x%08x\n",
+ i830_readl(idrv->mmio_base, LP_RING),
+ i830_readl(idrv->mmio_base, LP_RING + RING_HEAD),
+ i830_readl(idrv->mmio_base, LP_RING + RING_START),
+ i830_readl(idrv->mmio_base, LP_RING + RING_LEN) );
+}
+
+DFBResult
+i830_wait_lp_ring( I830DriverData *idrv,
+ I830DeviceData *idev,
+ int space )
+{
+ I830RingBuffer *buf = &idev->lp_ring;
+
+ idev->waitfifo_calls++;
+ idev->waitfifo_sum += space;
+
+ D_DEBUG_AT( I830_Ring, "Waiting for %d...\n", space );
+
+ if (buf->space < space) {
+ int head = 0;
+ int loops = 0;
+
+ do {
+ idev->fifo_waitcycles++;
+
+ if (loops++ > 100000000) {
+ D_ERROR( "timeout waiting for ring buffer space\n" );
+ return DFB_TIMEOUT;
+ }
+
+ buf->head = i830_readl( idrv->mmio_base,
+ LP_RING + RING_HEAD ) & I830_HEAD_MASK;
+ buf->space = buf->head - (buf->tail + 8);
+
+ if (buf->space < 0)
+ buf->space += buf->size;
+
+ //D_DEBUG_AT( I830_Ring, "... have %d space\n", buf->space );
+
+ if (buf->head != head)
+ loops = 0;
+
+ head = buf->head;
+ } while (buf->space < space);
+ }
+ else
+ idev->fifo_cache_hits++;
+
+ return DFB_OK;
+}
+
+/**************************************************************************************************/
+
+static void
+i830FlushTextureCache( void *drv, void *dev )
+{
+ I830DriverData *idrv = drv;
+ I830DeviceData *idev = dev;
+ I830RingBlock block = { .virt = NULL };
+
+ if (i830_begin_lp_ring( idrv, idev, 2, &block ))
+ return;
+
+ i830_out_ring( &block, MI_FLUSH );
+ i830_out_ring( &block, MI_NOOP );
+
+ i830_advance_lp_ring( idrv, idev, &block );
+}
+
+static DFBResult
+i830EngineSync( void *drv, void *dev )
+{
+ I830DriverData *idrv = drv;
+ I830DeviceData *idev = dev;
+
+ i830_wait_for_blit_idle( idrv, idev );
+
+ return DFB_OK;
+}
+
+/**************************************************************************************************/
+
+static void
+i830CheckState(void *drv, void *dev,
+ CardState *state, DFBAccelerationMask accel )
+{
+ switch (state->destination->config.format) {
+ default:
+ return;
+ }
+
+ if (!(accel & ~I830_SUPPORTED_DRAWINGFUNCTIONS) &&
+ !(state->drawingflags & ~I830_SUPPORTED_DRAWINGFLAGS))
+ state->accel |= I830_SUPPORTED_DRAWINGFUNCTIONS;
+
+ if (!(accel & ~I830_SUPPORTED_BLITTINGFUNCTIONS) &&
+ !(state->blittingflags & ~I830_SUPPORTED_BLITTINGFLAGS)) {
+ if (state->source->config.format == state->destination->config.format)
+ state->accel |= I830_SUPPORTED_BLITTINGFUNCTIONS;
+ }
+}
+
+static void
+i830SetState( void *drv, void *dev,
+ GraphicsDeviceFuncs *funcs,
+ CardState *state, DFBAccelerationMask accel )
+{
+ switch (accel) {
+ default:
+ D_BUG("unexpected drawing/blitting function");
+ }
+
+ state->mod_hw = 0;
+}
+
+/**************************************************************************************************/
+
+static int
+driver_probe( CoreGraphicsDevice *device )
+{
+ switch (dfb_gfxcard_get_accelerator( device )) {
+ case FB_ACCEL_I830: /* Intel 830 */
+ 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,
+ "Intel 830/845G/852GM/855GM/865G Driver" );
+
+ snprintf( info->vendor,
+ DFB_GRAPHICS_DRIVER_INFO_VENDOR_LENGTH,
+ "Denis Oliver Kropp" );
+
+ info->version.major = 0;
+ info->version.minor = 1;
+
+ info->driver_data_size = sizeof (I830DriverData);
+ info->device_data_size = sizeof (I830DeviceData);
+}
+
+static void
+i830_release_resource( I830DriverData *idrv, I830DeviceData *idev )
+{
+ agp_unbind unbind;
+
+ if (idrv->flags & I830RES_STATE_SAVE) {
+ i830_writel( idrv->mmio_base, LP_RING, idev->lring1 );
+ i830_writel( idrv->mmio_base, LP_RING + RING_HEAD, idev->lring2 );
+ i830_writel( idrv->mmio_base, LP_RING + RING_START, idev->lring3 );
+ i830_writel( idrv->mmio_base, LP_RING + RING_LEN, idev->lring4 );
+ }
+
+ if (idrv->flags & I830RES_MMAP) {
+ munmap((void *) idrv->aper_base, idev->info.aper_size * 1024 * 1024);
+ idrv->flags &= ~I830RES_MMAP;
+ }
+
+ if (idrv->flags & I830RES_LRING_BIND) {
+ unbind.key = idev->lring_bind.key;
+ ioctl(idrv->agpgart, AGPIOC_UNBIND, &unbind);
+ }
+
+ if (idrv->flags & I830RES_LRING_ACQ)
+ ioctl(idrv->agpgart, AGPIOC_DEALLOCATE, idev->lring_mem.key);
+
+ if (idrv->flags & I830RES_OVL_BIND) {
+ unbind.key = idev->ovl_bind.key;
+ ioctl(idrv->agpgart, AGPIOC_UNBIND, &unbind);
+ }
+
+ if (idrv->flags & I830RES_OVL_ACQ)
+ ioctl(idrv->agpgart, AGPIOC_DEALLOCATE, idev->ovl_mem.key);
+
+ if (idrv->flags & I830RES_GART_ACQ) {
+ ioctl(idrv->agpgart, AGPIOC_RELEASE);
+ idrv->flags &= ~I830RES_GART_ACQ;
+ }
+
+ if (idrv->flags & I830RES_GART) {
+ close(idrv->agpgart);
+ idrv->flags &= ~I830RES_GART;
+ }
+}
+
+static DFBResult
+i830_agp_setup( CoreGraphicsDevice *device,
+ I830DriverData *idrv,
+ I830DeviceData *idev )
+{
+ idrv->agpgart = open("/dev/agpgart", O_RDWR);
+ if (idrv->agpgart == -1)
+ return DFB_IO;
+ D_FLAGS_SET( idrv->flags, I830RES_GART );
+
+
+ if (ioctl(idrv->agpgart, AGPIOC_ACQUIRE)) {
+ D_PERROR( "I830/AGP: AGPIOC_ACQUIRE failed!\n" );
+ return DFB_IO;
+ }
+ D_FLAGS_SET( idrv->flags, I830RES_GART_ACQ );
+
+
+ if (!idev->initialized) {
+ agp_setup setup;
+
+ setup.agp_mode = 0;
+ if (ioctl(idrv->agpgart, AGPIOC_SETUP, &setup)) {
+ D_PERROR( "I830/AGP: AGPIOC_SETUP failed!\n" );
+ return DFB_IO;
+ }
+
+ if (ioctl(idrv->agpgart, AGPIOC_INFO, &idev->info)) {
+ D_PERROR( "I830/AGP: AGPIOC_INFO failed!\n" );
+ return DFB_IO;
+ }
+ }
+
+
+ idrv->aper_base = mmap( NULL, idev->info.aper_size * 1024 * 1024, PROT_WRITE,
+ MAP_SHARED, idrv->agpgart, 0 );
+ if (idrv->aper_base == MAP_FAILED) {
+ D_PERROR( "I830/AGP: mmap() failed!\n" );
+ i830_release_resource( idrv, idev );
+ return DFB_IO;
+ }
+ D_FLAGS_SET( idrv->flags, I830RES_MMAP );
+
+
+ if (!idev->initialized) {
+ u32 base;
+
+ /* We'll attempt to bind at fb_base + fb_len + 1 MB,
+ to be safe */
+ base = dfb_gfxcard_memory_physical(device, 0) - idev->info.aper_base;
+ base += dfb_gfxcard_memory_length();
+ base += (1024 * 1024);
+
+ idev->lring_mem.pg_count = RINGBUFFER_SIZE/4096;
+ idev->lring_mem.type = AGP_NORMAL_MEMORY;
+ if (ioctl(idrv->agpgart, AGPIOC_ALLOCATE, &idev->lring_mem)) {
+ D_PERROR( "I830/AGP: AGPIOC_ALLOCATE failed!\n" );
+ i830_release_resource( idrv, idev );
+ return DFB_IO;
+ }
+ D_FLAGS_SET( idrv->flags, I830RES_LRING_ACQ );
+
+ idev->lring_bind.key = idev->lring_mem.key;
+ idev->lring_bind.pg_start = base/4096;
+ if (ioctl(idrv->agpgart, AGPIOC_BIND, &idev->lring_bind)) {
+ D_PERROR( "I830/AGP: AGPIOC_BIND failed!\n" );
+ i830_release_resource( idrv, idev );
+ return DFB_IO;
+ }
+ D_FLAGS_SET( idrv->flags, I830RES_LRING_BIND );
+
+ idev->ovl_mem.pg_count = 1;
+ idev->ovl_mem.type = AGP_PHYSICAL_MEMORY;
+ if (ioctl(idrv->agpgart, AGPIOC_ALLOCATE, &idev->ovl_mem)) {
+ D_PERROR( "I830/AGP: AGPIOC_ALLOCATE failed!\n" );
+ i830_release_resource( idrv, idev );
+ return DFB_IO;
+ }
+ D_FLAGS_SET( idrv->flags, I830RES_OVL_ACQ );
+
+ idev->ovl_bind.key = idev->ovl_mem.key;
+ idev->ovl_bind.pg_start = (base + RINGBUFFER_SIZE)/4096;
+ if (ioctl(idrv->agpgart, AGPIOC_BIND, &idev->ovl_bind)) {
+ D_PERROR( "I830/AGP: AGPIOC_BIND failed!\n" );
+ i830_release_resource( idrv, idev );
+ return DFB_IO;
+ }
+ D_FLAGS_SET( idrv->flags, I830RES_OVL_BIND );
+ }
+
+
+ if (idrv->flags & I830RES_GART_ACQ) {
+ ioctl(idrv->agpgart, AGPIOC_RELEASE);
+ idrv->flags &= ~I830RES_GART_ACQ;
+ }
+
+
+ idrv->lring_base = idrv->aper_base + idev->lring_bind.pg_start * 4096;
+ idrv->ovl_base = idrv->aper_base + idev->ovl_bind.pg_start * 4096;
+ idrv->pattern_base = idrv->ovl_base + 1024;
+
+ if (!idev->initialized) {
+ memset((void *) idrv->lring_base, 0x00, RINGBUFFER_SIZE);
+ memset((void *) idrv->ovl_base, 0xff, 1024);
+ memset((void *) idrv->pattern_base, 0xff, 4096 - 1024);
+
+ idev->lring1 = 0;//i830_readl(idrv->mmio_base, LP_RING);
+ idev->lring2 = 0;//i830_readl(idrv->mmio_base, LP_RING + RING_HEAD);
+ idev->lring3 = 0;//i830_readl(idrv->mmio_base, LP_RING + RING_START);
+ idev->lring4 = 0;//i830_readl(idrv->mmio_base, LP_RING + RING_LEN);
+ }
+
+ idev->initialized = true;
+
+ return DFB_OK;
+}
+
+static DFBResult
+driver_init_driver( CoreGraphicsDevice *device,
+ GraphicsDeviceFuncs *funcs,
+ void *driver_data,
+ void *device_data,
+ CoreDFB *core )
+{
+ DFBResult ret;
+ I830DriverData *idrv = driver_data;
+ I830DeviceData *idev = device_data;
+
+ idrv->idev = device_data;
+
+ idrv->mmio_base = (volatile u8*) dfb_gfxcard_map_mmio( device, 0, -1 );
+ if (!idrv->mmio_base)
+ return DFB_IO;
+
+ ret = i830_agp_setup( device, idrv, idev );
+ if (ret) {
+ dfb_gfxcard_unmap_mmio( device, idrv->mmio_base, -1 );
+ return ret;
+ }
+
+ idrv->info = idev->info;
+
+ funcs->CheckState = i830CheckState;
+ funcs->SetState = i830SetState;
+ funcs->EngineSync = i830EngineSync;
+ funcs->FlushTextureCache = i830FlushTextureCache;
+
+ dfb_layers_register( dfb_screens_at(DSCID_PRIMARY), driver_data, &i830OverlayFuncs );
+
+ return DFB_OK;
+}
+
+static DFBResult
+driver_init_device( CoreGraphicsDevice *device,
+ GraphicsDeviceInfo *device_info,
+ void *driver_data,
+ void *device_data )
+{
+ I830DriverData *idrv = driver_data;
+ I830DeviceData *idev = device_data;
+
+// int offset;
+
+ /* fill device info */
+ snprintf( device_info->name,
+ DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "830/845G/852GM/855GM/865G" );
+
+ snprintf( device_info->vendor,
+ DFB_GRAPHICS_DEVICE_INFO_VENDOR_LENGTH, "Intel" );
+
+ device_info->caps.flags = 0;
+ device_info->caps.accel = I830_SUPPORTED_DRAWINGFUNCTIONS |
+ I830_SUPPORTED_BLITTINGFUNCTIONS;
+ device_info->caps.drawing = I830_SUPPORTED_DRAWINGFLAGS;
+ device_info->caps.blitting = I830_SUPPORTED_BLITTINGFLAGS;
+
+ device_info->limits.surface_byteoffset_alignment = 32 * 4;
+ device_info->limits.surface_pixelpitch_alignment = 32;
+ device_info->limits.surface_bytepitch_alignment = 64;
+
+ dfb_config->pollvsync_after = 1;
+
+
+/* offset = dfb_gfxcard_reserve_memory( device, RINGBUFFER_SIZE );
+
+ idrv->lring_mem.physical = dfb_gfxcard_memory_physical( device, offset );
+ idrv->lring_base = dfb_gfxcard_memory_virtual( device, offset );
+
+
+ offset = dfb_gfxcard_reserve_memory( device, 4096 );
+
+ idrv->ovl_mem.physical = dfb_gfxcard_memory_physical( device, offset );
+ idrv->ovl_base = dfb_gfxcard_memory_virtual( device, offset );*/
+
+/* D_DEBUG_AT( I830_Ring, "lp_ring at 0x%08x (%p)\n",
+ idrv->lring_mem.physical, idrv->lring_base );
+
+ D_DEBUG_AT( I830_Ring, "ovl at 0x%08x (%p)\n",
+ idrv->ovl_mem.physical, idrv->ovl_base );*/
+
+ i830_init_ringbuffer( idrv, idev );
+
+ return DFB_OK;
+}
+
+static void
+driver_close_device( CoreGraphicsDevice *device,
+ void *driver_data,
+ void *device_data )
+{
+ I830DeviceData *idev = device_data;
+ I830DriverData *idrv = driver_data;
+
+ i830ovlOnOff( idrv, idev, false );
+
+ i830_wait_for_blit_idle(idrv, idev);
+ i830_lring_enable(idrv, 0);
+
+ i830_release_resource( idrv, idev );
+
+
+ D_DEBUG( "DirectFB/I830: DMA Buffer Performance Monitoring:\n");
+ D_DEBUG( "DirectFB/I830: %9d DMA buffer size in KB\n",
+ RINGBUFFER_SIZE/1024 );
+ D_DEBUG( "DirectFB/I830: %9d i830_wait_for_blit_idle calls\n",
+ idev->idle_calls );
+ D_DEBUG( "DirectFB/I830: %9d i830_wait_for_space calls\n",
+ idev->waitfifo_calls );
+ D_DEBUG( "DirectFB/I830: %9d BUFFER transfers (i830_wait_for_space sum)\n",
+ idev->waitfifo_sum );
+ D_DEBUG( "DirectFB/I830: %9d BUFFER wait cycles (depends on GPU/CPU)\n",
+ idev->fifo_waitcycles );
+ D_DEBUG( "DirectFB/I830: %9d IDLE wait cycles (depends on GPU/CPU)\n",
+ idev->idle_waitcycles );
+ D_DEBUG( "DirectFB/I830: %9d BUFFER space cache hits(depends on BUFFER size)\n",
+ idev->fifo_cache_hits );
+ D_DEBUG( "DirectFB/I830: %9d BUFFER timeout sum (possible hardware crash)\n",
+ idev->fifo_timeoutsum );
+ D_DEBUG( "DirectFB/I830: %9d IDLE timeout sum (possible hardware crash)\n",
+ idev->idle_timeoutsum );
+ D_DEBUG( "DirectFB/I830: Conclusion:\n" );
+ D_DEBUG( "DirectFB/I830: Average buffer transfers per i830_wait_for_space "
+ "call: %.2f\n",
+ idev->waitfifo_sum/(float)(idev->waitfifo_calls) );
+ D_DEBUG( "DirectFB/I830: Average wait cycles per i830_wait_for_space call:"
+ " %.2f\n",
+ idev->fifo_waitcycles/(float)(idev->waitfifo_calls) );
+ D_DEBUG( "DirectFB/I830: Average wait cycles per i830_wait_for_blit_idle call:"
+ " %.2f\n",
+ idev->idle_waitcycles/(float)(idev->idle_calls) );
+ D_DEBUG( "DirectFB/I830: Average buffer space cache hits: %02d%%\n",
+ (int)(100 * idev->fifo_cache_hits/
+ (float)(idev->waitfifo_calls)) );
+}
+
+static void
+driver_close_driver( CoreGraphicsDevice *device,
+ void *driver_data )
+{
+ I830DriverData *idrv = (I830DriverData *) driver_data;
+
+ dfb_gfxcard_unmap_mmio( device, idrv->mmio_base, -1 );
+
+ if (idrv->flags & I830RES_MMAP) {
+ munmap((void *) idrv->aper_base, idrv->info.aper_size * 1024 * 1024);
+ idrv->flags &= ~I830RES_MMAP;
+ }
+
+ if (idrv->flags & I830RES_GART_ACQ) {
+ ioctl(idrv->agpgart, AGPIOC_RELEASE);
+ idrv->flags &= ~I830RES_GART_ACQ;
+ }
+
+ if (idrv->flags & I830RES_GART) {
+ close(idrv->agpgart);
+ idrv->flags &= ~I830RES_GART;
+ }
+}
+
diff --git a/Source/DirectFB/gfxdrivers/i830/i830.h b/Source/DirectFB/gfxdrivers/i830/i830.h
new file mode 100755
index 0000000..62c8d6d
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/i830/i830.h
@@ -0,0 +1,406 @@
+/*
+ Intel i830 DirectFB graphics driver
+
+ (c) Copyright 2005 Servision Ltd.
+ http://www.servision.net/
+
+ All rights reserved.
+
+ Based on i810 driver written by Antonino Daplas <adaplas@pol.net>
+
+ 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 __I830_H__
+#define __I830_H__
+
+#include <dfb_types.h>
+
+#include <sys/types.h>
+#include <linux/agpgart.h>
+
+#include <core/gfxcard.h>
+#include <core/layers.h>
+
+
+#define RINGBUFFER_SIZE (128 * 1024)
+
+
+
+/* Ring buffer registers, p277, overview p19
+ */
+#define LP_RING 0x2030
+#define HP_RING 0x2040
+
+#define RING_TAIL 0x00
+#define TAIL_ADDR 0x000FFFF8
+#define I830_TAIL_MASK 0x001FFFF8
+
+#define RING_HEAD 0x04
+#define HEAD_WRAP_COUNT 0xFFE00000
+#define HEAD_WRAP_ONE 0x00200000
+#define HEAD_ADDR 0x001FFFFC
+#define I830_HEAD_MASK 0x001FFFFC
+
+#define RING_START 0x08
+#define START_ADDR 0x00FFFFF8
+#define I830_RING_START_MASK 0xFFFFF000
+
+#define RING_LEN 0x0C
+#define RING_NR_PAGES 0x000FF000
+#define I830_RING_NR_PAGES 0x001FF000
+#define RING_REPORT_MASK 0x00000006
+#define RING_REPORT_64K 0x00000002
+#define RING_REPORT_128K 0x00000004
+#define RING_NO_REPORT 0x00000000
+#define RING_VALID_MASK 0x00000001
+#define RING_VALID 0x00000001
+#define RING_INVALID 0x00000000
+
+
+/* Overlay Flip */
+#define MI_OVERLAY_FLIP (0x11<<23)
+#define MI_OVERLAY_FLIP_CONTINUE (0<<21)
+#define MI_OVERLAY_FLIP_ON (1<<21)
+#define MI_OVERLAY_FLIP_OFF (2<<21)
+
+/* Wait for Events */
+#define MI_WAIT_FOR_EVENT (0x03<<23)
+#define MI_WAIT_FOR_OVERLAY_FLIP (1<<16)
+
+/* Flush */
+#define MI_FLUSH (0x04<<23)
+#define MI_WRITE_DIRTY_STATE (1<<4)
+#define MI_END_SCENE (1<<3)
+#define MI_INHIBIT_RENDER_CACHE_FLUSH (1<<2)
+#define MI_INVALIDATE_MAP_CACHE (1<<0)
+
+/* Noop */
+#define MI_NOOP 0x00
+#define MI_NOOP_WRITE_ID (1<<22)
+#define MI_NOOP_ID_MASK (1<<22 - 1)
+
+
+/* Instruction Parser Mode Register
+ * - p281
+ * - 2 new bits.
+ */
+#define INST_PM 0x20c0
+#define AGP_SYNC_PACKET_FLUSH_ENABLE 0x20 /* reserved */
+#define SYNC_PACKET_FLUSH_ENABLE 0x10
+#define TWO_D_INST_DISABLE 0x08
+#define THREE_D_INST_DISABLE 0x04
+#define STATE_VAR_UPDATE_DISABLE 0x02
+#define PAL_STIP_DISABLE 0x01
+
+#define INST_DONE 0x2090
+#define INST_PS 0x20c4
+
+#define MEMMODE 0x20dc
+
+
+
+#define I830RES_GART 1
+#define I830RES_LRING_ACQ 2
+#define I830RES_LRING_BIND 4
+#define I830RES_OVL_ACQ 8
+#define I830RES_OVL_BIND 16
+#define I830RES_GART_ACQ 32
+#define I830RES_MMAP 64
+#define I830RES_STATE_SAVE 128
+
+#ifndef AGP_NORMAL_MEMORY
+#define AGP_NORMAL_MEMORY 0
+#endif
+
+#ifndef AGP_PHYSICAL_MEMORY
+#define AGP_PHYSICAL_MEMORY 2
+#endif
+
+
+
+
+/*
+ * OCMD - Overlay Command Register
+ */
+#define MIRROR_MODE (0x3<<17)
+#define MIRROR_HORIZONTAL (0x1<<17)
+#define MIRROR_VERTICAL (0x2<<17)
+#define MIRROR_BOTH (0x3<<17)
+#define OV_BYTE_ORDER (0x3<<14)
+#define UV_SWAP (0x1<<14)
+#define Y_SWAP (0x2<<14)
+#define Y_AND_UV_SWAP (0x3<<14)
+#define SOURCE_FORMAT (0xf<<10)
+#define RGB_888 (0x1<<10)
+#define RGB_555 (0x2<<10)
+#define RGB_565 (0x3<<10)
+#define YUV_422 (0x8<<10)
+#define YUV_411 (0x9<<10)
+#define YUV_420 (0xc<<10)
+#define YUV_422_PLANAR (0xd<<10)
+#define YUV_410 (0xe<<10)
+#define TVSYNC_FLIP_PARITY (0x1<<9)
+#define TVSYNC_FLIP_ENABLE (0x1<<7)
+#define BUF_TYPE (0x1<<5)
+#define BUF_TYPE_FRAME (0x0<<5)
+#define BUF_TYPE_FIELD (0x1<<5)
+#define TEST_MODE (0x1<<4)
+#define BUFFER_SELECT (0x3<<2)
+#define BUFFER0 (0x0<<2)
+#define BUFFER1 (0x1<<2)
+#define FIELD_SELECT (0x1<<1)
+#define FIELD0 (0x0<<1)
+#define FIELD1 (0x1<<1)
+#define OVERLAY_ENABLE 0x1
+
+/* OCONFIG register */
+#define CC_OUT_8BIT (0x1<<3)
+#define OVERLAY_PIPE_MASK (0x1<<18)
+#define OVERLAY_PIPE_A (0x0<<18)
+#define OVERLAY_PIPE_B (0x1<<18)
+
+/* DCLRKM register */
+#define DEST_KEY_ENABLE (0x1<<31)
+
+/* Polyphase filter coefficients */
+#define N_HORIZ_Y_TAPS 5
+#define N_VERT_Y_TAPS 3
+#define N_HORIZ_UV_TAPS 3
+#define N_VERT_UV_TAPS 3
+#define N_PHASES 17
+#define MAX_TAPS 5
+
+/* Filter cutoff frequency limits. */
+#define MIN_CUTOFF_FREQ 1.0
+#define MAX_CUTOFF_FREQ 3.0
+
+typedef volatile struct {
+ u32 OBUF_0Y;
+ u32 OBUF_1Y;
+ u32 OBUF_0U;
+ u32 OBUF_0V;
+ u32 OBUF_1U;
+ u32 OBUF_1V;
+ u32 OSTRIDE;
+ u32 YRGB_VPH;
+ u32 UV_VPH;
+ u32 HORZ_PH;
+ u32 INIT_PHS;
+ u32 DWINPOS;
+ u32 DWINSZ;
+ u32 SWIDTH;
+ u32 SWIDTHSW;
+ u32 SHEIGHT;
+ u32 YRGBSCALE;
+ u32 UVSCALE;
+ u32 OCLRC0;
+ u32 OCLRC1;
+ u32 DCLRKV;
+ u32 DCLRKM;
+ u32 SCLRKVH;
+ u32 SCLRKVL;
+ u32 SCLRKEN;
+ u32 OCONFIG;
+ u32 OCMD;
+ u32 RESERVED1; /* 0x6C */
+ u32 AWINPOS;
+ u32 AWINSZ;
+ u32 RESERVED2; /* 0x78 */
+ u32 RESERVED3; /* 0x7C */
+ u32 RESERVED4; /* 0x80 */
+ u32 RESERVED5; /* 0x84 */
+ u32 RESERVED6; /* 0x88 */
+ u32 RESERVED7; /* 0x8C */
+ u32 RESERVED8; /* 0x90 */
+ u32 RESERVED9; /* 0x94 */
+ u32 RESERVEDA; /* 0x98 */
+ u32 RESERVEDB; /* 0x9C */
+ u32 FASTHSCALE; /* 0xA0 */
+ u32 UVSCALEV; /* 0xA4 */
+
+ u32 RESERVEDC[(0x200 - 0xA8) / 4]; /* 0xA8 - 0x1FC */
+ u16 Y_VCOEFS[N_VERT_Y_TAPS * N_PHASES]; /* 0x200 */
+ u16 RESERVEDD[0x100 / 2 - N_VERT_Y_TAPS * N_PHASES];
+ u16 Y_HCOEFS[N_HORIZ_Y_TAPS * N_PHASES]; /* 0x300 */
+ u16 RESERVEDE[0x200 / 2 - N_HORIZ_Y_TAPS * N_PHASES];
+ u16 UV_VCOEFS[N_VERT_UV_TAPS * N_PHASES]; /* 0x500 */
+ u16 RESERVEDF[0x100 / 2 - N_VERT_UV_TAPS * N_PHASES];
+ u16 UV_HCOEFS[N_HORIZ_UV_TAPS * N_PHASES]; /* 0x600 */
+ u16 RESERVEDG[0x100 / 2 - N_HORIZ_UV_TAPS * N_PHASES];
+} I830OverlayRegs;
+
+typedef struct {
+ CoreLayerRegionConfig config;
+} I830OverlayLayerData;
+
+
+typedef struct {
+ unsigned int tail_mask;
+
+ int size;
+ int head;
+ int tail;
+ int space;
+} I830RingBuffer;
+
+typedef struct {
+ volatile void *virt;
+ unsigned int tail_mask;
+ unsigned int outring;
+} I830RingBlock;
+
+
+typedef struct {
+ bool initialized;
+
+ I830RingBuffer lp_ring;
+
+ bool overlayOn;
+ I830OverlayLayerData *iovl;
+
+ agp_info info;
+ agp_allocate lring_mem;
+ agp_allocate ovl_mem;
+ agp_bind lring_bind;
+ agp_bind ovl_bind;
+
+ u32 pattern;
+ u32 lring1;
+ u32 lring2;
+ u32 lring3;
+ u32 lring4;
+
+ /* benchmarking */
+ u32 waitfifo_sum;
+ u32 waitfifo_calls;
+ u32 idle_calls;
+ u32 fifo_waitcycles;
+ u32 idle_waitcycles;
+ u32 fifo_cache_hits;
+ u32 fifo_timeoutsum;
+ u32 idle_timeoutsum;
+} I830DeviceData;
+
+typedef struct {
+ I830DeviceData *idev;
+
+ I830OverlayRegs *oregs;
+
+ u32 flags;
+ int agpgart;
+ agp_info info;
+ volatile u8 *aper_base;
+ volatile u8 *lring_base;
+ volatile u8 *ovl_base;
+ volatile u8 *mmio_base;
+ volatile u8 *pattern_base;
+} I830DriverData;
+
+extern DisplayLayerFuncs i830OverlayFuncs;
+
+void i830ovlOnOff( I830DriverData *idrv,
+ I830DeviceData *idev,
+ bool on );
+
+
+
+#define i830_readb(mmio_base, where) \
+ *((volatile u8 *) (mmio_base + where)) \
+
+#define i830_readw(mmio_base, where) \
+ *((volatile u16 *) (mmio_base + where)) \
+
+#define i830_readl(mmio_base, where) \
+ *((volatile u32 *) (mmio_base + where)) \
+
+#define i830_writeb(mmio_base, where, val) \
+ *((volatile u8 *) (mmio_base + where)) = (volatile u8) val \
+
+#define i830_writew(mmio_base, where, val) \
+ *((volatile u16 *) (mmio_base + where)) = (volatile u16) val \
+
+#define i830_writel(mmio_base, where, val) \
+ *((volatile u32 *) (mmio_base + where)) = (volatile u32) val \
+
+
+
+DFBResult i830_wait_lp_ring( I830DriverData *idrv,
+ I830DeviceData *idev,
+ int space );
+
+D_DEBUG_DOMAIN( I830_Ring, "I830/Ring", "I830 Ring Buffer" );
+
+
+static inline DFBResult
+i830_begin_lp_ring( I830DriverData *idrv,
+ I830DeviceData *idev,
+ int needed,
+ I830RingBlock *ret_block )
+{
+ DFBResult ret;
+ I830RingBuffer *buf = &idev->lp_ring;
+
+ D_DEBUG_AT( I830_Ring, "begin_lp_ring( %d ) <- head 0x%08x\n", needed, i830_readl( idrv->mmio_base, LP_RING + RING_HEAD ) );
+
+ if (needed & 1)
+ D_ERROR( "i830_begin_ring called with odd argument: %d\n", needed);
+
+ needed *= 4;
+
+ if (buf->space < needed) {
+ ret = i830_wait_lp_ring( idrv, idev, needed );
+ if (ret)
+ return ret;
+ }
+
+ buf->space -= needed;
+
+ ret_block->virt = idrv->lring_base;
+ ret_block->tail_mask = buf->tail_mask;
+ ret_block->outring = buf->tail;
+
+ return DFB_OK;
+}
+
+static inline void
+i830_out_ring( I830RingBlock *block,
+ u32 value )
+{
+ D_DEBUG_AT( I830_Ring, "out_ring( 0x%08x, 0x%08x )\n", block->outring, value );
+
+ *(volatile u32*)(block->virt + block->outring) = value;
+
+ block->outring = (block->outring + 4) & block->tail_mask;
+}
+
+static inline void
+i830_advance_lp_ring( I830DriverData *idrv,
+ I830DeviceData *idev,
+ const I830RingBlock *block )
+{
+ D_DEBUG_AT( I830_Ring, "advance_lp_ring( 0x%08x )\n", block->outring );
+
+ idev->lp_ring.tail = block->outring;
+
+ if (block->outring & 0x07)
+ D_ERROR( "i830_advance_lp_ring: "
+ "outring (0x%x) isn't on a QWord boundary", block->outring );
+
+ i830_writel( idrv->mmio_base, LP_RING + RING_TAIL, block->outring );
+}
+
+#endif /* __I830_H__ */
diff --git a/Source/DirectFB/gfxdrivers/i830/i830_overlay.c b/Source/DirectFB/gfxdrivers/i830/i830_overlay.c
new file mode 100755
index 0000000..5f64602
--- /dev/null
+++ b/Source/DirectFB/gfxdrivers/i830/i830_overlay.c
@@ -0,0 +1,807 @@
+/*
+ Intel i830 DirectFB graphics driver
+
+ (c) Copyright 2005 Servision Ltd.
+ http://www.servision.net/
+
+ All rights reserved.
+
+ Based on i810 driver written by Antonino Daplas <adaplas@pol.net>
+
+ Video Overlay Support based partly on XFree86's "i830_video.c"
+
+ 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.
+*/
+
+/*
+ * i830_video.c: i830/i845 Xv driver.
+ *
+ * Copyright © 2002 by Alan Hourihane and David Dawes
+ *
+ * Authors:
+ * Alan Hourihane <alanh@tungstengraphics.com>
+ * David Dawes <dawes@xfree86.org>
+ *
+ * Derived from i830 Xv driver:
+ *
+ * Authors of i830 code:
+ * Jonathan Bian <jonathan.bian@intel.com>
+ * Offscreen Images:
+ * Matt Sottek <matthew.j.sottek@intel.com>
+ */
+
+#include <config.h>
+
+#include <fbdev/fbdev.h> /* FIXME: Needs to be included before dfb_types.h to work around a type clash with asm/types.h */
+
+#include "i830.h"
+
+#include <math.h>
+#include <string.h>
+
+#include <sys/ioctl.h>
+
+#include <core/coredefs.h>
+#include <core/layers.h>
+#include <core/surface.h>
+#include <core/screens.h>
+#include <core/screen.h>
+
+#include <fbdev/fbdev.h>
+
+#include <direct/mem.h>
+
+#include <gfx/convert.h>
+
+#include <misc/conf.h>
+
+#define I830_OVERLAY_SUPPORTED_OPTIONS (DLOP_DST_COLORKEY)
+
+static void ovl_calc_regs( I830DriverData *idrv,
+ I830DeviceData *idev,
+ I830OverlayLayerData *iovl,
+ CoreLayer *layer,
+ CoreSurface *surface,
+ CoreLayerRegionConfig *config,
+ bool buffers_only,
+ CoreSurfaceBufferLock *lock );
+
+
+/*
+ * This is more or less the correct way to initalise, update, and shut down
+ * the overlay. Note OVERLAY_OFF should be used only after disabling the
+ * overlay in OCMD and calling OVERLAY_UPDATE.
+ *
+ * XXX Need to make sure that the overlay engine is cleanly shutdown in
+ * all modes of server exit.
+ */
+
+static void
+update_overlay( I830DriverData *idrv,
+ I830DeviceData *idev )
+{
+ I830RingBlock block = { NULL, 0, 0 };
+
+ i830_begin_lp_ring( idrv, idev, 6, &block );
+
+ i830_out_ring( &block, MI_FLUSH | MI_WRITE_DIRTY_STATE );
+ i830_out_ring( &block, MI_NOOP );
+
+ if (!idev->overlayOn) {
+ idev->overlayOn = true;
+
+ i830_out_ring( &block, MI_NOOP );
+ i830_out_ring( &block, MI_NOOP );
+ i830_out_ring( &block, MI_OVERLAY_FLIP | MI_OVERLAY_FLIP_ON );
+ }
+ else {
+ i830_out_ring( &block, MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP );
+ i830_out_ring( &block, MI_NOOP );
+ i830_out_ring( &block, MI_OVERLAY_FLIP | MI_OVERLAY_FLIP_CONTINUE );
+ }
+
+ i830_out_ring( &block, idev->ovl_mem.physical | 1 );
+
+ i830_advance_lp_ring( idrv, idev, &block );
+}
+
+static void
+disable_overlay( I830DriverData *idrv,
+ I830DeviceData *idev )
+{
+ I830RingBlock block = { NULL, 0, 0 };
+
+ if (!idev->overlayOn)
+ return;
+
+ i830_begin_lp_ring( idrv, idev, 8, &block );
+
+ i830_out_ring( &block, MI_FLUSH | MI_WRITE_DIRTY_STATE );
+ i830_out_ring( &block, MI_NOOP );
+ i830_out_ring( &block, MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP );
+ i830_out_ring( &block, MI_NOOP );
+ i830_out_ring( &block, MI_OVERLAY_FLIP | MI_OVERLAY_FLIP_OFF );
+ i830_out_ring( &block, idev->ovl_mem.physical | 1 );
+ i830_out_ring( &block, MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP );
+ i830_out_ring( &block, MI_NOOP );
+
+ i830_advance_lp_ring( idrv, idev, &block );
+
+ idev->overlayOn = false;
+}
+
+void
+i830ovlOnOff( I830DriverData *idrv,
+ I830DeviceData *idev,
+ bool on )
+{
+ if (on)
+ idrv->oregs->OCMD |= OVERLAY_ENABLE;
+ else
+ idrv->oregs->OCMD &= ~OVERLAY_ENABLE;
+
+ update_overlay( idrv, idev );
+
+ if (!on)
+ disable_overlay( idrv, idev );
+}
+
+static int
+ovlLayerDataSize( void )
+{
+ return sizeof(I830OverlayLayerData);
+}
+
+static DFBResult
+ovlInitLayer( CoreLayer *layer,
+ void *driver_data,
+ void *layer_data,
+ DFBDisplayLayerDescription *description,
+ DFBDisplayLayerConfig *config,
+ DFBColorAdjustment *adjustment )
+{
+ I830DriverData *idrv = driver_data;
+ I830DeviceData *idev = idrv->idev;
+ I830OverlayLayerData *iovl = layer_data;
+
+ idev->iovl = iovl;
+
+ idrv->oregs = (I830OverlayRegs*) idrv->ovl_base;
+
+ memset( (void*) idrv->oregs, 0, sizeof(I830OverlayRegs) );
+
+ /* set_capabilities */
+ description->caps = DLCAPS_SURFACE | DLCAPS_SCREEN_LOCATION |
+ DLCAPS_BRIGHTNESS | DLCAPS_CONTRAST | DLCAPS_SATURATION |
+ DLCAPS_DST_COLORKEY;
+
+ description->type = DLTF_GRAPHICS | DLTF_VIDEO | DLTF_STILL_PICTURE;
+
+ /* set name */
+ snprintf( description->name,
+ DFB_DISPLAY_LAYER_DESC_NAME_LENGTH, "Intel 830/845/855/865 Overlay" );
+
+ /* fill out the default configuration */
+ config->flags = DLCONF_WIDTH | DLCONF_HEIGHT |
+ DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE | DLCONF_OPTIONS;
+ config->width = 640;
+ config->height = 480;
+ config->pixelformat = DSPF_YUY2;
+ config->buffermode = DLBM_FRONTONLY;
+ config->options = DLOP_NONE;
+
+ /* fill out default color adjustment,
+ only fields set in flags will be accepted from applications */
+ adjustment->flags = DCAF_BRIGHTNESS | DCAF_CONTRAST | DCAF_SATURATION;
+ adjustment->brightness = 0x8000;
+ adjustment->contrast = 0x8000;
+ adjustment->saturation = 0x8000;
+
+
+ idrv->oregs->OCLRC0 = 64 << 18;
+ idrv->oregs->OCLRC1 = 0x80;
+
+ return DFB_OK;
+}
+
+static DFBResult
+ovlTestRegion( CoreLayer *layer,
+ void *driver_data,
+ void *layer_data,
+ CoreLayerRegionConfig *config,
+ CoreLayerRegionConfigFlags *failed )
+{
+ CoreLayerRegionConfigFlags fail = CLRCF_NONE;
+
+ if (config->options & ~I830_OVERLAY_SUPPORTED_OPTIONS)
+ fail |= CLRCF_OPTIONS;
+
+ switch (config->format) {
+ case DSPF_I420:
+ case DSPF_YV12:
+ case DSPF_YUY2:
+ case DSPF_UYVY:
+ break;
+ default:
+ fail |= CLRCF_FORMAT;
+ }
+
+ if (config->width > 1440 || config->width < 1)
+ fail |= CLRCF_WIDTH;
+
+ if (config->height > 1023 || config->height < 1)
+ fail |= CLRCF_HEIGHT;
+
+ if (failed)
+ *failed = fail;
+
+ 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 )
+{
+ I830DriverData *idrv = driver_data;
+ I830DeviceData *idev = idrv->idev;
+ I830OverlayLayerData *iovl = layer_data;
+
+ iovl->config = *config;
+
+ ovl_calc_regs ( idrv, idev, iovl, layer, surface, config, false, lock );
+
+ i830ovlOnOff( idrv, idev, true );
+
+ return DFB_OK;
+}
+
+static DFBResult
+ovlRemoveRegion( CoreLayer *layer,
+ void *driver_data,
+ void *layer_data,
+ void *region_data )
+{
+ I830DriverData *idrv = driver_data;
+ I830DeviceData *idev = idrv->idev;
+
+ /* disable overlay */
+ i830ovlOnOff( idrv, idev, false );
+
+ return DFB_OK;
+}
+
+static DFBResult
+ovlFlipRegion( CoreLayer *layer,
+ void *driver_data,
+ void *layer_data,
+ void *region_data,
+ CoreSurface *surface,
+ DFBSurfaceFlipFlags flags,
+ CoreSurfaceBufferLock *lock )
+{
+ I830DriverData *idrv = driver_data;
+ I830DeviceData *idev = idrv->idev;
+ I830OverlayLayerData *iovl = layer_data;
+
+ dfb_surface_flip( surface, false );
+
+ ovl_calc_regs ( idrv, idev, iovl, layer, surface, &iovl->config, true, lock );
+
+ update_overlay( idrv, idev );
+
+ if (flags & DSFLIP_WAIT)
+ dfb_screen_wait_vsync( dfb_screens_at( DSCID_PRIMARY ) );
+
+ return DFB_OK;
+}
+
+static DFBResult
+ovlSetColorAdjustment( CoreLayer *layer,
+ void *driver_data,
+ void *layer_data,
+ DFBColorAdjustment *adj )
+{
+ I830DriverData *idrv = driver_data;
+ I830DeviceData *idev = idrv->idev;
+ u16 b, c, s;
+
+ if (adj->flags & DCAF_BRIGHTNESS)
+ b = ((adj->brightness >> 8) - 128) & 0xFF;
+ else
+ b = idrv->oregs->OCLRC0 & 0xFF;
+
+ if (adj->flags & DCAF_CONTRAST)
+ c = (adj->contrast >> 8) & 0xFF;
+ else
+ c = (idrv->oregs->OCLRC0 >> 18) & 0xFF;
+
+ if (adj->flags & DCAF_SATURATION)
+ s = (adj->saturation >> 8) & 0xFF;
+ else
+ s = idrv->oregs->OCLRC1 & 0xFF;
+
+ idrv->oregs->OCLRC0 = b | (c << 18);
+ idrv->oregs->OCLRC1 = s;
+
+ update_overlay( idrv, idev );
+
+ return DFB_OK;
+}
+
+static DFBResult
+ovlSetInputField( CoreLayer *layer,
+ void *driver_data,
+ void *layer_data,
+ void *region_data,
+ int field )
+{
+ I830DriverData *idrv = driver_data;
+ I830DeviceData *idev = idrv->idev;
+
+ idrv->oregs->OCMD &= ~FIELD_SELECT;
+ idrv->oregs->OCMD |= (field) ? FIELD1 : FIELD0;
+
+ update_overlay( idrv, idev );
+
+ return DFB_OK;
+}
+
+DisplayLayerFuncs i830OverlayFuncs = {
+ .LayerDataSize = ovlLayerDataSize,
+ .InitLayer = ovlInitLayer,
+ .TestRegion = ovlTestRegion,
+ .SetRegion = ovlSetRegion,
+ .RemoveRegion = ovlRemoveRegion,
+ .FlipRegion = ovlFlipRegion,
+ .SetColorAdjustment = ovlSetColorAdjustment,
+ .SetInputField = ovlSetInputField,
+};
+
+
+typedef struct {
+ u8 sign;
+ u16 mantissa;
+ u8 exponent;
+} coeffRec, *coeffPtr;
+
+static bool
+SetCoeffRegs(double *coeff, int mantSize, coeffPtr pCoeff, int pos)
+{
+ int maxVal, icoeff, res;
+ int sign;
+ double c;
+
+ sign = 0;
+ maxVal = 1 << mantSize;
+ c = *coeff;
+ if (c < 0.0) {
+ sign = 1;
+ c = -c;
+ }
+
+ res = 12 - mantSize;
+ if ((icoeff = (int)(c * 4 * maxVal + 0.5)) < maxVal) {
+ pCoeff[pos].exponent = 3;
+ pCoeff[pos].mantissa = icoeff << res;
+ *coeff = (double)icoeff / (double)(4 * maxVal);
+ }
+ else if ((icoeff = (int)(c * 2 * maxVal + 0.5)) < maxVal) {
+ pCoeff[pos].exponent = 2;
+ pCoeff[pos].mantissa = icoeff << res;
+ *coeff = (double)icoeff / (double)(2 * maxVal);
+ }
+ else if ((icoeff = (int)(c * maxVal + 0.5)) < maxVal) {
+ pCoeff[pos].exponent = 1;
+ pCoeff[pos].mantissa = icoeff << res;
+ *coeff = (double)icoeff / (double)(maxVal);
+ }
+ else if ((icoeff = (int)(c * maxVal * 0.5 + 0.5)) < maxVal) {
+ pCoeff[pos].exponent = 0;
+ pCoeff[pos].mantissa = icoeff << res;
+ *coeff = (double)icoeff / (double)(maxVal / 2);
+ }
+ else {
+ /* Coeff out of range */
+ return false;
+ }
+
+ pCoeff[pos].sign = sign;
+ if (sign)
+ *coeff = -(*coeff);
+ return true;
+}
+
+static void
+UpdateCoeff(int taps, double fCutoff, bool isHoriz, bool isY, coeffPtr pCoeff)
+{
+ int i, j, j1, num, pos, mantSize;
+ double pi = 3.1415926535, val, sinc, window, sum;
+ double rawCoeff[MAX_TAPS * 32], coeffs[N_PHASES][MAX_TAPS];
+ double diff;
+ int tapAdjust[MAX_TAPS], tap2Fix;
+ bool isVertAndUV;
+
+ if (isHoriz)
+ mantSize = 7;
+ else
+ mantSize = 6;
+
+ isVertAndUV = !isHoriz && !isY;
+ num = taps * 16;
+ for (i = 0; i < num * 2; i++) {
+ val = (1.0 / fCutoff) * taps * pi * (i - num) / (2 * num);
+ if (val == 0.0)
+ sinc = 1.0;
+ else
+ sinc = sin(val) / val;
+
+ /* Hamming window */
+ window = (0.5 - 0.5 * cos(i * pi / num));
+ rawCoeff[i] = sinc * window;
+ }
+
+ for (i = 0; i < N_PHASES; i++) {
+ /* Normalise the coefficients. */
+ sum = 0.0;
+ for (j = 0; j < taps; j++) {
+ pos = i + j * 32;
+ sum += rawCoeff[pos];
+ }
+ for (j = 0; j < taps; j++) {
+ pos = i + j * 32;
+ coeffs[i][j] = rawCoeff[pos] / sum;
+ }
+
+ /* Set the register values. */
+ for (j = 0; j < taps; j++) {
+ pos = j + i * taps;
+ if ((j == (taps - 1) / 2) && !isVertAndUV)
+ SetCoeffRegs(&coeffs[i][j], mantSize + 2, pCoeff, pos);
+ else
+ SetCoeffRegs(&coeffs[i][j], mantSize, pCoeff, pos);
+ }
+
+ tapAdjust[0] = (taps - 1) / 2;
+ for (j = 1, j1 = 1; j <= tapAdjust[0]; j++, j1++) {
+ tapAdjust[j1] = tapAdjust[0] - j;
+ tapAdjust[++j1] = tapAdjust[0] + j;
+ }
+
+ /* Adjust the coefficients. */
+ sum = 0.0;
+ for (j = 0; j < taps; j++)
+ sum += coeffs[i][j];
+ if (sum != 1.0) {
+ for (j1 = 0; j1 < taps; j1++) {
+ tap2Fix = tapAdjust[j1];
+ diff = 1.0 - sum;
+ coeffs[i][tap2Fix] += diff;
+ pos = tap2Fix + i * taps;
+ if ((tap2Fix == (taps - 1) / 2) && !isVertAndUV)
+ SetCoeffRegs(&coeffs[i][tap2Fix], mantSize + 2, pCoeff, pos);
+ else
+ SetCoeffRegs(&coeffs[i][tap2Fix], mantSize, pCoeff, pos);
+
+ sum = 0.0;
+ for (j = 0; j < taps; j++)
+ sum += coeffs[i][j];
+ if (sum == 1.0)
+ break;
+ }
+ }
+ }
+}
+
+static void
+ovl_calc_regs( I830DriverData *idrv,
+ I830DeviceData *idev,
+ I830OverlayLayerData *iovl,
+ CoreLayer *layer,
+ CoreSurface *surface,
+ CoreLayerRegionConfig *config,
+ bool buffers_only,
+ CoreSurfaceBufferLock *lock )
+{
+ I830OverlayRegs *regs = idrv->oregs;
+ int width = config->width;
+ int height = config->height;
+
+ int y_offset, u_offset = 0, v_offset = 0;
+
+ unsigned int swidth;
+
+
+ /* Set buffer pointers */
+ y_offset = dfb_gfxcard_memory_physical( NULL, lock->offset );
+
+ switch (config->format) {
+ case DSPF_I420:
+ u_offset = y_offset + height * lock->pitch;
+ v_offset = u_offset + ((height >> 1) * (lock->pitch >> 1));
+ break;
+
+ case DSPF_YV12:
+ v_offset = y_offset + height * lock->pitch;
+ u_offset = v_offset + ((height >> 1) * (lock->pitch >> 1));
+ break;
+
+ case DSPF_UYVY:
+ case DSPF_YUY2:
+ break;
+
+ default:
+ D_BUG( "unexpected format" );
+ return;
+ }
+
+ /* buffer locations */
+ regs->OBUF_0Y = y_offset;
+ regs->OBUF_0U = u_offset;
+ regs->OBUF_0V = v_offset;
+
+ //D_INFO("Buffers: Y0: 0x%08x, U0: 0x%08x, V0: 0x%08x\n", regs->OBUF_0Y,
+ // regs->OBUF_0U, regs->OBUF_0V);
+
+ if (buffers_only)
+ return;
+
+ switch (config->format) {
+ case DSPF_YV12:
+ case DSPF_I420:
+ swidth = (width + 1) & ~1 & 0xfff;
+ regs->SWIDTH = swidth;
+
+ swidth /= 2;
+ regs->SWIDTH |= (swidth & 0x7ff) << 16;
+
+ swidth = ((y_offset + width + 0x1f) >> 5) - (y_offset >> 5) - 1;
+
+ //D_INFO("Y width is %d, swidthsw is %d\n", width, swidth);
+
+ regs->SWIDTHSW = swidth << 2;
+
+ swidth = ((u_offset + (width / 2) + 0x1f) >> 5) - (u_offset >> 5) - 1;
+ //D_INFO("UV width is %d, swidthsw is %d\n", width / 2, swidth);
+
+ regs->SWIDTHSW |= swidth << 18;
+ break;
+
+ case DSPF_UYVY:
+ case DSPF_YUY2:
+ /* XXX Check for i845 */
+
+ swidth = ((width + 31) & ~31) << 1;
+ regs->SWIDTH = swidth;
+ regs->SWIDTHSW = swidth >> 3;
+ break;
+
+ default:
+ D_BUG( "unexpected format" );
+ return;
+ }
+
+ regs->SHEIGHT = height | ((height / 2) << 16);
+
+#if NOT_PORTED_YET
+ if (pPriv->oneLineMode) {
+ /* change the coordinates with panel fitting active */
+ dstBox->y1 = (((dstBox->y1 - 1) * pPriv->scaleRatio) >> 16) + 1;
+ dstBox->y2 = ((dstBox->y2 * pPriv->scaleRatio) >> 16) + 1;
+
+ /* Now, alter the height, so we scale to the correct size */
+ drw_h = dstBox->y2 - dstBox->y1;
+ if (drw_h < height) drw_h = height;
+ }
+#endif
+
+ regs->DWINPOS = (config->dest.y << 16) | config->dest.x;
+ regs->DWINSZ = (config->dest.h << 16) | config->dest.w;
+
+ //D_INFO("pos: 0x%08x, size: 0x%08x\n", regs->DWINPOS, regs->DWINSZ);
+
+
+ regs->OCMD = OVERLAY_ENABLE;
+ regs->OCONFIG = CC_OUT_8BIT;
+
+ /*
+ * Calculate horizontal and vertical scaling factors and polyphase
+ * coefficients.
+ */
+
+ {
+ bool scaleChanged = false;
+ int xscaleInt, xscaleFract, yscaleInt, yscaleFract;
+ int xscaleIntUV, xscaleFractUV;
+ int yscaleIntUV, yscaleFractUV;
+ /* UV is half the size of Y -- YUV420 */
+ int uvratio = 2;
+ u32 newval;
+ coeffRec xcoeffY[N_HORIZ_Y_TAPS * N_PHASES];
+ coeffRec xcoeffUV[N_HORIZ_UV_TAPS * N_PHASES];
+ int i, j, pos;
+
+ /*
+ * Y down-scale factor as a multiple of 4096.
+ */
+ xscaleFract = (config->source.w << 12) / config->dest.w;
+ yscaleFract = (config->source.h << 12) / config->dest.h;
+
+ /* Calculate the UV scaling factor. */
+ xscaleFractUV = xscaleFract / uvratio;
+ yscaleFractUV = yscaleFract / uvratio;
+
+ /*
+ * To keep the relative Y and UV ratios exact, round the Y scales
+ * to a multiple of the Y/UV ratio.
+ */
+ xscaleFract = xscaleFractUV * uvratio;
+ yscaleFract = yscaleFractUV * uvratio;
+
+ /* Integer (un-multiplied) values. */
+ xscaleInt = xscaleFract >> 12;
+ yscaleInt = yscaleFract >> 12;
+
+ xscaleIntUV = xscaleFractUV >> 12;
+ yscaleIntUV = yscaleFractUV >> 12;
+
+ //D_INFO("xscale: 0x%x.%03x, yscale: 0x%x.%03x\n", xscaleInt,
+ // xscaleFract & 0xFFF, yscaleInt, yscaleFract & 0xFFF);
+ //D_INFO("UV xscale: 0x%x.%03x, UV yscale: 0x%x.%03x\n", xscaleIntUV,
+ // xscaleFractUV & 0xFFF, yscaleIntUV, yscaleFractUV & 0xFFF);
+
+ newval = (xscaleInt << 16) |
+ ((xscaleFract & 0xFFF) << 3) | ((yscaleFract & 0xFFF) << 20);
+ if (newval != regs->YRGBSCALE) {
+ scaleChanged = true;
+ regs->YRGBSCALE = newval;
+ }
+
+ newval = (xscaleIntUV << 16) | ((xscaleFractUV & 0xFFF) << 3) |
+ ((yscaleFractUV & 0xFFF) << 20);
+ if (newval != regs->UVSCALE) {
+ scaleChanged = true;
+ regs->UVSCALE = newval;
+ }
+
+ newval = yscaleInt << 16 | yscaleIntUV;
+ if (newval != regs->UVSCALEV) {
+ scaleChanged = true;
+ regs->UVSCALEV = newval;
+ }
+
+ /* Recalculate coefficients if the scaling changed. */
+
+ /*
+ * Only Horizontal coefficients so far.
+ */
+ if (scaleChanged) {
+ double fCutoffY;
+ double fCutoffUV;
+
+ fCutoffY = xscaleFract / 4096.0;
+ fCutoffUV = xscaleFractUV / 4096.0;
+
+ /* Limit to between 1.0 and 3.0. */
+ if (fCutoffY < MIN_CUTOFF_FREQ)
+ fCutoffY = MIN_CUTOFF_FREQ;
+ if (fCutoffY > MAX_CUTOFF_FREQ)
+ fCutoffY = MAX_CUTOFF_FREQ;
+ if (fCutoffUV < MIN_CUTOFF_FREQ)
+ fCutoffUV = MIN_CUTOFF_FREQ;
+ if (fCutoffUV > MAX_CUTOFF_FREQ)
+ fCutoffUV = MAX_CUTOFF_FREQ;
+
+ UpdateCoeff(N_HORIZ_Y_TAPS, fCutoffY, true, true, xcoeffY);
+ UpdateCoeff(N_HORIZ_UV_TAPS, fCutoffUV, true, false, xcoeffUV);
+
+ for (i = 0; i < N_PHASES; i++) {
+ for (j = 0; j < N_HORIZ_Y_TAPS; j++) {
+ pos = i * N_HORIZ_Y_TAPS + j;
+ regs->Y_HCOEFS[pos] = xcoeffY[pos].sign << 15 |
+ xcoeffY[pos].exponent << 12 |
+ xcoeffY[pos].mantissa;
+ }
+ }
+ for (i = 0; i < N_PHASES; i++) {
+ for (j = 0; j < N_HORIZ_UV_TAPS; j++) {
+ pos = i * N_HORIZ_UV_TAPS + j;
+ regs->UV_HCOEFS[pos] = xcoeffUV[pos].sign << 15 |
+ xcoeffUV[pos].exponent << 12 |
+ xcoeffUV[pos].mantissa;
+ }
+ }
+ }
+ }
+
+ switch (config->format) {
+ case DSPF_YV12:
+ case DSPF_I420:
+ //D_INFO("YUV420\n");
+#if 0
+ /* set UV vertical phase to -0.25 */
+ regs->UV_VPH = 0x30003000;
+#endif
+
+ regs->OSTRIDE = lock->pitch | (lock->pitch << 15);
+ regs->OCMD |= YUV_420;
+ break;
+
+ case DSPF_UYVY:
+ case DSPF_YUY2:
+ //D_INFO("YUV422\n");
+
+ regs->OSTRIDE = lock->pitch;
+ regs->OCMD |= YUV_422;
+
+ if (config->format == DSPF_UYVY)
+ regs->OCMD |= Y_SWAP;
+ break;
+
+ default:
+ D_BUG( "unexpected format" );
+ return;
+ }
+
+
+ /*
+ * Destination color keying.
+ */
+ regs->DCLRKV = PIXEL_RGB32 (config->dst_key.r, config->dst_key.g, config->dst_key.b );
+
+ switch (DFB_COLOR_BITS_PER_PIXEL( dfb_primary_layer_pixelformat() )) {
+ case 8:
+ regs->DCLRKM = 0xffffff;
+ break;
+ case 15:
+ regs->DCLRKM = 0x070707;
+ break;
+ case 16:
+ regs->DCLRKM = 0x070307;
+ break;
+ default:
+ regs->DCLRKM = 0;
+ break;
+ }
+
+ if(dfb_config->i8xx_overlay_pipe_b)
+ regs->OCONFIG |= OVERLAY_PIPE_B;
+
+ if (config->options & DLOP_DST_COLORKEY)
+ regs->DCLRKM |= DEST_KEY_ENABLE;
+
+ /*
+ * Disable source color keying if not selected
+ */
+ if (!(config->options & DLOP_SRC_COLORKEY)) {
+ regs -> SCLRKVH = 0;
+ regs -> SCLRKVL = 0;
+ regs -> SCLRKEN = 0;
+ }
+
+
+ //D_INFO("OCMD is 0x%08x\n", regs->OCMD);
+}
+