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/gl/Makefile.am | 36 ++ Source/DirectFB/gfxdrivers/gl/Makefile.in | 598 +++++++++++++++++ Source/DirectFB/gfxdrivers/gl/gl_2d.c | 928 +++++++++++++++++++++++++++ Source/DirectFB/gfxdrivers/gl/gl_2d.h | 93 +++ Source/DirectFB/gfxdrivers/gl/gl_gfxdriver.c | 217 +++++++ Source/DirectFB/gfxdrivers/gl/gl_gfxdriver.h | 63 ++ 6 files changed, 1935 insertions(+) create mode 100755 Source/DirectFB/gfxdrivers/gl/Makefile.am create mode 100755 Source/DirectFB/gfxdrivers/gl/Makefile.in create mode 100755 Source/DirectFB/gfxdrivers/gl/gl_2d.c create mode 100755 Source/DirectFB/gfxdrivers/gl/gl_2d.h create mode 100755 Source/DirectFB/gfxdrivers/gl/gl_gfxdriver.c create mode 100755 Source/DirectFB/gfxdrivers/gl/gl_gfxdriver.h (limited to 'Source/DirectFB/gfxdrivers/gl') diff --git a/Source/DirectFB/gfxdrivers/gl/Makefile.am b/Source/DirectFB/gfxdrivers/gl/Makefile.am new file mode 100755 index 0000000..ef5deb2 --- /dev/null +++ b/Source/DirectFB/gfxdrivers/gl/Makefile.am @@ -0,0 +1,36 @@ +## Makefile.am for DirectFB/src/core/gfxcards/gl + +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 + +gl_LTLIBRARIES = libdirectfb_gl.la + +if BUILD_STATIC +gl_DATA = $(gl_LTLIBRARIES:.la=.o) +endif + +gldir = $(MODULEDIR)/gfxdrivers + +libdirectfb_gl_la_SOURCES = \ + gl_2d.c \ + gl_2d.h \ + gl_gfxdriver.c \ + gl_gfxdriver.h + +libdirectfb_gl_la_LDFLAGS = \ + -module \ + -avoid-version \ + $(DFB_LDFLAGS) -lGL -lX11 + +libdirectfb_gl_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/gl/Makefile.in b/Source/DirectFB/gfxdrivers/gl/Makefile.in new file mode 100755 index 0000000..776f157 --- /dev/null +++ b/Source/DirectFB/gfxdrivers/gl/Makefile.in @@ -0,0 +1,598 @@ +# 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/gl +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)$(gldir)" "$(DESTDIR)$(gldir)" +glLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(gl_LTLIBRARIES) +libdirectfb_gl_la_DEPENDENCIES = \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/src/libdirectfb.la +am_libdirectfb_gl_la_OBJECTS = gl_2d.lo gl_gfxdriver.lo +libdirectfb_gl_la_OBJECTS = $(am_libdirectfb_gl_la_OBJECTS) +libdirectfb_gl_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libdirectfb_gl_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_gl_la_SOURCES) +DIST_SOURCES = $(libdirectfb_gl_la_SOURCES) +glDATA_INSTALL = $(INSTALL_DATA) +DATA = $(gl_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 + +gl_LTLIBRARIES = libdirectfb_gl.la +@BUILD_STATIC_TRUE@gl_DATA = $(gl_LTLIBRARIES:.la=.o) +gldir = $(MODULEDIR)/gfxdrivers +libdirectfb_gl_la_SOURCES = \ + gl_2d.c \ + gl_2d.h \ + gl_gfxdriver.c \ + gl_gfxdriver.h + +libdirectfb_gl_la_LDFLAGS = \ + -module \ + -avoid-version \ + $(DFB_LDFLAGS) -lGL -lX11 + +libdirectfb_gl_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/gl/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu gfxdrivers/gl/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-glLTLIBRARIES: $(gl_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(gldir)" || $(MKDIR_P) "$(DESTDIR)$(gldir)" + @list='$(gl_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(glLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(gldir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(glLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(gldir)/$$f"; \ + else :; fi; \ + done + +uninstall-glLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(gl_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(gldir)/$$p'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(gldir)/$$p"; \ + done + +clean-glLTLIBRARIES: + -test -z "$(gl_LTLIBRARIES)" || rm -f $(gl_LTLIBRARIES) + @list='$(gl_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_gl.la: $(libdirectfb_gl_la_OBJECTS) $(libdirectfb_gl_la_DEPENDENCIES) + $(libdirectfb_gl_la_LINK) -rpath $(gldir) $(libdirectfb_gl_la_OBJECTS) $(libdirectfb_gl_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_2d.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_gfxdriver.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-glDATA: $(gl_DATA) + @$(NORMAL_INSTALL) + test -z "$(gldir)" || $(MKDIR_P) "$(DESTDIR)$(gldir)" + @list='$(gl_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(glDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(gldir)/$$f'"; \ + $(glDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(gldir)/$$f"; \ + done + +uninstall-glDATA: + @$(NORMAL_UNINSTALL) + @list='$(gl_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(gldir)/$$f'"; \ + rm -f "$(DESTDIR)$(gldir)/$$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)$(gldir)" "$(DESTDIR)$(gldir)"; 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-glLTLIBRARIES 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-glDATA install-glLTLIBRARIES + +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-glDATA uninstall-glLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-glLTLIBRARIES 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-glDATA \ + install-glLTLIBRARIES install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-glDATA \ + uninstall-glLTLIBRARIES + +%.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/gl/gl_2d.c b/Source/DirectFB/gfxdrivers/gl/gl_2d.c new file mode 100755 index 0000000..a56f845 --- /dev/null +++ b/Source/DirectFB/gfxdrivers/gl/gl_2d.c @@ -0,0 +1,928 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + 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. +*/ + +//#define DIRECT_ENABLE_DEBUG + +#include + +#include + +#include +#include +#include + +#include +#include +#include + +#include + +#include "gl_2d.h" +#include "gl_gfxdriver.h" + + +D_DEBUG_DOMAIN( GL__2D, "GL/2D", "OpenGL 2D Acceleration" ); + +/* + * State validation flags. + * + * There's no prefix because of the macros below. + */ +enum { + DESTINATION = 0x00000001, + SCISSOR = 0x00000002, + MATRIX = 0x00000004, + RENDER_OPTS = 0x00000008, + + COLOR_DRAW = 0x00000010, + + SOURCE = 0x00000100, + COLOR_BLIT = 0x00000200, + + BLENDFUNC = 0x00010000, + + ALL = 0x0001031F +}; + +/* + * State handling macros. + */ + +#define GL_VALIDATE(flags) do { gdev->v_flags |= (flags); } while (0) +#define GL_INVALIDATE(flags) do { gdev->v_flags &= ~(flags); } while (0) + +#define GL_CHECK_VALIDATE(flag) do { \ + if ((gdev->v_flags & flag) != flag) \ + gl_validate_##flag( gdrv, gdev, state ); \ + } while (0) + + +/**********************************************************************************************************************/ + +/* + * Called by glSetState() to ensure that the destination parameters are properly set + * for execution of rendering functions. + */ +static inline void +gl_validate_DESTINATION( GLDriverData *gdrv, + GLDeviceData *gdev, + CardState *state ) +{ + CoreSurface *surface = state->destination; + GLBufferData *buffer = state->dst.handle; + + D_DEBUG_AT( GL__2D, "%s( %p )\n", __FUNCTION__, buffer ); + + D_MAGIC_ASSERT( buffer, GLBufferData ); + + if (buffer->flags & GLBF_UPDATE_TARGET) { + glViewport( 0, 0, surface->config.size.w, surface->config.size.h ); + + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glOrtho( 0, surface->config.size.w, 0, surface->config.size.h, -1, 1 ); + + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); + glScalef( 1, -1, 1 ); + glTranslatef( 0, - surface->config.size.h, 0 ); + + glShadeModel( GL_FLAT ); + glDisable( GL_LIGHTING ); + + glDepthMask( GL_FALSE ); + glDisable( GL_DEPTH_TEST ); + + glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST ); + glDisable( GL_CULL_FACE ); + + glEnable( GL_SCISSOR_TEST ); + + GL_INVALIDATE( ALL ); + + buffer->flags &= ~GLBF_UPDATE_TARGET; + } + + /* Set the flag. */ + GL_VALIDATE( DESTINATION ); +} + +/* + * Called by glSetState() to ensure that the clip is properly set + * for execution of rendering functions. + */ +static inline void +gl_validate_SCISSOR( GLDriverData *gdrv, + GLDeviceData *gdev, + CardState *state ) +{ + CoreSurface *surface = state->destination; + + D_DEBUG_AT( GL__2D, "%s()\n", __FUNCTION__ ); + + glScissor( state->clip.x1, + surface->config.size.h - state->clip.y2 - 1, + state->clip.x2 - state->clip.x1 + 1, + state->clip.y2 - state->clip.y1 + 1 ); + + /* Set the flag. */ + GL_VALIDATE( SCISSOR ); +} + +/* + * Called by glSetState() to ensure that the matrix is properly set + * for execution of rendering functions. + */ +static inline void +gl_validate_MATRIX( GLDriverData *gdrv, + GLDeviceData *gdev, + CardState *state ) +{ + CoreSurface *surface = state->destination; + + D_DEBUG_AT( GL__2D, "%s()\n", __FUNCTION__ ); + + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); + glScalef( 1, -1, 1 ); + glTranslatef( 0, - surface->config.size.h, 0 ); + + if (state->render_options & DSRO_MATRIX) { + float m[16] = { 0 }; + +#define M(n) (state->matrix[n] / 65536.0f) + + m[0] = M(0); m[4] = M(1); m[ 8] = 0.0f; m[12] = M(2); + m[1] = M(3); m[5] = M(4); m[ 9] = 0.0f; m[13] = M(5); + m[2] = 0.0f; m[6] = 0.0f; m[10] = 1.0f; m[14] = 0.0f; + m[3] = M(6); m[7] = M(7); m[11] = 0.0f; m[15] = M(8); + +#undef M + + D_DEBUG_AT( GL__2D, " -> %7.2f %7.2f %7.2f %7.2f\n", m[0], m[4], m[8], m[12] ); + D_DEBUG_AT( GL__2D, " -> %7.2f %7.2f %7.2f %7.2f\n", m[1], m[5], m[9], m[13] ); + D_DEBUG_AT( GL__2D, " -> %7.2f %7.2f %7.2f %7.2f\n", m[2], m[6], m[10], m[14] ); + D_DEBUG_AT( GL__2D, " -> %7.2f %7.2f %7.2f %7.2f\n", m[3], m[7], m[11], m[15] ); + + glMultMatrixf( m ); + } + + /* Set the flag. */ + GL_VALIDATE( MATRIX ); +} + +/* + * Called by glSetState() to ensure that the rendering options are properly set + * for execution of rendering functions. + */ +static inline void +gl_validate_RENDER_OPTS( GLDriverData *gdrv, + GLDeviceData *gdev, + CardState *state ) +{ + D_DEBUG_AT( GL__2D, "%s()\n", __FUNCTION__ ); + + if (state->render_options & DSRO_ANTIALIAS) { + glEnable( GL_LINE_SMOOTH ); + //glEnable( GL_POLYGON_SMOOTH ); + } + else { + glDisable( GL_LINE_SMOOTH ); + //glDisable( GL_POLYGON_SMOOTH ); + } + + /* Set the flag. */ + GL_VALIDATE( RENDER_OPTS ); +} + +/* + * Called by glSetState() to ensure that the color is properly set + * for execution of drawing functions. + */ +static inline void +gl_validate_COLOR_DRAW( GLDriverData *gdrv, + GLDeviceData *gdev, + CardState *state ) +{ + D_DEBUG_AT( GL__2D, "%s()\n", __FUNCTION__ ); + + if (state->drawingflags & DSDRAW_SRC_PREMULTIPLY) { + int A = state->color.a + 1; + + glColor4ub( (state->color.r * A) >> 8, + (state->color.g * A) >> 8, + (state->color.b * A) >> 8, state->color.a ); + } + else + glColor4ub( state->color.r, state->color.g, state->color.b, state->color.a ); + + /* Set the flag. */ + GL_VALIDATE( COLOR_DRAW ); + + /* Invalidates blitting color. */ + GL_INVALIDATE( COLOR_BLIT ); +} + +/* + * Called by glSetState() to ensure that the source parameters are properly set + * for execution of blitting functions. + */ +static inline void +gl_validate_SOURCE( GLDriverData *gdrv, + GLDeviceData *gdev, + CardState *state ) +{ + GLBufferData *buffer = state->src.handle; + + D_DEBUG_AT( GL__2D, "%s( %p )\n", __FUNCTION__, buffer ); + + D_MAGIC_ASSERT( buffer, GLBufferData ); + + glBindTexture( GL_TEXTURE_RECTANGLE_ARB, buffer->texture ); + + if (buffer->flags & GLBF_UPDATE_TEXTURE) { + glTexParameterf( GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); + glTexParameterf( GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); + + glTexParameterf( GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE ); + glTexParameterf( GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ); + + buffer->flags &= ~GLBF_UPDATE_TEXTURE; + } + + /* Set the flag. */ + GL_VALIDATE( SOURCE ); +} + +/* + * Called by glSetState() to ensure that the color is properly set + * for execution of blitting functions. + */ +static inline void +gl_validate_COLOR_BLIT( GLDriverData *gdrv, + GLDeviceData *gdev, + CardState *state ) +{ + int r, g, b, a; + + D_DEBUG_AT( GL__2D, "%s()\n", __FUNCTION__ ); + + if (state->blittingflags & DSBLIT_COLORIZE) { + r = state->color.r; + g = state->color.g; + b = state->color.b; + } + else + r = g = b = 0xff; + + if (state->blittingflags & DSBLIT_BLEND_COLORALPHA) + a = state->color.a; + else + a = 0xff; + + if (state->blittingflags & DSBLIT_SRC_PREMULTCOLOR) { + int A = state->color.a + 1; + + r = (r * A) >> 8; + g = (g * A) >> 8; + b = (b * A) >> 8; + } + + glColor4ub( r, g, b, a ); + + /* Set the flag. */ + GL_VALIDATE( COLOR_BLIT ); + + /* Invalidates drawing color. */ + GL_INVALIDATE( COLOR_DRAW ); +} + +/* + * Called by glSetState() to ensure that the blend functions are properly set + * for execution of drawing and blitting functions. + */ +static inline void +gl_validate_BLENDFUNC( GLDriverData *gdrv, + GLDeviceData *gdev, + CardState *state ) +{ + GLenum src = GL_ZERO, dst = GL_ZERO; + + D_DEBUG_AT( GL__2D, "%s()\n", __FUNCTION__ ); + + switch (state->src_blend) { + case DSBF_ZERO: + break; + + case DSBF_ONE: + src = GL_ONE; + break; + + case DSBF_SRCCOLOR: + src = GL_SRC_COLOR; + break; + + case DSBF_INVSRCCOLOR: + src = GL_ONE_MINUS_SRC_COLOR; + break; + + case DSBF_SRCALPHA: + src = GL_SRC_ALPHA; + break; + + case DSBF_INVSRCALPHA: + src = GL_ONE_MINUS_SRC_ALPHA; + break; + + case DSBF_DESTALPHA: + src = GL_DST_ALPHA; + break; + + case DSBF_INVDESTALPHA: + src = GL_ONE_MINUS_DST_ALPHA; + break; + + case DSBF_DESTCOLOR: + src = GL_DST_COLOR; + break; + + case DSBF_INVDESTCOLOR: + src = GL_ONE_MINUS_DST_COLOR; + break; + + case DSBF_SRCALPHASAT: + src = GL_SRC_ALPHA_SATURATE; + break; + + default: + D_BUG( "unexpected src blend function %d", state->src_blend ); + } + + switch (state->dst_blend) { + case DSBF_ZERO: + break; + + case DSBF_ONE: + dst = GL_ONE; + break; + + case DSBF_SRCCOLOR: + dst = GL_SRC_COLOR; + break; + + case DSBF_INVSRCCOLOR: + dst = GL_ONE_MINUS_SRC_COLOR; + break; + + case DSBF_SRCALPHA: + dst = GL_SRC_ALPHA; + break; + + case DSBF_INVSRCALPHA: + dst = GL_ONE_MINUS_SRC_ALPHA; + break; + + case DSBF_DESTALPHA: + dst = GL_DST_ALPHA; + break; + + case DSBF_INVDESTALPHA: + dst = GL_ONE_MINUS_DST_ALPHA; + break; + + case DSBF_DESTCOLOR: + dst = GL_DST_COLOR; + break; + + case DSBF_INVDESTCOLOR: + dst = GL_ONE_MINUS_DST_COLOR; + break; + + case DSBF_SRCALPHASAT: + dst = GL_SRC_ALPHA_SATURATE; + break; + + default: + D_BUG( "unexpected dst blend function %d", state->dst_blend ); + } + + glBlendFunc( src, dst ); + + /* Set the flag. */ + GL_VALIDATE( BLENDFUNC ); +} + +/**********************************************************************************************************************/ + +/* + * Wait for the blitter to be idle. + * + * This function is called before memory that has been written to by the hardware is about to be + * accessed by the CPU (software driver) or another hardware entity like video encoder (by Flip()). + * It can also be called by applications explicitly, e.g. at the end of a benchmark loop to include + * execution time of queued commands in the measurement. + */ +DFBResult +glEngineSync( void *drv, void *dev ) +{ + GLDriverData *gdrv = drv; + + D_DEBUG_AT( GL__2D, "%s()\n", __FUNCTION__ ); + + if (gdrv->calls > 0) { + glFinish(); + + gdrv->calls = 0; + } + + return DFB_OK; +} + +/* + * Reset the graphics engine. + */ +void +glEngineReset( void *drv, void *dev ) +{ + D_DEBUG_AT( GL__2D, "%s()\n", __FUNCTION__ ); +} + +/* + * Start processing of queued commands if required. + * + * This function is called before returning from the graphics core to the application. + * Usually that's after each rendering function. The only functions causing multiple commands + * to be queued with a single emition at the end are DrawString(), TileBlit(), BatchBlit(), + * DrawLines() and possibly FillTriangle() which is emulated using multiple FillRectangle() calls. + */ +void +glEmitCommands( void *drv, void *dev ) +{ + GLDriverData *gdrv = drv; + + D_DEBUG_AT( GL__2D, "%s()\n", __FUNCTION__ ); + + if (gdrv->calls > 523) { + glFlush(); + + gdrv->calls = 1; + } +} + +/**********************************************************************************************************************/ + +/* + * Check for acceleration of 'accel' using the given 'state'. + */ +void +glCheckState( void *drv, + void *dev, + CardState *state, + DFBAccelerationMask accel ) +{ + D_DEBUG_AT( GL__2D, "%s( state %p, accel 0x%08x ) <- dest %p [%lu]\n", __FUNCTION__, + state, accel, state->destination, state->dst.offset ); + + /* Return if the desired function is not supported at all. */ + if (accel & ~(GL_SUPPORTED_DRAWINGFUNCTIONS | GL_SUPPORTED_BLITTINGFUNCTIONS)) { + D_DEBUG_AT( GL__2D, " -> unsupported function\n" ); + return; + } + + /* Return if the destination format is not supported. */ + switch (state->destination->config.format) { + case DSPF_ARGB: + case DSPF_RGB32: + break; + + default: + D_DEBUG_AT( GL__2D, " -> unsupported destination format %s\n", + dfb_pixelformat_name(state->destination->config.format) ); + return; + } + + /* Check if drawing or blitting is requested. */ + if (DFB_DRAWING_FUNCTION( accel )) { + /* Return if unsupported drawing flags are set. */ + if (state->drawingflags & ~GL_SUPPORTED_DRAWINGFLAGS) { + D_DEBUG_AT( GL__2D, " -> unsupported drawing flags 0x%08x\n", state->drawingflags ); + return; + } + } + else { + /* Return if the source format is not supported. */ + switch (state->source->config.format) { + case DSPF_ARGB: + case DSPF_RGB32: + break; + + default: + D_DEBUG_AT( GL__2D, " -> unsupported source format %s\n", + dfb_pixelformat_name(state->source->config.format) ); + return; + } + + /* Return if unsupported blitting flags are set. */ + if (state->blittingflags & ~GL_SUPPORTED_BLITTINGFLAGS) { + D_DEBUG_AT( GL__2D, " -> unsupported blitting flags 0x%08x\n", state->blittingflags ); + return; + } + } + + /* Enable acceleration of the function. */ + state->accel |= accel; + + D_DEBUG_AT( GL__2D, " => OK\n" ); +} + +/* + * Make sure that the hardware is programmed for execution of 'accel' according to the 'state'. + */ +void +glSetState( void *drv, + void *dev, + GraphicsDeviceFuncs *funcs, + CardState *state, + DFBAccelerationMask accel ) +{ + GLDriverData *gdrv = drv; + GLDeviceData *gdev = dev; + StateModificationFlags modified = state->mod_hw; + + D_DEBUG_AT( GL__2D, "%s( state %p, accel 0x%08x ) <- dest %p, modified 0x%08x\n", __FUNCTION__, + state, accel, state->destination, modified ); + + /* + * 1) Invalidate hardware states + * + * Each modification to the hw independent state invalidates one or more hardware states. + */ + + /* Simply invalidate all? */ + if (modified == SMF_ALL) { + GL_INVALIDATE( ALL ); + } + else if (modified) { + if (modified & SMF_DESTINATION) + GL_INVALIDATE( DESTINATION ); + + if (modified & SMF_CLIP) + GL_INVALIDATE( SCISSOR ); + + if (modified & SMF_MATRIX) + GL_INVALIDATE( MATRIX ); + + if (modified & SMF_RENDER_OPTIONS) + GL_INVALIDATE( MATRIX | RENDER_OPTS ); + + if (modified & SMF_COLOR) + GL_INVALIDATE( COLOR_DRAW | COLOR_BLIT ); + + if (modified & SMF_DRAWING_FLAGS) + GL_INVALIDATE( COLOR_DRAW ); + + if (modified & SMF_BLITTING_FLAGS) + GL_INVALIDATE( COLOR_BLIT ); + + if (modified & SMF_SOURCE) + GL_INVALIDATE( SOURCE ); + + if (modified & (SMF_SRC_BLEND | SMF_DST_BLEND)) + GL_INVALIDATE( BLENDFUNC ); + } + + /* + * 2) Validate hardware states + * + * Each function has its own set of states that need to be validated. + */ + + /* Always requiring valid destination, clip, matrix and options... */ + GL_CHECK_VALIDATE( DESTINATION ); + GL_CHECK_VALIDATE( SCISSOR ); + GL_CHECK_VALIDATE( MATRIX ); + GL_CHECK_VALIDATE( RENDER_OPTS ); + + /* Depending on the function... */ + switch (accel) { + case DFXL_FILLRECTANGLE: + case DFXL_DRAWRECTANGLE: + case DFXL_DRAWLINE: + case DFXL_FILLTRIANGLE: + glDisable( GL_TEXTURE_RECTANGLE_ARB ); + + /* ...require valid drawing color. */ + GL_CHECK_VALIDATE( COLOR_DRAW ); + + /* If alpha blending is used... */ + if (state->drawingflags & DSDRAW_BLEND) { + /* ...require valid blend functions. */ + GL_CHECK_VALIDATE( BLENDFUNC ); + + glEnable( GL_BLEND ); + } + else + glDisable( GL_BLEND ); + + + /* + * 3) Tell which functions can be called without further validation, i.e. SetState() + * + * When the hw independent state is changed, this collection is reset. + */ + state->set = GL_SUPPORTED_DRAWINGFUNCTIONS; + break; + + case DFXL_BLIT: + case DFXL_STRETCHBLIT: + glEnable( GL_TEXTURE_RECTANGLE_ARB ); + + /* ...require valid source. */ + GL_CHECK_VALIDATE( SOURCE ); + + + /* If alpha blending is used... */ + if (state->blittingflags & (DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_BLEND_COLORALPHA)) { + /* ...require valid blend functions. */ + GL_CHECK_VALIDATE( BLENDFUNC ); + + glEnable( GL_BLEND ); + } + else + glDisable( GL_BLEND ); + + + /* If colorizing or premultiplication of global alpha is used... */ + if (state->blittingflags & (DSBLIT_COLORIZE | DSBLIT_SRC_PREMULTCOLOR | DSBLIT_BLEND_COLORALPHA)) { + /* ...require valid color. */ + GL_CHECK_VALIDATE( COLOR_BLIT ); + + /* Enable texture modulation */ + glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); + } + else + /* Disable texture modulation */ + glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE ); + + + /* + * 3) Tell which functions can be called without further validation, i.e. SetState() + * + * When the hw independent state is changed, this collection is reset. + */ + state->set = GL_SUPPORTED_BLITTINGFUNCTIONS; + break; + + default: + D_BUG( "unexpected drawing/blitting function" ); + break; + } + + gdrv->blittingflags = state->blittingflags; + + /* + * 4) Clear modification flags + * + * All flags have been evaluated in 1) and remembered for further validation. + * If the hw independent state is not modified, this function won't get called + * for subsequent rendering functions, unless they aren't defined by 3). + */ + state->mod_hw = 0; +} + +/**********************************************************************************************************************/ + +/* + * Render a filled rectangle using the current hardware state. + */ +bool +glFillRectangle( void *drv, void *dev, DFBRectangle *rect ) +{ + GLDriverData *gdrv = drv; + + int x1 = rect->x; + int y1 = rect->y; + int x2 = rect->w + x1; + int y2 = rect->h + y1; + + D_DEBUG_AT( GL__2D, "%s( %4d,%4d-%4dx%4d )\n", __FUNCTION__, DFB_RECTANGLE_VALS( rect ) ); + + glBegin( GL_QUADS ); + + glVertex2i( x1, y1 ); + glVertex2i( x2, y1 ); + glVertex2i( x2, y2 ); + glVertex2i( x1, y2 ); + + glEnd(); + + + gdrv->calls += 1 + rect->w * rect->h / (23 * 42); + + return true; +} + +/* + * Render a rectangle outline using the current hardware state. + */ +bool +glDrawRectangle( void *drv, void *dev, DFBRectangle *rect ) +{ + GLDriverData *gdrv = drv; + + int x1 = rect->x + 1; + int y1 = rect->y; + int x2 = rect->x + rect->w; + int y2 = rect->y + rect->h - 1; + + D_DEBUG_AT( GL__2D, "%s( %4d,%4d-%4dx%4d )\n", __FUNCTION__, DFB_RECTANGLE_VALS( rect ) ); + + glBegin( GL_LINE_LOOP ); + + glVertex2i( x1, y1 ); + glVertex2i( x2, y1 ); + glVertex2i( x2, y2 ); + glVertex2i( x1, y2 ); + + glEnd(); + + + gdrv->calls++; + + return true; +} + +/* + * Render a line using the current hardware state. + */ +bool +glDrawLine( void *drv, void *dev, DFBRegion *line ) +{ + GLDriverData *gdrv = drv; + + int x1 = line->x1; + int y1 = line->y1; + int x2 = line->x2; + int y2 = line->y2; + + D_DEBUG_AT( GL__2D, "%s( %4d,%4d-%4d,%4d )\n", __FUNCTION__, DFB_REGION_VALS( line ) ); + + glBegin( GL_LINES ); + + glVertex2i( x1, y1 ); + glVertex2i( x2, y2 ); + + glEnd(); + + + gdrv->calls++; + + return true; +} + +/* + * Render a line using the current hardware state. + */ +bool +glFillTriangle( void *drv, void *dev, DFBTriangle *tri ) +{ + GLDriverData *gdrv = drv; + + D_DEBUG_AT( GL__2D, "%s( %4d,%4d-%4d,%4d-%4d,%4d )\n", __FUNCTION__, + tri->x1, tri->y1, tri->x2, tri->y2, tri->x3, tri->y3 ); + + glBegin( GL_TRIANGLES ); + + glVertex2i( tri->x1, tri->y1 ); + glVertex2i( tri->x2, tri->y2 ); + glVertex2i( tri->x3, tri->y3 ); + + glEnd(); + + + gdrv->calls += 23; + + return true; +} + +/* + * Blit a rectangle using the current hardware state. + */ +bool +glBlit( void *drv, void *dev, DFBRectangle *srect, int dx, int dy ) +{ + GLDriverData *gdrv = drv; + + int x1 = dx; + int y1 = dy; + int x2 = srect->w + x1; + int y2 = srect->h + y1; + + int tx1 = srect->x; + int ty1 = srect->y; + int tx2 = srect->w + tx1; + int ty2 = srect->h + ty1; + + D_DEBUG_AT( GL__2D, "%s( %4d,%4d-%4dx%4d <- %4d,%4d )\n", __FUNCTION__, + dx, dy, srect->w, srect->h, srect->x, srect->y ); + + /* Might also use GL_TEXTURE matrix, but isn't this less overhead in state management? */ + if (gdrv->blittingflags & DSBLIT_ROTATE180) { + int tmp; + + tmp = tx1; tx1 = tx2; tx2 = tmp; + tmp = ty1; ty1 = ty2; ty2 = tmp; + } + + glBegin( GL_QUADS ); + + glTexCoord2i( tx1, ty1 ); + glVertex2i( x1, y1 ); + + glTexCoord2i( tx2, ty1 ); + glVertex2i( x2, y1 ); + + glTexCoord2i( tx2, ty2 ); + glVertex2i( x2, y2 ); + + glTexCoord2i( tx1, ty2 ); + glVertex2i( x1, y2 ); + + glEnd(); + + + gdrv->calls += 1 + srect->w * srect->h / (23 * 42); + + return true; +} + +/* + * Blit a scaled rectangle using the current hardware state. + */ +bool +glStretchBlit( void *drv, void *dev, DFBRectangle *srect, DFBRectangle *drect ) +{ + GLDriverData *gdrv = drv; + + int x1 = drect->x; + int y1 = drect->y; + int x2 = drect->w + x1; + int y2 = drect->h + y1; + + int tx1 = srect->x; + int ty1 = srect->y; + int tx2 = srect->w + tx1; + int ty2 = srect->h + ty1; + + D_DEBUG_AT( GL__2D, "%s( %4d,%4d-%4dx%4d <- %4d,%4d-%4dx%4d )\n", __FUNCTION__, + DFB_RECTANGLE_VALS( drect ), DFB_RECTANGLE_VALS( srect ) ); + + /* Might also use GL_TEXTURE matrix, but isn't this less overhead in state management? */ + if (gdrv->blittingflags & DSBLIT_ROTATE180) { + int tmp; + + tmp = tx1; tx1 = tx2; tx2 = tmp; + tmp = ty1; ty1 = ty2; ty2 = tmp; + } + + glBegin( GL_QUADS ); + + glTexCoord2i( tx1, ty1 ); + glVertex2i( x1, y1 ); + + glTexCoord2i( tx2, ty1 ); + glVertex2i( x2, y1 ); + + glTexCoord2i( tx2, ty2 ); + glVertex2i( x2, y2 ); + + glTexCoord2i( tx1, ty2 ); + glVertex2i( x1, y2 ); + + glEnd(); + + + gdrv->calls += 1 + drect->w * drect->h / (23 * 42); + + return true; +} + diff --git a/Source/DirectFB/gfxdrivers/gl/gl_2d.h b/Source/DirectFB/gfxdrivers/gl/gl_2d.h new file mode 100755 index 0000000..fa67106 --- /dev/null +++ b/Source/DirectFB/gfxdrivers/gl/gl_2d.h @@ -0,0 +1,93 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + 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 __GL_2D_H__ +#define __GL_2D_H__ + + +#define GL_SUPPORTED_DRAWINGFLAGS (DSDRAW_BLEND | \ + DSDRAW_SRC_PREMULTIPLY) + +#define GL_SUPPORTED_DRAWINGFUNCTIONS (DFXL_FILLRECTANGLE | \ + DFXL_DRAWRECTANGLE | \ + DFXL_DRAWLINE | \ + DFXL_FILLTRIANGLE) + +#define GL_SUPPORTED_BLITTINGFLAGS (DSBLIT_BLEND_ALPHACHANNEL | \ + DSBLIT_BLEND_COLORALPHA | \ + DSBLIT_COLORIZE | \ + DSBLIT_ROTATE180 | \ + DSBLIT_SRC_PREMULTCOLOR) + +#define GL_SUPPORTED_BLITTINGFUNCTIONS (DFXL_BLIT | \ + DFXL_STRETCHBLIT) + + +DFBResult glEngineSync ( void *drv, + void *dev ); + +void glEngineReset ( void *drv, + void *dev ); + +void glEmitCommands ( void *drv, + void *dev ); + +void glCheckState ( void *drv, + void *dev, + CardState *state, + DFBAccelerationMask accel ); + +void glSetState ( void *drv, + void *dev, + GraphicsDeviceFuncs *funcs, + CardState *state, + DFBAccelerationMask accel ); + +bool glFillRectangle( void *drv, + void *dev, + DFBRectangle *rect ); + +bool glDrawRectangle( void *drv, + void *dev, + DFBRectangle *rect ); + +bool glDrawLine ( void *drv, + void *dev, + DFBRegion *line ); + +bool glFillTriangle ( void *drv, + void *dev, + DFBTriangle *tri ); + +bool glBlit ( void *drv, + void *dev, + DFBRectangle *srect, + int dx, + int dy ); + +bool glStretchBlit ( void *drv, + void *dev, + DFBRectangle *srect, + DFBRectangle *drect ); + +#endif + diff --git a/Source/DirectFB/gfxdrivers/gl/gl_gfxdriver.c b/Source/DirectFB/gfxdrivers/gl/gl_gfxdriver.c new file mode 100755 index 0000000..1f84097 --- /dev/null +++ b/Source/DirectFB/gfxdrivers/gl/gl_gfxdriver.c @@ -0,0 +1,217 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + 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 "gl_2d.h" +#include "gl_gfxdriver.h" + +D_DEBUG_DOMAIN( GL_Driver, "GL/Driver", "GL graphics driver for X11" ); + +#include + +DFB_GRAPHICS_DRIVER( gl ) + +static int error_code = 0; + +/**********************************************************************************************************************/ + +static int +error_handler( Display *display, XErrorEvent *event ) +{ + char buf[512]; + + XGetErrorText( display, event->error_code, buf, sizeof(buf) ); + + D_ERROR( "GL/Driver: Error! %s\n", buf ); + + error_code = event->error_code; + + return 0; +} + +/**********************************************************************************************************************/ + +static int +driver_probe( CoreGraphicsDevice *device ) +{ + switch (dfb_system_type()) { + case CORE_X11: { + int ee; + DFBX11 *x11 = dfb_system_data(); + + return glXQueryExtension( x11->display, &ee, &ee ); + } + + default: + break; + } + + return 0; +} + +static void +driver_get_info( CoreGraphicsDevice *device, + GraphicsDriverInfo *info ) +{ + /* fill driver info structure */ + snprintf( info->name, + DFB_GRAPHICS_DRIVER_INFO_NAME_LENGTH, + "OpenGL Driver" ); + + snprintf( info->vendor, + DFB_GRAPHICS_DRIVER_INFO_VENDOR_LENGTH, + "Denis Oliver Kropp" ); + + info->version.major = 0; + info->version.minor = 5; + + info->driver_data_size = sizeof(GLDriverData); + info->device_data_size = sizeof(GLDeviceData); +} + +static DFBResult +driver_init_driver( CoreGraphicsDevice *device, + GraphicsDeviceFuncs *funcs, + void *driver_data, + void *device_data, + CoreDFB *core ) +{ + D_DEBUG_AT( GL_Driver, "%s()\n", __FUNCTION__ ); + + /* initialize function pointers */ + funcs->EngineSync = glEngineSync; + funcs->EngineReset = glEngineReset; + funcs->EmitCommands = glEmitCommands; + funcs->CheckState = glCheckState; + funcs->SetState = glSetState; + funcs->FillRectangle = glFillRectangle; + funcs->DrawRectangle = glDrawRectangle; + funcs->DrawLine = glDrawLine; + funcs->FillTriangle = glFillTriangle; + funcs->Blit = glBlit; + funcs->StretchBlit = glStretchBlit; + + /* Choose accelerated font format */ + if (!dfb_config->software_only) { + dfb_config->font_format = DSPF_ARGB; + dfb_config->font_premult = true; + } + + return DFB_OK; +} + +static DFBResult +driver_init_device( CoreGraphicsDevice *device, + GraphicsDeviceInfo *device_info, + void *driver_data, + void *device_data ) +{ + const char *renderer; + Display *display; + XVisualInfo *visual; + GLXContext context; + DFBX11 *x11; + + int attr[] = { + GLX_RGBA, + GLX_RED_SIZE, 1, + GLX_GREEN_SIZE, 1, + GLX_BLUE_SIZE, 1, + None + }; + + D_DEBUG_AT( GL_Driver, "%s()\n", __FUNCTION__ ); + + XSetErrorHandler( error_handler ); + error_code = 0; + + x11 = dfb_system_data(); + + display = x11->display; + + visual = glXChooseVisual( display, DefaultScreen(display), attr ); + if (!visual || error_code) { + D_ERROR( "GL/Driver: Could not find a suitable visual!\n" ); + return DFB_INIT; + } + + context = glXCreateContext( display, visual, NULL, GL_TRUE ); + if (!context || error_code) { + D_ERROR( "GL/Driver: Could not create a context!\n" ); + return DFB_INIT; + } + + glXMakeCurrent( display, RootWindowOfScreen(DefaultScreenOfDisplay(display)), context ); + if( error_code ) + return DFB_INIT; + + renderer = (const char*) glGetString( GL_RENDERER ); + + glXMakeCurrent( display, None, NULL ); + + /* fill device info */ + snprintf( device_info->vendor, DFB_GRAPHICS_DEVICE_INFO_VENDOR_LENGTH, "OpenGL Acceleration -" ); + snprintf( device_info->name, DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "%s", renderer ?: "Unknown" ); + + glXDestroyContext( display, context ); + + /* device limitations */ + device_info->limits.surface_byteoffset_alignment = 8; + device_info->limits.surface_bytepitch_alignment = 8; + + device_info->caps.flags = CCF_CLIPPING | CCF_RENDEROPTS; + device_info->caps.accel = GL_SUPPORTED_DRAWINGFUNCTIONS | + GL_SUPPORTED_BLITTINGFUNCTIONS; + device_info->caps.drawing = GL_SUPPORTED_DRAWINGFLAGS; + device_info->caps.blitting = GL_SUPPORTED_BLITTINGFLAGS; + + return DFB_OK; +} + +static void +driver_close_device( CoreGraphicsDevice *device, + void *driver_data, + void *device_data ) +{ +} + +static void +driver_close_driver( CoreGraphicsDevice *device, + void *driver_data ) +{ +} + diff --git a/Source/DirectFB/gfxdrivers/gl/gl_gfxdriver.h b/Source/DirectFB/gfxdrivers/gl/gl_gfxdriver.h new file mode 100755 index 0000000..4752349 --- /dev/null +++ b/Source/DirectFB/gfxdrivers/gl/gl_gfxdriver.h @@ -0,0 +1,63 @@ +/* + (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) + (c) Copyright 2000-2004 Convergence (integrated media) GmbH + + All rights reserved. + + 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 __GL_GFXDRIVER_H__ +#define __GL_GFXDRIVER_H__ + +#include + + +typedef enum { + GLBF_UPDATE_TARGET = 0x00000001, + GLBF_UPDATE_TEXTURE = 0x00000002, +} GLBufferFlags; + +typedef struct { + int magic; + + /* Update flags for OpenGL driver */ + GLBufferFlags flags; + + /* Texture object bound to buffer */ + GLuint texture; +} GLBufferData; + + +typedef struct { + /* validation flags */ + int v_flags; + + /** Add shared data here... **/ +} GLDeviceData; + + +typedef struct { + DFBSurfaceBlittingFlags blittingflags; + + /* Flush every bunch of commands to avoid issue with the XServer... */ + unsigned int calls; + + /** Add local data here... **/ +} GLDriverData; + + +#endif -- cgit